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 thePERMANENTmapset. 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 theprojectparameter 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. If0, no offset is added and the first band is1. Default:0.num_digits=integerβ Zero-padding of band number by filling with leading zeros up to given number. If0, length will be adjusted tooffsetnumber without leading zeros. Default:0. yes, this is the "make my band numbers look cute and uniform" buttonmap_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 ofkey=valuepairs.gdal_doo=stringβ GDAL dataset open options. Comma-separated list ofkey=valuepairs.
π 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
PERMANENTmapset), and - the raster will have been imported with the indicated output name into the
PERMANENTmapset. π
πΈ 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
offsetparameter 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_digitsparameter lets you define the number of leading zeros (zero padding) for band numbers β like turningband.1intoband.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 β thoseSUBDATASET_*_NAMEstrings are what you paste intor.in.gdal. Copy them exactly, don't be cute with the quotes π
π REFERENCES π
GDAL Pages: https://gdal.org
π SEE ALSO π
r.colorsr.importr.in.asciir.in.binr.nullt.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
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms