3
<em>r.in.gdal</em> allows a user to create a (binary) GRASS raster map layer,
4
or imagery group, from any GDAL supported raster map format, with an optional
5
title. The imported file may also be optionally used to create a new location.
12
<dd>Extend the DEFAULT_WIND in PERMANENT mapset to include the region of
13
the new map layer. Old resolution is preserved, but the region, and rows/cols
14
are updated. This will fail if the user doesn't have write access to the
18
<h3>GDAL supported raster formats</h3>
20
Full details on GDAL supported formats are available at:<p>
21
<a href="http://www.gdal.org/formats_list.html">http://www.gdal.org/formats_list.html</a><p>
22
Selected formats of the more than 80 supported formats:
23
<div class="code"><pre>
25
Long Format Name Code Creation Georeferencing Maximum File Size
27
Arc/Info ASCII Grid AAIGrid Yes Yes No limits
28
Arc/Info Binary Grid AIG No Yes --
29
AIRSAR Polarimetric AIRSAR No No --
30
Microsoft Windows Device Independent Bitmap (.bmp) BMP Yes Yes 4GiB
31
BSB Nautical Chart Format (.kap) BSB No Yes --
32
VTP Binary Terrain Format (.bt) BT Yes Yes --
33
CEOS (Spot for instance) CEOS No No --
34
First Generation USGS DOQ (.doq) DOQ1 No Yes --
35
New Labelled USGS DOQ (.doq) DOQ2 No Yes --
36
Data (.dt0, .dt1) DTED No Yes --
37
ERMapper Compressed Wavelets (.ecw) ECW Yes Yes
38
ESRI .hdr Labelled EHdr No Yes --
39
ENVI .hdr Labelled Raster ENVI Yes Yes No limits
40
Envisat Image Product (.n1) Envisat No No --
41
EOSAT FAST Format FAST No Yes --
42
FITS (.fits) FITS Yes No
43
Graphics Interchange Format (.gif) GIF Yes No 2GB
44
Arc/Info Binary Grid (.adf) GIO Yes Yes
45
GRASS Rasters GRASS No Yes --
46
TIFF / GeoTIFF (.tif) GTiff Yes Yes 4GiB
47
Hierarchical Data Format Release 4 (HDF4) HDF4 Yes Yes 2GiB
48
Erdas Imagine (.img) HFA Yes Yes No limits
49
Atlantis MFF2e HKV Yes Yes No limits
50
Image Display and Analysis (WinDisp) IDA Yes Yes 2GB
51
ILWIS Raster Map (.mpr,.mpl) ILWIS Yes Yes --
52
Japanese DEM (.mem) JDEM No Yes --
53
JPEG JFIF (.jpg) JPEG Yes Yes 4GiB (max dimentions 65500x65500)
54
JPEG2000 (.jp2, .j2k) JPEG2000 Yes Yes 2GiB
55
JPEG2000 (.jp2, .j2k) JP2KAK Yes Yes No limits
56
NOAA Polar Orbiter Level 1b Data Set (AVHRR) L1B No Yes --
57
Erdas 7.x .LAN and .GIS LAN No Yes 2GB
58
In Memory Raster MEM Yes Yes 2GiB
59
Atlantis MFF MFF Yes Yes No limits
60
Multi-resolution Seamless Image Database MrSID No Yes --
61
NDF NLAPS Data Format No Yes No limits
63
NetCDF netCDF Yes Yes 2GB
64
OGDI Bridge OGDI No Yes --
65
PCI .aux Labelled PAux Yes No No limits
66
PCI Geomatics Database File PCIDSK Yes Yes No limits
67
Portable Network Graphics (.png) PNG Yes No
68
PCRaster (.map) PCRaster Yes No
69
Netpbm (.ppm,.pgm) PNM Yes No No limits
70
RadarSat2 XML (product.xml) RS2 No Yes 4GB
71
USGS SDTS DEM (*CATD.DDF) SDTS No Yes --
72
SAR CEOS SAR_CEOS No Yes --
73
USGS ASCII DEM (.dem) USGSDEM No Yes --
74
X11 Pixmap (.xpm) XPM Yes No
77
<h3>Location Creation</h3>
79
<em>r.in.gdal</em> attempts to preserve projection information when importing
80
datasets if the source format includes projection information, and if
81
the GDAL driver supports it. If the projection of the source dataset does
82
not match the projection of the current location <em>r.in.gdal</em> will
83
report an error message (<tt>Projection of dataset does not appear to
84
match current location</tt>) and then report the PROJ_INFO parameters of
87
<p>If the user wishes to ignore the difference between the apparent coordinate
88
system of the source data and the current location, they may pass the
89
<b>-o</b> flag to override the projection check.
92
If the user wishes to import the data with the full projection definition,
93
it is possible to have r.in.gdal automatically create a new location based
94
on the projection and extents of the file being read. This is accomplished
95
by passing the name to be used for the new location via the <b>location</b>
96
parameter. Upon completion of the command, a new location will have been
97
created (with only a PERMANENT mapset), and the raster will have been
98
imported with the indicated <b>output</b> name into the PERMANENT mapset.
100
<h3>Support for GCPs</h3>
101
In case the image contains GCPs they are written to a
102
POINTS file within an imagery group. They can directly be used for
103
<a href=i.rectify.html>i.rectify</a>.
105
The <b>target</b> option allows you to automatically re-project the GCPs
106
from their own projection into another projection read from the
107
PROJ_INFO file of the location name <b>target</b>.
109
If the <b>target</b> location does not exist, a new location will be
110
created matching the projection definition of the GCPs. The target of
111
the output group will be set to the new location, and
112
<a href=i.rectify.html>i.rectify</a> can now be used without any further
115
Some satellite images (e.g. NOAA/AVHRR, ENVISAT) can contain hundreds
116
or thousands of GCPs. In these cases thin plate spline coordinate
117
transformation is recommended, either before import with
118
<b>gdalwarp -tps</b> or after import with <b>i.rectify -t</b>.
122
Import of large files can be significantly faster when setting <b>memory</b> to
123
the size of the input file.
125
<p>The <em>r.in.gdal</em> command does support the following features, as long as
126
the underlying format driver supports it:
132
<dd> Bands with associated colortables will have the color tables transferred.
133
Note that if the source has no colormap, r.in.gdal in GRASS 5.0 will emit
134
no colormap. Use r.colors map=... color=grey to assign a greyscale colormap.
135
In a future version of GRASS r.in.gdal will likely be upgraded to automatically
136
emit greyscale colormaps.<br>
139
<dd> Most GDAL data types are supported. Float32 and Float64 type bands
140
are translated as GRASS floating point cells (but not double precision ...
141
this could be added if needed), and most other types are translated as
142
GRASS integer cells. This includes 16bit integer data sources. Complex
143
(some SAR signal data formats) data bands are translated to two floating
144
point cell layers (*.real and *.imaginary).<br>
147
<dd> If the dataset has affine georeferencing information, this will be used
148
to set the north, south, east and west edges. Rotational coefficients will
149
be ignored, resulting in incorrect positioning for rotated datasets.<br>
152
<dd> The datasets projection will be used to compare to the current location
153
or to define a new location. Internally GDAL represents projections in
154
OpenGIS Well Known Text format. A large subset of the total set of GRASS
155
projections are supported.<br>
158
<dd> Raster bands for which a null value is recognised by GDAL will have
159
the null pixels transformed into GRASS style nulls during import. Many
160
generic formats (and formats poorly supported by GDAL) do not have a way
161
of recognising null pixels in which case r.null should be used after the
165
<dd> Datasets that have Ground Control Points will have them imported as
166
a POINTS file associated with the imagery group. Datasets with only one
167
band that would otherwise have been translated as a simple raster map
168
will also have an associated imagery group if there are ground control points.
169
The coordinate system of the ground control points is reported by r.in.gdal
170
but not preserved. It is up to the user to ensure that the location
171
established with i.target has a compatible coordinate system before using
172
the points with i.rectify.<br>
176
<p>Planned improvements to <em>r.in.gdal</em> in the future include support for
177
reporting everything known about a dataset if the <b>output</b> parameter is not set.
179
<h3>Error Messages</h3>
181
<i>"ERROR: Input map is rotated - cannot import."</i><br>
182
In this case the image must be first externally rotated, applying the rotation info stored in
183
the metadata field of the raster image file. For example, the
184
<a href="http://www.gdal.org/gdal_utilities.html">gdalwarp</a> software can be used
185
to transform the map to North-up (note, there are several gdalwarp parameters to select the
186
resampling algorithm):
188
<div class="code"><pre>
189
gdalwarp rotated.tif northup.tif
192
<p><i>"ERROR: Projection of dataset does not appear to match the current location."</i><br>
194
You need to create a location whose projection matches the data you
195
wish to import. Try using <b>location</b> parameter to create a new
196
location based upon the projection information in the file. If desired,
197
you can then re-project it to another location with <em>r.proj</em>.
198
Alternatively you can override this error by using the <b>-o</b> flag.
200
<p><i>"WARNING: G_set_window(): Illegal latitude for North"</i><br>
202
Latitude/Longitude locations in GRASS can not have regions which exceed
203
90° North or South. Non-georeferenced imagery will have coordinates
204
based on the images's number of pixels: 0,0 in the bottom left; cols,rows
205
in the top right. Typically imagery will be much more than 90 pixels tall
206
and so the GIS refuses to import it. If you are sure that the data is
207
appropriate for your Lat/Lon location and intentd to reset the map's
208
bounds with the <em>r.region</em> module directly after import you may
209
use the <b>-l</b> flag to constrain the map coordinates to legal values.
211
While the resulting bounds and resolution will likely be wrong for your
212
map the map's data will be unaltered and safe. After resetting to known
213
bounds with <em>r.region</em> you should double check them with
214
<em>r.info</em>, paying special attention to the map resolution. In most
215
cases you will want to import into the datafile's native projection, or
216
into a simple XY location and use the Georectifaction tools
217
(<em>i.rectify</em> et al.) to properly project into the target location.
218
The <b>-l</b> flag should <i>only</i> be used if you know the projection
219
is correct but the internal georeferencing has gotten lost, and you know
220
the what the map's bounds and resolution should be beforehand.
227
The <a href="http://eca.knmi.nl/">European Climate Assessment and Dataset (ECAD) project</a>
228
provides climate data for europe ranging from 1950 - 2010. To import the different
229
chunks of data provided by the project as netCDF files, the offset parameter can be used to get
230
daily numbered raster maps from 1. Jan. 1950 on. Make sure you are in a LatLong location.
232
<div class="code"><pre>
233
# Import precipitation data
234
r.in.gdal -o input=rr_0.25deg_reg_1950-1964_v4.0.nc output=precipitation offset=0
235
r.in.gdal -o input=rr_0.25deg_reg_1965-1979_v4.0.nc output=precipitation offset=5479
236
r.in.gdal -o input=rr_0.25deg_reg_1980-1994_v4.0.nc output=precipitation offset=10957
237
r.in.gdal -o input=rr_0.25deg_reg_1995-2010_v4.0.nc output=precipitation offset=16436
239
# Import air pressure data
240
r.in.gdal -o input=pp_0.25deg_reg_1950-1964_v4.0.nc output=air_pressure offset=0
241
r.in.gdal -o input=pp_0.25deg_reg_1965-1979_v4.0.nc output=air_pressure offset=5479
242
r.in.gdal -o input=pp_0.25deg_reg_1980-1994_v4.0.nc output=air_pressure offset=10957
243
r.in.gdal -o input=pp_0.25deg_reg_1995-2010_v4.0.nc output=air_pressure offset=16436
245
# Import min temperature data
246
r.in.gdal -o input=tn_0.25deg_reg_1950-1964_v4.0.nc output=temperatur_min offset=0
247
r.in.gdal -o input=tn_0.25deg_reg_1965-1979_v4.0.nc output=temperatur_min offset=5479
248
r.in.gdal -o input=tn_0.25deg_reg_1980-1994_v4.0.nc output=temperatur_min offset=10957
249
r.in.gdal -o input=tn_0.25deg_reg_1995-2010_v4.0.nc output=temperatur_min offset=16436
251
# Import max temperature data
252
r.in.gdal -o input=tx_0.25deg_reg_1950-1964_v4.0.nc output=temperatur_max offset=0
253
r.in.gdal -o input=tx_0.25deg_reg_1965-1979_v4.0.nc output=temperatur_max offset=5479
254
r.in.gdal -o input=tx_0.25deg_reg_1980-1994_v4.0.nc output=temperatur_max offset=10957
255
r.in.gdal -o input=tx_0.25deg_reg_1995-2010_v4.0.nc output=temperatur_max offset=16436
257
# Import mean temperature data
258
r.in.gdal -o input=tg_0.25deg_reg_1950-1964_v4.0.nc output=temperatur_mean offset=0
259
r.in.gdal -o input=tg_0.25deg_reg_1965-1979_v4.0.nc output=temperatur_mean offset=5479
260
r.in.gdal -o input=tg_0.25deg_reg_1980-1994_v4.0.nc output=temperatur_mean offset=10957
261
r.in.gdal -o input=tg_0.25deg_reg_1995-2010_v4.0.nc output=temperatur_mean offset=16436
267
To avoid that the GTOPO30 data are read incorrectly, you can add a new line
268
"PIXELTYPE SIGNEDINT" in the .HDR to force interpretation of the file as
269
signed rather than unsigned integers. Then the .DEM file can be imported.
270
Finally, e.g. the 'terrain' color table can be assigned to the imported map
271
with <em>r.colors</em>.
276
To import <a href="http://www.ngdc.noaa.gov/seg/topo/gltiles.shtml">GLOBE DEM tiles</a>
277
(approx 1km resolution, better than GTOPO30 DEM data), the user has to download
278
additionally the related <a href="ftp://ftp.ngdc.noaa.gov/GLOBE_DEM/data/elev/esri/hdr/">HDR file(s)</a>.
279
Finally, e.g. the 'terrain' color table can be assigned to the imported map with <em>r.colors</em>.
281
<h3>Worldclim.org</h3>
282
To import <a href="http://www.worldclim.org">Worldclim</a> data, the following
283
line has to be added to each .hdr file:
284
<div class="code"><pre>
290
The import of HDF bands requires the specification of the individual bands
292
<div class="code"><pre>
294
gdalinfo MOD15A2.A2003153.h18v04.004.2003171141042.hdf
297
SUBDATASET_1_NAME=HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_MOD15A2:Fpar_1km
298
SUBDATASET_1_DESC=[1200x1200] Fpar_1km MOD_Grid_MOD15A2 (8-bit unsigned integer)
299
SUBDATASET_2_NAME=HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_MOD15A2:Lai_1km
300
SUBDATASET_2_DESC=[1200x1200] Lai_1km MOD_Grid_MOD15A2 (8-bit unsigned integer)
303
# import of first band, here FPAR 1km:
304
r.in.gdal HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_MOD15A2:Fpar_1km \
305
out=fpar_1km_2003_06_02
306
# ... likewise for other HDF bands in the file.
312
<a href="r.colors.html">r.colors</a>,
313
<a href="r.in.ascii.html">r.in.ascii</a>,
314
<a href="r.in.bin.html">r.in.bin</a>,
315
<a href="r.null.html">r.null</a>
321
GDAL Pages: <a href="http://www.gdal.org">http://www.gdal.org/</a><br>
326
<a href="http://home.gdal.org/warmerda/">Frank Warmerdam</a>
327
(<a href="mailto:warmerdam AT pobox dot com">email</a>).
329
<p><i>Last changed: $Date: 2014-11-01 20:59:34 +0100 (Sat, 01 Nov 2014) $</i>