r.in.gdal(1grass)

okay bestie, welcome to r.in.gdal β€” straight out of the GRASS User's Manual. Strap in, she's a long one, but she's iconic for a reason. πŸ¦‹


✨ NAME ✨

r.in.gdal β€” Imports raster data into a GRASS raster map using GDAL library. πŸ’…

🏷️ KEYWORDS 🏷️

raster, import, create project


πŸ“œ SYNOPSIS πŸ“œ

r.in.gdal
r.in.gdal --help
r.in.gdal [-ojeflakcrp] input=name output=name
[band=integer[,integer,...]]   [memory=memory in MB]   [target=name]
[title=phrase]   [offset=integer]   [num_digits=integer]
[map_names_file=name]   [project=name]   [table=file]
[gdal_config=string]   [gdal_doo=string]   [--overwrite]  [--help]
[--verbose]  [--quiet]  [--ui]

🚩 Flags 🚩

  • -o β€” Override projection check (use current project's CRS). Basically: assume that the dataset has the same coordinate reference system as the current project. 😌
  • -j β€” Perform projection check only and exit. Just a little vibe check on the projection, then she's out. πŸ‘‹
  • -e β€” Extend region extents based on new dataset. Also updates the default region if in the PERMANENT mapset.
  • -f β€” List supported formats and exit. πŸ“‹
  • -l β€” Force Lat/Lon maps to fit into geographic coordinates (90N,S; 180E,W).
  • -a β€” Auto-adjustment for lat/lon. Attempt to fix small precision errors in resolution and extents. πŸ”§
  • -k β€” Keep band numbers instead of using band color names.
  • -c β€” Create the project specified by the "project" parameter and exit. Do not import the raster file. πŸ—οΈ
  • -r β€” Limit import to the current region.
  • -p β€” Print number of bands and exit. πŸ–¨οΈ
  • --overwrite β€” Allow output files to overwrite existing files.
  • --help β€” Print usage summary.
  • --verbose β€” Verbose module output.
  • --quiet β€” Quiet module output. 🀫
  • --ui β€” Force launching GUI dialog.

πŸŽ€ Parameters πŸŽ€

  • input=name [required] β€” Name of raster file to be imported.
  • output=name [required] β€” Name for output raster map.
  • band=integer[,integer,...] β€” Band(s) to select (default is all bands).
  • memory=memory in MB β€” Maximum memory to be used (in MB). Cache size for raster rows. Default: 300.
  • target=name β€” Name of GCPs target project (location). Name of project to create or to read CRS from for GCPs transformation.
  • title=phrase β€” Title for resultant raster map.
  • offset=integer β€” Offset to be added to band numbers. If 0, no offset is added and the first band is 1. Default: 0.
  • num_digits=integer β€” Zero-padding of band number by filling with leading zeros up to given number. If 0, length will be adjusted to ’offset’ number without leading zeros. Default: 0.
  • map_names_file=name β€” Name of the output file that contains the imported map names.
  • project=name β€” Name for new project (location) to create.
  • table=file β€” File prefix for raster attribute tables. The band number and ".csv" will be appended to the file prefix.
  • gdal_config=string β€” GDAL configuration options. Comma-separated list of key=value pairs.
  • gdal_doo=string β€” GDAL dataset open options. Comma-separated list of key=value pairs.

🌸 DESCRIPTION 🌸

r.in.gdal allows a user to create a GRASS raster map layer, or imagery group, from any GDAL supported raster map format, with an optional title. The imported file may also be used to create a new project (previously called location). No cap, she's versatile like that. ✨

πŸ—ΊοΈ GDAL supported raster formats πŸ—ΊοΈ

Full details on all GDAL supported formats are available at:

https://gdal.org/en/stable/drivers/raster/

to be continued, bestie... πŸ’œ

πŸŽ€ Selected formats out of the more than 140 supported formats πŸŽ€

ok so the table got real big and I'm giving it to you as a list bestie, but every single row is here, no cap. Reading order is: name, code, creation, georeferencing, max file size β€” same as always ✨

  • ADRG/ARC Digitilized Raster Graphics (ADRG) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • Arc/Info ASCII Grid (AAIGrid) β€” creation: yes Β· georeferencing: yes Β· max file size: 2GB
  • Arc/Info Binary Grid (.adf) (AIG) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • Arc/Info Export E00 GRID (E00GRID) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • ArcSDE Raster (SDE) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • ASCII Gridded XYZ (XYZ) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • BSB Nautical Chart Format (.kap) (BSB) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • CEOS (Spot for instance) (CEOS) β€” creation: no Β· georeferencing: no Β· max file size: --
  • DB2 (DB2) β€” creation: yes Β· georeferencing: yes Β· max file size: No limits
  • DODS / OPeNDAP (DODS) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • EarthWatch/DigitalGlobe .TIL (TIL) β€” creation: no Β· georeferencing: no Β· max file size: --
  • ENVI .hdr Labelled Raster (ENVI) β€” creation: yes Β· georeferencing: yes Β· max file size: No limits
  • Envisat Image Product (.n1) (ESAT) β€” creation: no Β· georeferencing: no Β· max file size: --
  • EOSAT FAST Format (FAST) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • Epsilon - Wavelet compressed images (EPSILON) β€” creation: yes Β· georeferencing: no Β· max file size: --
  • Erdas 7.x .LAN and .GIS (LAN) β€” creation: no Β· georeferencing: yes Β· max file size: 2GB
  • ERDAS Compressed Wavelets (.ecw) (ECW) β€” creation: yes Β· georeferencing: yes
  • Erdas Imagine (.img) (HFA) β€” creation: yes Β· georeferencing: yes Β· max file size: No limits
  • Erdas Imagine Raw (EIR) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • ERMapper (.ers) (ERS) β€” creation: yes Β· georeferencing: yes
  • ESRI .hdr Labelled (EHdr) β€” creation: yes Β· georeferencing: yes Β· max file size: No limits
  • EUMETSAT Archive native (.nat) (MSGN) β€” creation: no Β· georeferencing: yes
  • FIT (FIT) β€” creation: yes Β· georeferencing: no Β· max file size: --
  • FITS (.fits) (FITS) β€” creation: yes Β· georeferencing: no Β· max file size: --
  • Fuji BAS Scanner Image (FujiBAS) β€” creation: no Β· georeferencing: no Β· max file size: --
  • GDAL Virtual (.vrt) (VRT) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • Generic Binary (.hdr Labelled) (GENBIN) β€” creation: no Β· georeferencing: no Β· max file size: --
  • GeoPackage (GPKG) β€” creation: yes Β· georeferencing: yes Β· max file size: No limits
  • Geospatial PDF (PDF) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • GMT Compatible netCDF (GMT) β€” creation: yes Β· georeferencing: yes Β· max file size: 2GB
  • Golden Software Surfer 7 Binary Grid (GS7BG) β€” creation: yes Β· georeferencing: yes Β· max file size: 4GiB
  • Graphics Interchange Format (.gif) (GIF) β€” creation: yes Β· georeferencing: no Β· max file size: 2GB
  • GRASS Raster Format (GRASS) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • GSat File Format (GFF) β€” creation: no Β· georeferencing: no Β· max file size: --
  • Hierarchical Data Format Release 4 (HDF4) (HDF4) β€” creation: yes Β· georeferencing: yes Β· max file size: 2GiB
  • Hierarchical Data Format Release 5 (HDF5) (HDF5) β€” creation: no Β· georeferencing: yes Β· max file size: 2GiB
  • Idrisi Raster (RST) β€” creation: yes Β· georeferencing: yes Β· max file size: No limits
  • ILWIS Raster Map (.mpr,.mpl) (ILWIS) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • Image Display and Analysis (WinDisp) (IDA) β€” creation: yes Β· georeferencing: yes Β· max file size: 2GB
  • In Memory Raster (MEM) β€” creation: yes Β· georeferencing: yes
  • Intergraph Raster (INGR) β€” creation: yes Β· georeferencing: yes Β· max file size: 2GiB
  • IRIS (IRIS) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • Japanese DEM (.mem) (JDEM) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • JAXA PALSAR Product Reader (Level 1.1/1.5) (JAXAPALSAR) β€” creation: no Β· georeferencing: no Β· max file size: --
  • JPEG2000 (.jp2, .j2k) (JP2OpenJPEG) β€” creation: yes Β· georeferencing: yes
  • JPEG JFIF (.jpg) (JPEG) β€” creation: yes Β· georeferencing: yes Β· max file size: 4GiB
  • KMLSUPEROVERLAY (KMLSUPEROVERLAY) β€” creation: yes Β· georeferencing: yes
  • MBTiles (MBTiles) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • Meta Raster Format (MRF) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • Meteosat Second Generation (MSG) β€” creation: no Β· georeferencing: yes
  • MG4 Encoded Lidar (MG4Lidar) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • Microsoft Windows Device Independent Bitmap (BMP) β€” creation: yes Β· georeferencing: yes Β· max file size: 4GiB
  • Military Elevation Data (.dt0, .dt1, .dt2) (DTED) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • Multi-resolution Seamless Image Database (MrSID) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • NASA Planetary Data System (PDS) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • NetCDF (netCDF) β€” creation: yes Β· georeferencing: yes Β· max file size: 2GB
  • Netpbm (.ppm,.pgm) (PNM) β€” creation: yes Β· georeferencing: no Β· max file size: No limits
  • NITF (NITF) β€” creation: yes Β· georeferencing: yes Β· max file size: 10GB
  • NLAPS Data Format (NDF) β€” creation: no Β· georeferencing: yes Β· max file size: No limits
  • NOAA NGS Geoid Height Grids (NGSGEOID) β€” creation: no Β· georeferencing: yes
  • NOAA Polar Orbiter Level 1b Data Set (AVHRR) (L1B) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • OGC Web Coverage Service (WCS) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • OGC Web Map Service, and TMS, WorldWind, On Ea (WMS) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • OGC Web Map Tile Service (WMTS) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • OGDI Bridge (OGDI) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • Oracle Spatial GeoRaster (GEORASTER) β€” creation: yes Β· georeferencing: yes Β· max file size: No limits
  • OziExplorer .MAP (MAP) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • OZI OZF2/OZFX3 (OZI) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • PCI Geomatics Database File (PCIDSK) β€” creation: yes Β· georeferencing: yes Β· max file size: No limits
  • PCRaster (PCRaster) β€” creation: yes Β· georeferencing: yes
  • Planet Labs Mosaics API (PLMosaic) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • Portable Network Graphics (.png) (PNG) β€” creation: yes Β· georeferencing: no
  • PostGIS Raster (previously WKTRaster) (PostGISRaster) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • RadarSat2 XML (product.xml) (RS2) β€” creation: no Β· georeferencing: yes Β· max file size: 4GB
  • Rasdaman (RASDAMAN) β€” creation: no Β· georeferencing: no Β· max file size: No limits
  • Rasterlite - Rasters in SQLite DB (Rasterlite) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • Raster Product Format/RPF (CADRG, CIB) (RPFTOC) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • R Object Data Store (R) β€” creation: yes Β· georeferencing: no Β· max file size: --
  • ROI_PAC Raster (ROI_PAC) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • R Raster (.grd) (RRASTER) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • SAGA GIS Binary format (SAGA) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • SAR CEOS (SAR_CEOS) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • Sentinel 1 SAR SAFE (manifest.safe) (SAFE) β€” creation: no Β· georeferencing: yes Β· max file size: No limits
  • Sentinel 2 (SENTINEL2) β€” creation: no Β· georeferencing: yes Β· max file size: No limits
  • SGI Image Format (SGI) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • SRTM HGT Format (SRTMHGT) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • TerraSAR-X Complex SAR Data Product (COSAR) β€” creation: no Β· georeferencing: no Β· max file size: --
  • TerraSAR-X Product (TSX) β€” creation: yes Β· georeferencing: no Β· max file size: --
  • TIFF / BigTIFF / GeoTIFF (.tif) (GTiff) β€” creation: yes Β· georeferencing: yes Β· max file size: 4GiB/None for BigTIFF
  • USGS ASCII DEM / CDED (.dem) (USGSDEM) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • USGS Astrogeology ISIS cube (Version 3) (ISIS3) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • USGS SDTS DEM (*CATD.DDF) (SDTS) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • Vexcel MFF (MFF) β€” creation: yes Β· georeferencing: yes Β· max file size: No limits
  • VICAR (VICAR) β€” creation: no Β· georeferencing: yes Β· max file size: --
  • VTP Binary Terrain Format (.bt) (BT) β€” creation: yes Β· georeferencing: yes Β· max file size: --
  • WEBP (WEBP) β€” creation: yes Β· georeferencing: no Β· max file size: --
  • WMO GRIB1/GRIB2 (.grb) (GRIB) β€” creation: no Β· georeferencing: yes Β· max file size: 2GB
ok queen real talk: some of these rows just don't have a max file size listed in the source, so there's nothing for me to tell you there. Not hiding anything, promise πŸ™ˆ

✨ Project Creation ✨

So when r.in.gdal imports stuff, it tries to keep your coordinate reference system (CRS) info intact β€” but only if the source format actually includes CRS info, and only if the GDAL driver supports it. Two conditions, both gotta be a yes, periodt πŸ’…

If the CRS of the source dataset does not match the CRS of your current project, r.in.gdal will throw an error message at you:

Coordinate reference system of dataset does not appear to match current project

...and then it'll report the PROJ_INFO parameters of the source dataset so you can actually see what's going on. Rude but helpful 🫢

If you genuinely want to ignore the difference between the apparent coordinate system of the source data and your current project, you're allowed to β€” just pass the -o flag to override the CRS check. You're the main character, bestie.

Now, if what you actually want is to import the data along with the full CRS definition, r.in.gdal can straight up create a brand new project for you, built from the CRS and extents of the file it's reading. How? You pass the name you want for that new project via the project parameter. When the command finishes, boom β€” a new project exists (and it has only a PERMANENT mapset), and the raster has been imported with the output name you indicated into that PERMANENT mapset. Iconic behaviour, honestly πŸ‘‘


πŸ¦‹ Support for Ground Control Points πŸ¦‹

If your image comes with Ground Control Points (GCP), they get written to a POINTS file inside an imagery group. And the slay part? They can be used directly by i.rectify. No extra steps, we love that for you.

The target option lets you automatically re-project the GCPs out of their own CRS and into a different CRS β€” specifically one read from the PROJ_INFO file of the project you name as target.

And if that target project doesn't exist yet? No stress πŸ’– a new project gets created to match the CRS definition of the GCPs. The target of the output group gets set to that new project, and now i.rectify can be used with zero further preparation. Chef's kiss, fr fr.

Heads up though: some satellite images (e.g. NOAA/AVHRR, ENVISAT) can contain hundreds or thousands of GCPs 😭 like, absolutely feral amounts. When that happens, thin plate spline coordinate transformation is what's recommended β€” either before import with:

gdalwarp -tps

or after import with:

i.rectify -t

Pick your era, both work 🌸

πŸŽ€ Map names: Management of offset and leading zeros πŸŽ€

ok so bestie, two little knobs here that will genuinely save your whole entire life πŸ’–

  • offset β€” lets you add an offset to band number(s), which is chef's kiss convenient when you're importing something like a continuous time series that got split across different input files.
  • num_digits β€” sets the number of leading zeros (zero padding) for band numbers, so band.1 can become band.001. iconic for sorting, fr fr ✨

πŸ’œ NOTES πŸ’œ

Importing big files can be significantly faster when you set memory to the size of the input file. lowkey the biggest glow-up you can give an import 🫢

The r.in.gdal command does support the following features, as long as the underlying format driver supports it too:

🌈 Color Table 🌈

Bands with associated colortables will have the color tables transferred. Note that if the source has no colormap, r.in.gdal in GRASS 5.0 will emit no colormap. Use r.colors map=... color=grey to assign a greyscale colormap. In a future version of GRASS r.in.gdal will likely be upgraded to automatically emit greyscale colormaps. ✨

🌈 Data Types 🌈

Most GDAL data types are supported. Float32 and Float64 type bands are translated as GRASS floating point cells (but not double precision ... this could be added if needed), and most other types are translated as GRASS integer cells. This includes 16bit integer data sources. Complex (some SAR signal data formats) data bands are translated to two floating point cell layers (*.real and *.imaginary). πŸ’…

🌈 Georeferencing 🌈

If the dataset has affine georeferencing information, this will be used to set the north, south, east and west edges. Rotational coefficients will be ignored, which results in incorrect positioning for rotated datasets. πŸ™ˆ

🌈 Coordinate reference system 🌈

The dataset's CRS will be used to compare to the current project or to define a new project. Internally GDAL represents CRS in OpenGIS Well Known Text format. A large subset of the total set of GRASS CRSs are supported. πŸ‘‘

🌈 Null Values 🌈

Raster bands for which a null value is recognised by GDAL will have the null pixels transformed into GRASS style nulls during import. Many generic formats (and formats poorly supported by GDAL) do not have a way of recognising null pixels, in which case r.null should be used after the import. 🫢

🌈 GCPs 🌈

Datasets that have Ground Control Points will have them imported as a POINTS file associated with the imagery group. Datasets with only one band that would otherwise have been translated as a simple raster map will also have an associated imagery group if there are ground control points. The coordinate system of the ground control points is reported by r.in.gdal but not preserved. It is up to the user to ensure that the project established with i.target has a compatible coordinate system before using the points with i.rectify. no pressure tho 😭

🌈 Raster Attribute Tables 🌈

r.in.gdal can write out raster attribute tables as CSV files. Moreover, information in raster attribute tables is automatically imported as long as the field definitions contain information about how to use a field, e.g. for color information or for labels. ✨

Planned improvements to r.in.gdal in the future include support for reporting everything known about a dataset if the output parameter is not set. (we love a future queen πŸ’–)


πŸ’€ Error Messages πŸ’€

"ERROR: Input map is rotated - cannot import." In this case the image must be first externally rotated, applying the rotation info stored in the metadata field of the raster image file. For example, the gdalwarp software can be used to transform the map to North-up (note, there are several gdalwarp parameters to select the resampling algorithm):
gdalwarp rotated.tif northup.tif

"ERROR: Coordinate reference system of dataset does not appear to match the current project." You need to create a project whose CRS matches the data you wish to import. Try using project parameter to create a new project based upon the CRS information in the file. If desired, you can then reproject it to another project with r.proj. Alternatively you can override this error by using the -o flag.

"WARNING: G_set_window(): Illegal latitude for North" Latitude/Longitude projects in GRASS can not have regions which exceed 90Β° North or South. Non-georeferenced imagery will have coordinates based on the image's number of pixels: 0,0 in the bottom left; cols,rows in the top right. Typically imagery will be much more than 90 pixels tall and so the GIS refuses to import it. If you are sure that the data is appropriate for your Lat/Lon project and intend to reset the map's bounds with the r.region module directly after import you may use the -l flag to constrain the map coordinates to legal values. While the resulting bounds and resolution will likely be wrong for your map, the map's data will be unaltered and safe. After resetting to known bounds with r.region you should double check them with r.info, paying special attention to the map resolution. In most cases you will want to import into the datafile's native CRS, or into a simple XY project and use the Georectification tools (i.rectify et al.) to re-project into the target project. The -l flag should only be used if you know the CRS is correct but the internal georeferencing has gotten lost, and you know what the map's bounds and resolution should be beforehand. πŸ’€

πŸ”₯ EXAMPLES πŸ”₯

🌦️ ECAD Data 🌦️

The European Climate Assessment and Dataset (ECAD) project provides climate data for Europe ranging from 1950 - 2015 or later. To import the different chunks of data provided by the project as netCDF files, the offset parameter can be used to properly assign numbers to the series of daily raster maps from 1st Jan 1950 (in case of importing the ECAD data split into multi-annual chunks). The ECAD data must be imported into a LatLong project. 🌍

By using the num_digits parameter leading zeros are added to the map name numbers, allowing for chronological numbering of the imported raster map layers, so that g.list lists them in the correct order. Here, use num_digits=5 to have a 5 digit suffix with leading zeros (00001 - 99999). πŸ’…

# Import of ECAD data split into chunks
# Import precipitation data
r.in.gdal -o input=rr_0.25deg_reg_1950-1964_v12.0.nc output=precipitation num_digits=5 offset=0
r.in.gdal -o input=rr_0.25deg_reg_1965-1979_v12.0.nc output=precipitation num_digits=5 offset=5479
r.in.gdal -o input=rr_0.25deg_reg_1980-1994_v12.0.nc output=precipitation num_digits=5 offset=10957
r.in.gdal -o input=rr_0.25deg_reg_1995-2015_v12.0.nc output=precipitation num_digits=5 offset=16436
# Import air pressure data
r.in.gdal -o input=pp_0.25deg_reg_1950-1964_v12.0.nc output=air_pressure num_digits=5 offset=0
r.in.gdal -o input=pp_0.25deg_reg_1965-1979_v12.0.nc output=air_pressure num_digits=5 offset=5479
r.in.gdal -o input=pp_0.25deg_reg_1980-1994_v12.0.nc output=air_pressure num_digits=5 offset=10957
r.in.gdal -o input=pp_0.25deg_reg_1995-2015_v12.0.nc output=air_pressure num_digits=5 offset=16436
# Import min temperature data
r.in.gdal -o input=tn_0.25deg_reg_1950-1964_v12.0.nc output=temperatur_min num_digits=5 offset=0
r.in.gdal -o input=tn_0.25deg_reg_1965-1979_v12.0.nc output=temperatur_min num_digits=5 offset=5479
r.in.gdal -o input=tn_0.25deg_reg_1980-1994_v12.0.nc output=temperatur_min num_digits=5 offset=10957
r.in.gdal -o input=tn_0.25deg_reg_1995-2015_v12.0.nc output=temperatur_min num_digits=5 offset=16436
# Import max temperature data
r.in.gdal -o input=tx_0.25deg_reg_1950-1964_v12.0.nc output=temperatur_max num_digits=5 offset=0
r.in.gdal -o input=tx_0.25deg_reg_1965-1979_v12.0.nc output=temperatur_max num_digits=5 offset=5479
r.in.gdal -o input=tx_0.25deg_reg_1980-1994_v12.0.nc output=temperatur_max num_digits=5 offset=10957
r.in.gdal -o input=tx_0.25deg_reg_1995-2015_v12.0.nc output=temperatur_max num_digits=5 offset=16436
# Import mean temperature data
r.in.gdal -o input=tg_0.25deg_reg_1950-1964_v12.0.nc output=temperatur_mean num_digits=5 offset=0
r.in.gdal -o input=tg_0.25deg_reg_1965-1979_v12.0.nc output=temperatur_mean num_digits=5 offset=5479
r.in.gdal -o input=tg_0.25deg_reg_1980-1994_v12.0.nc output=temperatur_mean num_digits=5 offset=10957
r.in.gdal -o input=tg_0.25deg_reg_1995-2015_v12.0.nc output=temperatur_mean num_digits=5 offset=16436

πŸŒ„ GTOPO30 DEM πŸŒ„

To avoid the GTOPO30 data being read incorrectly, you can add a new line "PIXELTYPE SIGNEDINT" in the .HDR to force interpretation of the file as signed rather than unsigned integers. Then the .DEM file can be imported. Finally, e.g. the 'terrain' color table can be assigned to the imported map with r.colors. ⛰️


🌍 GLOBE DEM 🌍

To import GLOBE DEM tiles (approx 1km resolution, better than GTOPO30 DEM data), the user has to download additionally the related HDR file(s). Finally, e.g. the 'terrain' color table can be assigned to the imported map with r.colors. See also their DEM portal. πŸ‘‘


πŸ¦‹ Raster file import over network πŸ¦‹

Since GDAL 2.x it is possible to import raster data over the network (see GDAL Virtual File Systems) including Cloud Optimized GeoTIFF, i.e. access uncompressed and compressed raster data via a http(s) or ftp connection. As an example the import of the global SRTMGL1 V003 tiles at 1 arc second (about 30 meters) resolution, void-filled: 🌐

r.in.gdal /vsicurl/https://www.datenatlas.de/geodata/public/srtmgl1/srtmgl1.003.tif output=srtmgl1_v003_30m memory=2000
g.region raster=srtmgl1_v003_30m -p
r.colors srtmgl1_v003_30m color=srtm_plus

πŸ›°οΈ HDF πŸ›°οΈ

The import of HDF bands requires the specification of the individual bands as seen by GDAL:

# Example MODIS FPAR
gdalinfo MOD15A2.A2003153.h18v04.004.2003171141042.hdf
...
Subdatasets:
  SUBDATASET_1_NAME=HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_MOD15A2:Fpar_1km
  SUBDATASET_1_DESC=[1200x1200] Fpar_1km MOD_Grid_MOD15A2 (8-bit unsigned integer)
  SUBDATASET_2_NAME=HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_MOD15A2:Lai_1km
  SUBDATASET_2_DESC=[1200x1200] Lai_1km MOD_Grid_MOD15A2 (8-bit unsigned integer)
...
# import of first band, here FPAR 1km:
r.in.gdal HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_MOD15A2:Fpar_1km \
          out=fpar_1km_2003_06_02
# ... likewise for other HDF bands in the file.

⭐ REFERENCES ⭐

GDAL Pages: https://gdal.org


πŸ‘‘ SEE ALSO πŸ‘‘

r.colors, r.import, r.in.ascii, r.in.bin, r.null, t.register

GRASS Wiki page: Import of Global datasets


πŸ’– AUTHOR πŸ’–

Frank Warmerdam (email).

πŸ’» SOURCE CODE πŸ’»

okay so if you wanna peek at the actual code (iykyk, reading source hits different), it's right here:

  • Available at: r.in.gdal source code (history)

Last time somebody touched it: Monday Dec 08 21:47:55 2025 in this commit, no cap:

d3c6479bef77a58e3b5d85259303dbfb9c1babe8

and if you're in your "I need to browse literally everything" era, the indexes are all right there waiting for you:

  • Main index
  • Raster index
  • Topics index
  • Keywords index
  • Graphical index
  • Full index

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual

and that's the whole page bestie πŸ’– you read an entire manpage, that's main character energy fr fr. go import something iconic. periodt βœ¨πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from