r.in.gdal.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <h2>DESCRIPTION</h2>
  2. <em>r.in.gdal</em> allows a user to create a GRASS GIS raster map layer,
  3. or imagery group, from any GDAL supported raster map format, with an optional
  4. title. The imported file may also be optionally used to create a new location.
  5. <!--
  6. Extended explanations:
  7. <dt><b>-e</b>
  8. <dd>Extend the DEFAULT_WIND in PERMANENT mapset to include the region of
  9. the new map layer. Old resolution is preserved, but the region, and rows/cols
  10. are updated. This will fail if the user doesn't have write access to the
  11. PERMANENT mapset.
  12. </dl>
  13. -->
  14. <h3>GDAL supported raster formats</h3>
  15. Full details on all GDAL supported formats are available at:
  16. <p>
  17. <a href="http://www.gdal.org/formats_list.html">http://www.gdal.org/formats_list.html</a>
  18. <p>
  19. Selected formats out of the more than 140 supported formats:
  20. <div class="code"><pre>
  21. Long Format Name Code Creation Georeferencing Maximum file size
  22. ---------------------------------------------+-------------+----------+--------------+-----------------
  23. ADRG/ARC Digitilized Raster Graphics ADRG Yes Yes --
  24. Arc/Info ASCII Grid AAIGrid Yes Yes 2GB
  25. Arc/Info Binary Grid (.adf) AIG No Yes --
  26. Arc/Info Export E00 GRID E00GRID No Yes --
  27. ArcSDE Raster SDE No Yes --
  28. ASCII Gridded XYZ XYZ Yes Yes --
  29. BSB Nautical Chart Format (.kap) BSB No Yes --
  30. CEOS (Spot for instance) CEOS No No --
  31. DB2 DB2 Yes Yes No limits
  32. DODS / OPeNDAP DODS No Yes --
  33. EarthWatch/DigitalGlobe .TIL TIL No No --
  34. ENVI .hdr Labelled Raster ENVI Yes Yes No limits
  35. Envisat Image Product (.n1) ESAT No No --
  36. EOSAT FAST Format FAST No Yes --
  37. Epsilon - Wavelet compressed images EPSILON Yes No --
  38. Erdas 7.x .LAN and .GIS LAN No Yes 2GB
  39. ERDAS Compressed Wavelets (.ecw) ECW Yes Yes
  40. Erdas Imagine (.img) HFA Yes Yes No limits
  41. Erdas Imagine Raw EIR No Yes --
  42. ERMapper (.ers) ERS Yes Yes
  43. ESRI .hdr Labelled EHdr Yes Yes No limits
  44. EUMETSAT Archive native (.nat) MSGN No Yes
  45. FIT FIT Yes No --
  46. FITS (.fits) FITS Yes No --
  47. Fuji BAS Scanner Image FujiBAS No No --
  48. GDAL Virtual (.vrt) VRT Yes Yes --
  49. Generic Binary (.hdr Labelled) GENBIN No No --
  50. GeoPackage GPKG Yes Yes No limits
  51. Geospatial PDF PDF Yes Yes --
  52. GMT Compatible netCDF GMT Yes Yes 2GB
  53. Golden Software Surfer 7 Binary Grid GS7BG Yes Yes 4GiB
  54. Graphics Interchange Format (.gif) GIF Yes No 2GB
  55. GRASS Raster Format GRASS No Yes --
  56. GSat File Format GFF No No --
  57. Hierarchical Data Format Release 4 (HDF4) HDF4 Yes Yes 2GiB
  58. Hierarchical Data Format Release 5 (HDF5) HDF5 No Yes 2GiB
  59. Idrisi Raster RST Yes Yes No limits
  60. ILWIS Raster Map (.mpr,.mpl) ILWIS Yes Yes --
  61. Image Display and Analysis (WinDisp) IDA Yes Yes 2GB
  62. In Memory Raster MEM Yes Yes
  63. Intergraph Raster INGR Yes Yes 2GiB
  64. IRIS IRIS No Yes --
  65. Japanese DEM (.mem) JDEM No Yes --
  66. JAXA PALSAR Product Reader (Level 1.1/1.5) JAXAPALSAR No No --
  67. JPEG2000 (.jp2, .j2k) JP2OpenJPEG Yes Yes
  68. JPEG JFIF (.jpg) JPEG Yes Yes 4GiB
  69. KMLSUPEROVERLAY KMLSUPEROVERLAY Yes Yes
  70. MBTiles MBTiles Yes Yes --
  71. Meta Raster Format MRF Yes Yes --
  72. Meteosat Second Generation MSG No Yes
  73. MG4 Encoded Lidar MG4Lidar No Yes --
  74. Microsoft Windows Device Independent Bitmap BMP Yes Yes 4GiB
  75. Military Elevation Data (.dt0, .dt1, .dt2) DTED Yes Yes --
  76. Multi-resolution Seamless Image Database MrSID No Yes --
  77. NASA Planetary Data System PDS No Yes --
  78. NetCDF netCDF Yes Yes 2GB
  79. Netpbm (.ppm,.pgm) PNM Yes No No limits
  80. NITF NITF Yes Yes 10GB
  81. NLAPS Data Format NDF No Yes No limits
  82. NOAA NGS Geoid Height Grids NGSGEOID No Yes
  83. NOAA Polar Orbiter Level 1b Data Set (AVHRR) L1B No Yes --
  84. OGC Web Coverage Service WCS No Yes --
  85. OGC Web Map Service, and TMS, WorldWind, On EaWMS No Yes --
  86. OGC Web Map Tile Service WMTS No Yes --
  87. OGDI Bridge OGDI No Yes --
  88. Oracle Spatial GeoRaster GEORASTER Yes Yes No limits
  89. OziExplorer .MAP MAP No Yes --
  90. OZI OZF2/OZFX3 OZI No Yes --
  91. PCI Geomatics Database File PCIDSK Yes Yes No limits
  92. PCRaster PCRaster Yes Yes
  93. Planet Labs Mosaics API PLMosaic No Yes --
  94. Portable Network Graphics (.png) PNG Yes No
  95. PostGIS Raster (previously WKTRaster) PostGISRaster No Yes --
  96. RadarSat2 XML (product.xml) RS2 No Yes 4GB
  97. Rasdaman RASDAMAN No No No limits
  98. Rasterlite - Rasters in SQLite DB Rasterlite Yes Yes --
  99. Raster Product Format/RPF (CADRG, CIB) RPFTOC No Yes --
  100. R Object Data Store R Yes No --
  101. ROI_PAC Raster ROI_PAC Yes Yes --
  102. R Raster (.grd) RRASTER No Yes --
  103. SAGA GIS Binary format SAGA Yes Yes --
  104. SAR CEOS SAR_CEOS No Yes --
  105. Sentinel 1 SAR SAFE (manifest.safe) SAFE No Yes No limits
  106. Sentinel 2 SENTINEL2 No Yes No limits
  107. SGI Image Format SGI Yes Yes --
  108. SRTM HGT Format SRTMHGT Yes Yes --
  109. TerraSAR-X Complex SAR Data Product COSAR No No --
  110. TerraSAR-X Product TSX Yes No --
  111. TIFF / BigTIFF / GeoTIFF (.tif) GTiff Yes Yes 4GiB/None for BigTIFF
  112. USGS ASCII DEM / CDED (.dem) USGSDEM Yes Yes --
  113. USGS Astrogeology ISIS cube (Version 3) ISIS3 No Yes --
  114. USGS SDTS DEM (*CATD.DDF) SDTS No Yes --
  115. Vexcel MFF MFF Yes Yes No limits
  116. VICAR VICAR No Yes --
  117. VTP Binary Terrain Format (.bt) BT Yes Yes --
  118. WEBP WEBP Yes No --
  119. WMO GRIB1/GRIB2 (.grb) GRIB No Yes 2GB
  120. </pre></div>
  121. <h3>Location Creation</h3>
  122. <em>r.in.gdal</em> attempts to preserve projection information when importing
  123. datasets if the source format includes projection information, and if
  124. the GDAL driver supports it. If the projection of the source dataset does
  125. not match the projection of the current location <em>r.in.gdal</em> will
  126. report an error message (<tt>Projection of dataset does not appear to
  127. match current location</tt>) and then report the PROJ_INFO parameters of
  128. the source dataset.
  129. <p>
  130. If the user wishes to ignore the difference between the apparent coordinate
  131. system of the source data and the current location, they may pass the
  132. <b>-o</b> flag to override the projection check.
  133. <p>
  134. If the user wishes to import the data with the full projection definition,
  135. it is possible to have r.in.gdal automatically create a new location based
  136. on the projection and extents of the file being read. This is accomplished
  137. by passing the name to be used for the new location via the <b>location</b>
  138. parameter. Upon completion of the command, a new location will have been
  139. created (with only a PERMANENT mapset), and the raster will have been
  140. imported with the indicated <b>output</b> name into the PERMANENT mapset.
  141. <h3>Support for GCPs</h3>
  142. In case the image contains GCPs they are written to a
  143. POINTS file within an imagery group. They can directly be used for
  144. <a href="i.rectify.html">i.rectify</a>.
  145. <p>
  146. The <b>target</b> option allows you to automatically re-project the GCPs
  147. from their own projection into another projection read from the
  148. PROJ_INFO file of the location name <b>target</b>.
  149. <p>
  150. If the <b>target</b> location does not exist, a new location will be
  151. created matching the projection definition of the GCPs. The target of
  152. the output group will be set to the new location, and
  153. <a href=i.rectify.html>i.rectify</a> can now be used without any further
  154. preparation.
  155. <p>
  156. Some satellite images (e.g. NOAA/AVHRR, ENVISAT) can contain hundreds
  157. or thousands of GCPs. In these cases thin plate spline coordinate
  158. transformation is recommended, either before import with
  159. <b>gdalwarp -tps</b> or after import with <b>i.rectify -t</b>.
  160. <h3>Map names: Management of offset and leading zeros</h3>
  161. The <b>offset</b> parameter allows adding an offset to band number(s) which
  162. is convenient in case of the import of e.g. a continuous time series split
  163. across different input files.
  164. <p>
  165. The <b>num_digits</b> parameter allows defining the number of leading zeros
  166. (zero padding) in case of band numbers (e.g., to turn <tt>band.1</tt> into
  167. <tt>band.001</tt>).
  168. <h2>NOTES</h2>
  169. Import of large files can be significantly faster when setting <b>memory</b> to
  170. the size of the input file.
  171. <p>
  172. The <em>r.in.gdal</em> command does support the following features, as long as
  173. the underlying format driver supports it:
  174. <p>
  175. <dl>
  176. <dt> Color Table
  177. <dd> Bands with associated colortables will have the color tables transferred.
  178. Note that if the source has no colormap, r.in.gdal in GRASS 5.0 will emit
  179. no colormap. Use r.colors map=... color=grey to assign a greyscale colormap.
  180. In a future version of GRASS r.in.gdal will likely be upgraded to automatically
  181. emit greyscale colormaps.<br>
  182. <dt> Data Types
  183. <dd> Most GDAL data types are supported. Float32 and Float64 type bands
  184. are translated as GRASS floating point cells (but not double precision ...
  185. this could be added if needed), and most other types are translated as
  186. GRASS integer cells. This includes 16bit integer data sources. Complex
  187. (some SAR signal data formats) data bands are translated to two floating
  188. point cell layers (*.real and *.imaginary).<br>
  189. <dt> Georeferencing
  190. <dd> If the dataset has affine georeferencing information, this will be used
  191. to set the north, south, east and west edges. Rotational coefficients will
  192. be ignored, resulting in incorrect positioning for rotated datasets.<br>
  193. <dt> Projection
  194. <dd> The datasets projection will be used to compare to the current location
  195. or to define a new location. Internally GDAL represents projections in
  196. OpenGIS Well Known Text format. A large subset of the total set of GRASS
  197. projections are supported.<br>
  198. <dt> Null Values
  199. <dd> Raster bands for which a null value is recognised by GDAL will have
  200. the null pixels transformed into GRASS style nulls during import. Many
  201. generic formats (and formats poorly supported by GDAL) do not have a way
  202. of recognising null pixels in which case r.null should be used after the
  203. import.<br>
  204. <dt> GCPs
  205. <dd> Datasets that have Ground Control Points will have them imported as
  206. a POINTS file associated with the imagery group. Datasets with only one
  207. band that would otherwise have been translated as a simple raster map
  208. will also have an associated imagery group if there are ground control points.
  209. The coordinate system of the ground control points is reported by r.in.gdal
  210. but not preserved. It is up to the user to ensure that the location
  211. established with i.target has a compatible coordinate system before using
  212. the points with i.rectify.<br>
  213. </dl>
  214. <p>
  215. Planned improvements to <em>r.in.gdal</em> in the future include support for
  216. reporting everything known about a dataset if the <b>output</b> parameter is not set.
  217. <h3>Error Messages</h3>
  218. <i>"ERROR: Input map is rotated - cannot import."</i><br>
  219. In this case the image must be first externally rotated, applying the rotation info stored in
  220. the metadata field of the raster image file. For example, the
  221. <a href="http://www.gdal.org/gdal_utilities.html">gdalwarp</a> software can be used
  222. to transform the map to North-up (note, there are several gdalwarp parameters to select the
  223. resampling algorithm):
  224. <div class="code"><pre>
  225. gdalwarp rotated.tif northup.tif
  226. </pre></div>
  227. <p>
  228. <i>"ERROR: Projection of dataset does not appear to match the current location."</i><br>
  229. You need to create a location whose projection matches the data you
  230. wish to import. Try using <b>location</b> parameter to create a new
  231. location based upon the projection information in the file. If desired,
  232. you can then re-project it to another location with <em>r.proj</em>.
  233. Alternatively you can override this error by using the <b>-o</b> flag.
  234. <p>
  235. <i>"WARNING: G_set_window(): Illegal latitude for North"</i><br>
  236. Latitude/Longitude locations in GRASS can not have regions which exceed
  237. 90&deg; North or South. Non-georeferenced imagery will have coordinates
  238. based on the images's number of pixels: 0,0 in the bottom left; cols,rows
  239. in the top right. Typically imagery will be much more than 90 pixels tall
  240. and so the GIS refuses to import it. If you are sure that the data is
  241. appropriate for your Lat/Lon location and intentd to reset the map's
  242. bounds with the <em>r.region</em> module directly after import you may
  243. use the <b>-l</b> flag to constrain the map coordinates to legal values.
  244. While the resulting bounds and resolution will likely be wrong for your
  245. map the map's data will be unaltered and safe. After resetting to known
  246. bounds with <em>r.region</em> you should double check them with
  247. <em>r.info</em>, paying special attention to the map resolution. In most
  248. cases you will want to import into the datafile's native projection, or
  249. into a simple XY location and use the Georectifaction tools
  250. (<em>i.rectify</em> et al.) to properly project into the target location.
  251. The <b>-l</b> flag should <i>only</i> be used if you know the projection
  252. is correct but the internal georeferencing has gotten lost, and you know
  253. the what the map's bounds and resolution should be beforehand.
  254. <h2>EXAMPLES</h2>
  255. <h3>ECAD Data</h3>
  256. The <a href="http://eca.knmi.nl/">European Climate Assessment and Dataset (ECAD) project</a>
  257. provides climate data for Europe ranging from 1950 - 2015 or later
  258. (<a href="http://eca.knmi.nl/download/ensembles/ensembles.php">Terms of use</a>).
  259. To import the different chunks of data provided by the project as netCDF files,
  260. the offset parameter can be used to properly assign numbers to the series
  261. of daily raster maps from 1st Jan 1950 (in case of importing the ECAD data
  262. split into multi-annual chunks). The ECAD data must be imported into a
  263. LatLong location.
  264. <p>
  265. By using the <em>num_digits</em> parameter leading zeros are added to the
  266. map name numbers, allowing for chronological numbering of the imported raster
  267. map layers, so that <em>g.list</em> lists them in the correct order.
  268. Here, use <em>num_digits=5</em> to have a 5 digit suffix with leading zeros (00001 - 99999).
  269. </p>
  270. <div class="code"><pre>
  271. # Import of ECAD data split into chunks
  272. # Import precipitation data
  273. r.in.gdal -o input=rr_0.25deg_reg_1950-1964_v12.0.nc output=precipitation num_digits=5 offset=0
  274. r.in.gdal -o input=rr_0.25deg_reg_1965-1979_v12.0.nc output=precipitation num_digits=5 offset=5479
  275. r.in.gdal -o input=rr_0.25deg_reg_1980-1994_v12.0.nc output=precipitation num_digits=5 offset=10957
  276. r.in.gdal -o input=rr_0.25deg_reg_1995-2015_v12.0.nc output=precipitation num_digits=5 offset=16436
  277. # Import air pressure data
  278. r.in.gdal -o input=pp_0.25deg_reg_1950-1964_v12.0.nc output=air_pressure num_digits=5 offset=0
  279. r.in.gdal -o input=pp_0.25deg_reg_1965-1979_v12.0.nc output=air_pressure num_digits=5 offset=5479
  280. r.in.gdal -o input=pp_0.25deg_reg_1980-1994_v12.0.nc output=air_pressure num_digits=5 offset=10957
  281. r.in.gdal -o input=pp_0.25deg_reg_1995-2015_v12.0.nc output=air_pressure num_digits=5 offset=16436
  282. # Import min temperature data
  283. r.in.gdal -o input=tn_0.25deg_reg_1950-1964_v12.0.nc output=temperatur_min num_digits=5 offset=0
  284. r.in.gdal -o input=tn_0.25deg_reg_1965-1979_v12.0.nc output=temperatur_min num_digits=5 offset=5479
  285. r.in.gdal -o input=tn_0.25deg_reg_1980-1994_v12.0.nc output=temperatur_min num_digits=5 offset=10957
  286. r.in.gdal -o input=tn_0.25deg_reg_1995-2015_v12.0.nc output=temperatur_min num_digits=5 offset=16436
  287. # Import max temperature data
  288. r.in.gdal -o input=tx_0.25deg_reg_1950-1964_v12.0.nc output=temperatur_max num_digits=5 offset=0
  289. r.in.gdal -o input=tx_0.25deg_reg_1965-1979_v12.0.nc output=temperatur_max num_digits=5 offset=5479
  290. r.in.gdal -o input=tx_0.25deg_reg_1980-1994_v12.0.nc output=temperatur_max num_digits=5 offset=10957
  291. r.in.gdal -o input=tx_0.25deg_reg_1995-2015_v12.0.nc output=temperatur_max num_digits=5 offset=16436
  292. # Import mean temperature data
  293. r.in.gdal -o input=tg_0.25deg_reg_1950-1964_v12.0.nc output=temperatur_mean num_digits=5 offset=0
  294. r.in.gdal -o input=tg_0.25deg_reg_1965-1979_v12.0.nc output=temperatur_mean num_digits=5 offset=5479
  295. r.in.gdal -o input=tg_0.25deg_reg_1980-1994_v12.0.nc output=temperatur_mean num_digits=5 offset=10957
  296. r.in.gdal -o input=tg_0.25deg_reg_1995-2015_v12.0.nc output=temperatur_mean num_digits=5 offset=16436
  297. </pre></div>
  298. <h3>GTOPO30 DEM</h3>
  299. To avoid that the GTOPO30 data are read incorrectly, you can add a new line
  300. "PIXELTYPE SIGNEDINT" in the .HDR to force interpretation of the file as
  301. signed rather than unsigned integers. Then the .DEM file can be imported.
  302. Finally, e.g. the 'terrain' color table can be assigned to the imported map
  303. with <em>r.colors</em>.
  304. <h3>GLOBE DEM</h3>
  305. To import <a href="http://www.ngdc.noaa.gov/mgg/topo/elev/">GLOBE DEM tiles</a>
  306. (approx 1km resolution, better than GTOPO30 DEM data), the user has to download
  307. additionally the related <a href="http://www.ngdc.noaa.gov/mgg/topo/elev/esri/hdr/">HDR file(s)</a>.
  308. Finally, e.g. the 'terrain' color table can be assigned to the imported map with <em>r.colors</em>.
  309. See also their <a href="http://www.ngdc.noaa.gov/mgg/dem/demportal.html">DEM portal</a>.
  310. <h3>Worldclim.org data</h3>
  311. To import the BIL data from <a href="http://www.worldclim.org">Worldclim</a>, the following
  312. line has to be added to each .hdr file:
  313. <div class="code"><pre>
  314. PIXELTYPE SIGNEDINT
  315. </pre></div>
  316. <p>
  317. To import the ESRI Grd data from <a href="http://www.worldclim.org">Worldclim</a>, the
  318. broken spatial extent (exceeding the boundaries) needs to be fixed prior to import:
  319. <div class="code"><pre>
  320. # example: tmean dataset
  321. gdal_translate -a_ullr -180 90 180 -60 tmean_1 tmean_1_fixed.tif
  322. r.in.gdal input=tmean_1_fixed.tif output=tmean_1
  323. </pre></div>
  324. <h3>HDF</h3>
  325. The import of HDF bands requires the specification of the individual bands
  326. as seen by GDAL:
  327. <div class="code"><pre>
  328. # Example MODIS FPAR
  329. gdalinfo MOD15A2.A2003153.h18v04.004.2003171141042.hdf
  330. ...
  331. Subdatasets:
  332. SUBDATASET_1_NAME=HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_MOD15A2:Fpar_1km
  333. SUBDATASET_1_DESC=[1200x1200] Fpar_1km MOD_Grid_MOD15A2 (8-bit unsigned integer)
  334. SUBDATASET_2_NAME=HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_MOD15A2:Lai_1km
  335. SUBDATASET_2_DESC=[1200x1200] Lai_1km MOD_Grid_MOD15A2 (8-bit unsigned integer)
  336. ...
  337. # import of first band, here FPAR 1km:
  338. r.in.gdal HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_MOD15A2:Fpar_1km \
  339. out=fpar_1km_2003_06_02
  340. # ... likewise for other HDF bands in the file.
  341. </pre></div>
  342. <h2>SEE ALSO</h2>
  343. <em>
  344. <a href="r.colors.html">r.colors</a>,
  345. <a href="r.import.html">r.import</a>,
  346. <a href="r.in.ascii.html">r.in.ascii</a>,
  347. <a href="r.in.bin.html">r.in.bin</a>,
  348. <a href="r.null.html">r.null</a>,
  349. <a href="t.register.html">t.register</a>
  350. </em>
  351. <p>
  352. GRASS GIS Wiki page: Import of <a href="http://grasswiki.osgeo.org/wiki/Global_datasets">Global datasets</a>
  353. <h2>REFERENCES</h2>
  354. GDAL Pages: <a href="http://www.gdal.org">http://www.gdal.org/</a><br>
  355. <h2>AUTHOR</h2>
  356. <a href="http://home.gdal.org/warmerda/">Frank Warmerdam</a>
  357. (<a href="mailto:warmerdam AT pobox dot com">email</a>).
  358. <p>
  359. <i>Last changed: $Date$</i>