other versions
- wheezy 6.4.2-2
- jessie 6.4.4-1
- testing 7.2.0-2
- unstable 7.2.0-2
- experimental 7.2.1-1~exp1
r.out.gdal(1grass) | Grass User's Manual | r.out.gdal(1grass) |
NAME¶
r.out.gdal - Exports GRASS raster maps into GDAL supported formats.KEYWORDS¶
raster, exportSYNOPSIS¶
r.out.gdalFlags:¶
- -l
-
- -c
-
- -f
-
- --verbose
-
- --quiet
-
Parameters:¶
- input=name
-
- format=string
-
- type=string
-
- output=name
-
- createopt=string[,string,...]
-
- metaopt=string[,string,...]
-
- nodata=float
-
DESCRIPTION¶
r.out.gdal allows a user to export a GRASS raster map layer into any GDAL supported raster map format. If a GRASS raster map is exported for a particular application, the application's native format would be preferrable. GeoTIFF is supported by a wide range of applications (see also NOTES on GeoTIFF below). To specify multiple creation options use a comma separated list ( createopt="TFW=YES,COMPRESS=DEFLATE"). For possible createopt and metaopt parameters please consult the individual supported formats pages on the GDAL website. The createopt parameter may be used to create TFW or World files ("TFW=YES","WORLDFILE=ON"). r.out.gdal also supports the export of multiband rasters as a group, when the imagery group's name is entered as input. (created imagery groups with the i.group module) As with most GRASS raster modules, the current region extents and region resolution are used, and a MASK is respected if present. Use g.region's "align=", or "rast=" options if you need to realign the region settings to match the original map's before export.SUPPORTED RASTER FORMATS¶
The set of supported raster formats written by r.out.gdal depends on the local GDAL installation. Available may be (incomplete list):AAIGrid: Arc/Info ASCII Grid
BMP: MS Windows Device Independent Bitmap
BSB: Maptech BSB Nautical Charts
DTED: DTED Elevation Raster
ELAS: ELAS
ENVI: ENVI .hdr Labelled
FIT: FIT Image
GIF: Graphics Interchange Format (.gif)
GTiff: GeoTIFF
HDF4Image: HDF4 Dataset
HFA: Erdas Imagine Images (.img)
JPEG2000: JPEG-2000 part 1 (ISO/IEC 15444-1)
JPEG: JPEG JFIF
MEM: In Memory Raster
MFF2: Atlantis MFF2 (HKV) Raster
MFF: Atlantis MFF Raster
NITF: National Imagery Transmission Format
PAux: PCI .aux Labelled
PCIDSK: PCIDSK Database File
PNG: Portable Network Graphics
PNM: Portable Pixmap Format (netpbm)
VRT: Virtual Raster
XPM: X11 PixMap Format
NOTES¶
Out of the GDAL data types, the closest match for GRASS CELL, FCELL and DCELL rasters are respectively Int32, Float32 and Float64. These are not exact equivalents, but they will preserve the maximum possible data range and number of decimal places for each respective GRASS raster data type. Please keep in mind that not all CELL rasters will require Int32 - e.g., 0-255 CELL raster are covered by the Byte type as well. Moreover, some GDAL-supported formats do not support all the data types possible in GDAL and GRASS. Use r.info to check the data type and range for your GRASS raster, refer to specific format documentation (on the GDAL website), format vendor's documentation, and e.g. the Wikipedia article Typical boundaries of primitive integral types for details.Ranges of GDAL data types¶
GDAL data type minimum maximum
Byte 0 255
UInt16 0 65,535
Int16, CInt16 -32,768 32,767
UInt32 0 4,294,967,295
Int32, CInt32 -2,147,483,648 2,147,483,647
Float32, CFloat32 -3.4E38 3.4E38
Float64, CFloat64 -1.79E308 1.79E308
GeoTIFF caveats¶
GeoTIFF exports can only be displayed by standard image viewers if the GDAL data type was set to Byte and the GeoTIFF contains either one or three bands. All other data types and numbers of bands can be properly read with GIS software only. Although GeoTIFF files usually have a .tif extension, these files are not necessarily images but first of all spatial raster datasets, e.g. SRTM DEM version 4. When writing out multi-band GeoTIFF images for users of ESRI software or ImageMagick, the interleaving mode should be set to "pixel" using createopt="INTERLEAVE=PIXEL". BAND interleaving is slightly more efficient, but not supported by some applications. This issue only arises when writing out multi-band imagery groups.Improving GeoTIFF compatibility¶
To create a GeoTIFF that is highly compatible with various other GIS software packages, it is recommended to keep the GeoTIFF file as simple as possible. You will have to experiment with which options your software is compatible with, as this varies widely between vendors and versions. Long term, the less metadata you have to remove the more self-documenting (and useful) the dataset will be. Here are some things to try:- Create a World file with createopt="TFW=YES".
- Do not use GeoTIFF internal compression. Other GIS software often supports only a subset of the available compression methods with the supported methods differing between GIS software packages. Unfortunately this means the output image can be rather huge, but the file can be compressed with software like zip, gnuzip, or bzip2.
- Skip exporting the color table. Color tables are not always properly rendered, particularly for type UInt16, and the GeoTIFF file can appear completely black. If you are lucky the problematic software package has a method to reset the color table and assign a new color table (sometimes called symbology).
- Keep metadata simple with createopt="PROFILE=GeoTIFF" or createopt="PROFILE=BASELINE". With BASELINE no GDAL or GeoTIFF tags will be written and a World file is required ( createopt="TFW=YES").
- Adding overviews with gdaladdo after exporting can speed up display. Note that other software might create their own overviews, ignoring existing overviews.
EXAMPLES¶
Export the integer raster roads map to GeoTIFF format:¶
Export a DCELL raster map in GeoTIFF format suitable for ESRI software:¶
Export R,G,B imagery bands in GeoTIFF format suitable for ESRI software:¶
Export the floating point raster elevation map to ERDAS/IMG format:¶
Export group of image maps as multi-band file¶
GDAL RELATED ERROR MESSAGES¶
-
"ERROR 6: SetColorInterpretation() not supported for this dataset.": This may indicate that the color table was not written properly. But usually it will be correct and the message can be ignored.
-
"ERROR 6: SetNoDataValue() not supported for this dataset.": The selected output format does not support "no data". It is recommended to use a different output format if your data contains NULLs.
-
"Warning 1: Lost metadata writing to GeoTIFF ... too large to fit in tag.": The color table metadata may be too large. It is recommended to simplify or not write the color table, or use a different output format.
SEE ALSO¶
The GDAL supported formats page.REFERENCES¶
GDAL Pages: http://www.gdal.orgAUTHORS¶
Vytautas Vebra (oliver4grass at gmail.com)GRASS 6.4.2 |