r.in.gdal(1)

πŸ’– r.in.gdal πŸ’–

okay bestie, welcome to r.in.gdal(1) from the GRASS GIS User's Manual β€” this is the page where we yank raster data from literally anywhere and drop it into GRASS. sit down, hydrate, we're doing this. 🫢


✨ NAME ✨

r.in.gdal β€” imports raster data into a GRASS raster map using the GDAL library. that's it, that's the whole job, and it ATE. πŸ’…


πŸŽ€ 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]

ngl the square brackets are giving "optional, babe" and the [-ojeflakcrp] blob is just all the single-letter flags squished together so you can be lazy and efficient. iconic behavior honestly. ✨


🚩 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. you're telling it to trust you. risky, but go off.
  • -j β€” Perform projection check only and exit. peek, judge, leave. πŸ’…
  • -e β€” Extend region extents based on new dataset. Also updates the default region if in the PERMANENT mapset. note that PERMANENT detail, it matters fr fr
  • -f β€” List supported formats and exit. a little menu of possibilities, slay.
  • -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. tiny glow-up for your numbers ✨
  • -k β€” Keep band numbers instead of using band color names. numbers > names, if that's your vibe.
  • -c β€” Create the project specified by the project parameter and exit. Do not import the raster file. just the project, no data, we're setting up the space first
  • -r β€” Limit import to the current region. stay in your lane bestie, respectfully.
  • -p β€” Print number of bands and exit. just the count, no commitment.
  • --overwrite β€” Allow output files to overwrite existing files. careful, this one does what it says 😭
  • --help β€” Print usage summary.
  • --verbose β€” Verbose module output. it will tell you everything, and I mean everything.
  • --quiet β€” Quiet module output. shhh. 🀫
  • --ui β€” Force launching GUI dialog. for when you want buttons instead of typing.

πŸ¦‹ Parameters πŸ¦‹

  • input=name [required] β€” Name of raster file to be imported.
  • output=name [required] β€” Name for output raster map. yes both of these are required, no you cannot skip them, the module will simply not play with you. πŸ’€
  • band=integer[,integer,...] β€” Band(s) to select (default is all bands). want just one? list one. want a lil squad? comma-separate them.
  • 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. give it a name that slaps. πŸŽ€
  • 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. yes, this is the "make my band numbers look cute and uniform" button
  • 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 πŸ’…

so what does r.in.gdal actually do, bestie? it allows a user to create a GRASS GIS raster map layer, or imagery group, from any GDAL supported raster map format, with an optional title. and the imported file may also be used to create a new project (previously called location). it's giving "one module, many destinies" ✨


🌍 GDAL supported raster formats 🌍

Full details on all GDAL supported formats are available at:

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

that link is the mothership of format info β€” every driver, every quirk, iykyk. πŸ¦‹

Selected formats out of the more than 140 supported formats β€” bestie, this is the greatest-hits list, not the whole thing. Every line is: name, code, Creation, Georeferencing, Maximum file size. ✨

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

πŸ’– Project Creation πŸ’–

okay so here's the situation. r.in.gdal tries to preserve coordinate reference system (CRS) information when it imports your datasets β€” but only if the source format actually includes CRS info, and only if the GDAL driver supports it. Two conditions, both gotta hit. 🎯

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

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

and then it reports the PROJ_INFO parameters of the source dataset. So it's not just yelling at you, it's showing its receipts. πŸ’…

If you wanna ignore the difference between the apparent coordinate system of the source data and the current project, you may pass the -o flag to override the CRS check. That's the "bestie I know, do it anyway" button.

And if you want the data imported with the full CRS definition, you can have r.in.gdal automatically create a new project based on the CRS and extents of the file being read. How? Pass the name you want for the new project via the project parameter. When the command finishes:

  • a new project will have been created (with only a PERMANENT mapset), and
  • the raster will have been imported with the indicated output name into the PERMANENT mapset. πŸŽ€

🌸 Support for Ground Control Points 🌸

If your image contains Ground Control Points (GCP), they get written to a POINTS file within an imagery group. From there they can be used directly for i.rectify. Iconic behaviour, honestly.

The target option lets you automatically re-project the GCPs from their own CRS into another CRS β€” specifically, the CRS read from the PROJ_INFO file of the project name target. πŸ¦‹

If the target project does not exist, a new project gets created matching the CRS definition of the GCPs. The target of the output group gets set to that new project, and i.rectify can now be used without any further preparation. Not me getting everything prepped for you ahead of time. ✨

Some satellite images (e.g. NOAA/AVHRR, ENVISAT) can contain hundreds or thousands of GCPs. 😭 In those cases thin plate spline coordinate transformation is recommended β€” either before import with gdalwarp -tps, or after import with i.rectify -t. Pick your moment, both are valid. πŸ’…

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

Okay bestie, this one's a lil chef's kiss feature that nobody tells you about, and it's literally the reason your time series import doesn't turn into chaos:

  • The offset parameter lets you add an offset to band number(s). It's so convenient when you're importing, say, a continuous time series that somebody split across different input files. You're basically telling GRASS "hey, these bands don't start at 1, they start at n." πŸ’…
  • The num_digits parameter lets you define the number of leading zeros (zero padding) for band numbers β€” like turning band.1 into band.001. Zero padding is the moment. πŸŽ€

🌸 NOTES 🌸

Big files? Import of large files can be significantly faster when you set memory to the size of the input file. No cap, that's the whole tip. πŸ”₯

The r.in.gdal command does support the following features, as long as the underlying format driver supports it. (Key vibe check: it's not on GRASS, it's on your driver. Periodt.)

πŸ’– 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. (so for now, do it yourself, bestie πŸ™ˆ)

πŸ’– 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, resulting in incorrect positioning for rotated datasets. (yes this is a real gotcha, go read the Error Messages section below, it's giving trauma 😭)

πŸ’– 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. πŸ‘‘

πŸ’– 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. (manifesting it fr fr)


πŸ’€ 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 images'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 Georectifaction 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 the what the map's bounds and resolution should be beforehand.

For real though β€” the -l flag is not a magic fix, it's a "I know exactly what I'm doing" flag. Read it twice. 😭

πŸ”₯ 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

importing a whole planet over curl is the most main character energy thing ever, I fear ✨

🌈 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.
psst β€” those SUBDATASET_*_NAME strings are what you paste into r.in.gdal. Copy them exactly, don't be cute with the quotes πŸ’…

πŸ’œ REFERENCES πŸ’œ

GDAL Pages: https://gdal.org


πŸ’œ SEE ALSO πŸ’œ

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

GRASS GIS Wiki page: Import of Global datasets


πŸ’œ AUTHOR πŸ’œ

Frank Warmerdam (email).


πŸ’œ SOURCE CODE πŸ’œ

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

Accessed: Saturday Jan 17 05:40:48 2026

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual


and that's the whole page, bestie 🫢 this was r.in.gdal(1) from GRASS 8.4.2, accessed Saturday Jan 17 05:40:48 2026 β€” go import something gorgeous. mwah πŸ’‹

πŸ“¦ where this page comes from