Exporting your GRASS raster using r.out.gdal? Check the createopt options!

GRASS GIS can export your raster layer in most common (and quite a few less common) data formats using the r.out.gdal function (menu: file – export raster map – common raster formats). Exporting is so simple that you may forget that depending on the output format there are different options to optimise your output raster layer.

The r.out.gdal function uses the gdal utility internally to export your raster file. That means you can use any parameter available in gdal. You can do this via the createopt and metaopt parameters. So, if you are exporting your data, the first step is to consult the individual supported formats pages on the GDAL website to check the possible options.

For example, when you export your raster as geotif, r.out.gdal by default does not compress your output layer. In gdal the parameters to compress your geotif file are compress and predictor, which you can use as follows:

r.out.gdal input=in_image.tif output=out_image.tif format=GTiff type=UInt16 createopt="compress=lzw,predictor=2"

See this webpage for an explanation. Using these two parameters properly can result in a dramatic reduction of file size. Using the command above gave me a geotif file of 35MB. Exporting the same raster layer without compression gave me a geotif file of 3GB! Of course, your result will vary depending on the nature of your data, but in general it is worth typing in these few extra parameters.

Of course, you can accomplish the same using the r.out.gdal window, see the screenshot of the r.out.gdal window below for an example.

screenshot r.out.gdal






One thought on “Exporting your GRASS raster using r.out.gdal? Check the createopt options!

  1. Pingback: Exportando un raster desde Grass Gis a Arcgis. | Geoendemics

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s