1r.import(1) Grass User's Manual r.import(1)
2
3
4
6 r.import - Imports raster data into a GRASS raster map using GDAL
7 library and reprojects on the fly.
8
10 raster, import, projection
11
13 r.import
14 r.import --help
15 r.import [-enlo] input=name [band=integer[,integer,...]] [mem‐
16 ory=integer] [output=name] [resample=string] [extent=string]
17 [resolution=string] [resolution_value=float] [title=phrase]
18 [--overwrite] [--help] [--verbose] [--quiet] [--ui]
19
20 Flags:
21 -e
22 Estimate resolution only
23
24 -n
25 Do not perform region cropping optimization
26
27 -l
28 Force Lat/Lon maps to fit into geographic coordinates (90N,S;
29 180E,W)
30
31 -o
32 Override projection check (use current location’s projection)
33 Assume that the dataset has the same projection as the current
34 location
35
36 --overwrite
37 Allow output files to overwrite existing files
38
39 --help
40 Print usage summary
41
42 --verbose
43 Verbose module output
44
45 --quiet
46 Quiet module output
47
48 --ui
49 Force launching GUI dialog
50
51 Parameters:
52 input=name [required]
53 Name of GDAL dataset to be imported
54
55 band=integer[,integer,...]
56 Input band(s) to select (default is all bands)
57
58 memory=integer
59 Maximum memory to be used (in MB)
60 Cache size for raster rows
61 Default: 300
62
63 output=name
64 Name for output raster map
65
66 resample=string
67 Resampling method to use for reprojection
68 Options: nearest, bilinear, bicubic, lanczos, bilinear_f, bicu‐
69 bic_f, lanczos_f
70 Default: nearest
71 nearest: nearest neighbor
72 bilinear: bilinear interpolation
73 bicubic: bicubic interpolation
74 lanczos: lanczos filter
75 bilinear_f: bilinear interpolation with fallback
76 bicubic_f: bicubic interpolation with fallback
77 lanczos_f: lanczos filter with fallback
78
79 extent=string
80 Output raster map extent
81 Options: input, region
82 Default: input
83 input: extent of input map
84 region: extent of current region
85
86 resolution=string
87 Resolution of output raster map (default: estimated)
88 Options: estimated, value, region
89 Default: estimated
90 estimated: estimated resolution
91 value: user-specified resolution
92 region: current region resolution
93
94 resolution_value=float
95 Resolution of output raster map (use with option resolution=value)
96
97 title=phrase
98 Title for resultant raster map
99
101 r.import imports a map or selected bands from a GDAL raster datasource
102 into the current location and mapset. If the projection of the input
103 does not match the projection of the location, the input is reprojected
104 into the current location. If the projection of the input does match
105 the projection of the location, the input is imported directly with
106 r.in.gdal.
107
109 r.import checks the projection metadata of the dataset to be imported
110 against the current location’s projection. If not identical a related
111 error message is shown.
112 To override this projection check (i.e. to use current location’s pro‐
113 jection) by assuming that the dataset has the same projection as the
114 current location the -o flag can be used. This is also useful when geo‐
115 data to be imported do not contain any projection metadata at all. The
116 user must be sure that the projection is identical in order to avoid to
117 introduce data errors.
118
119 Resolution
120 r.import reports the estimated target resolution for each input band.
121 The estimated resolution will usually be some floating point number,
122 e.g. 271.301. In case option resolution is set to estimated (default),
123 this floating point number will be used as target resolution. Since the
124 target resolution should be typically the rounded estimated resolution,
125 e.g. 250 or 300 instead of 271.301, flag -e can be used first to obtain
126 the estimate without importing the raster bands. Then the desired res‐
127 olution is set with option resolution_value and option resolu‐
128 tion=value. For latlong locations, the resolution might be set to arc
129 seconds, e.g. 1, 3, 7.5, 15, and 30 arc seconds are commonly used reso‐
130 lutions.
131
132 Resampling methods
133 When reprojecting a map to a new spatial reference system, the pro‐
134 jected data is resampled with one of four different methods: nearest
135 neighbor, bilinear, bicubic iterpolation or lanczos.
136
137 In the following common use cases:
138
139 nearest is the simplest method and the only possible method for cate‐
140 gorical data.
141
142 bilinear does linear interpolation and provides smoother output than
143 nearest. bilinear is recommended when reprojecting a DEM for hydrologi‐
144 cal analysis or for surfaces where overshoots must be avoided, e.g.
145 precipitation should not become negative.
146
147 bicubic produces smoother output than bilinear, at the cost of over‐
148 shoots.
149
150 lanczos produces the smoothest output of all methods and preserves con‐
151 trast best. lanczos is recommended for imagery. Both bicubic and lanc‐
152 zos preserve linear features. With nearest or bilinear, linear features
153 can become zigzag features after reprojection.
154
155 For explanation of the -l flag, please refer to the r.in.gdal manual.
156
157 When importing whole-world maps the user should disable map-trimming
158 with the -n flag. For further explanations of -n flag, please refer the
159 to r.proj manual.
160
162 Import of SRTM V3 global data at 1 arc-seconds resolution
163 The SRTM V3 1 arc-second global data (~30 meters resolution) are avail‐
164 able from EarthExplorer (http://earthexplorer.usgs.gov/). The SRTM
165 collections are located under the "Digital Elevation" category.
166
167 Example for North Carolina sample dataset (the tile name is
168 "n35_w079_1arc_v3.tif"):
169 # set computational region to e.g. 10m elevation model:
170 g.region raster=elevation -p
171 # Import with reprojection on the fly. Recommended parameters:
172 # resample Resampling method to use for reprojection - bilinear
173 # extent Output raster map extent - region: extent of current region
174 # resolution Resolution of output raster map
175 # - region: current region resolution - limit to g.region setting from above
176 r.import input=n35_w079_1arc_v3.tif output=srtmv3_resamp10m resample=bilinear \
177 extent=region resolution=region title="SRTM V3 resampled to 10m resolution"
178 # beautify colors:
179 r.colors srtmv3_resamp10m color=elevation
180
181 Import of WorldClim data
182 Import of a subset from WorldClim Bioclim data set, to be reprojected
183 to current location projection (North Carolina sample dataset). Dif‐
184 ferent resolutions are available, in this example we use the 2.5
185 arc-minutes resolution data. During import, we spatially subset the
186 world data to the North Carolina region using the extent parameter:
187 # download selected Bioclim data (2.5 arc-minutes resolution)
188 # optionally tiles are available for the 30 arc-sec resolution
189 wget http://biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip
190 # extract BIO1 from package (BIO1 = Annual Mean Temperature):
191 unzip bio_2-5m_bil.zip bio1.bil bio1.hdr
192 # prior to import, fix broken WorldClim extent using GDAL tool
193 gdal_translate -a_ullr -180 90 180 -60 bio1.bil bio1_fixed.tif
194 # set computational region to North Carolina, 4000 m target pixel resolution
195 g.region -d res=4000 -ap
196 # subset to current region and reproject on the fly to current location projection,
197 # using -n since whole-world map is imported:
198 r.import input=bio1_fixed.tif output=bioclim01 resample=bilinear \
199 extent=region resolution=region -n
200 # temperature data are in °C * 10
201 r.info bioclim01
202 r.univar -e bioclim01
203
205 r.in.gdal, r.proj
206
208 Markus Metz
209 Improvements: Martin Landa, Anna Petrasova
210
211 Last changed: $Date: 2017-08-19 17:23:37 +0200 (Sat, 19 Aug 2017) $
212
214 Available at: r.import source code (history)
215
216 Main index | Raster index | Topics index | Keywords index | Graphical
217 index | Full index
218
219 © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
220
221
222
223GRASS 7.4.4 r.import(1)