GRASS 6 Tutorial/Raster data management: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
Line 7: Line 7:
In a similar way to the vector data management, the import and export of raster data is underpinned by GDAL. As such, the modules, <code>r.in.*</code> and <code>r.out.*</code> and specifically, <code>r.in.gdal</code> and <code>r.out.gdal</code> are used. The module <code>r.extenal</code> can be used in lieu of importing a raster into GRASS.
In a similar way to the vector data management, the import and export of raster data is underpinned by GDAL. As such, the modules, <code>r.in.*</code> and <code>r.out.*</code> and specifically, <code>r.in.gdal</code> and <code>r.out.gdal</code> are used. The module <code>r.extenal</code> can be used in lieu of importing a raster into GRASS.


A Geotiff can be imported into GRASS using the command line or the GUI
A Geotiff can be imported into GRASS using the command line (input represents the full or relative path to the raster file you want to import;  output is its raster name in GRASS). The same can be achieved using the GUI.
 
r.in.gdal input=elev_input_state500m.tif output=elev_input_state500m


[[File:Grass raster import.png|400px]]
[[File:Grass raster import.png|400px]]
A common issue that users are faced with is how to import several GeoTiffs? Obviously the above steps can be repeated using the GUI or copy-pasting the command line or more simply using the following BASH for loop:
for file in `ls *.tif`
  do
  r.in.gdal input=$file output=${file%.tif}
done

Revision as of 16:00, 25 April 2013

Raster data management

Overview

This section of the tutorial is intended to provide new users with an introduction to raster data management in GRASS GIS. As with other parts of the GRASS 6 tutorial, the examples are largely based on the GRASS 5.7 tutorial as well as the GRASS GIS presentation at Geostat-2012. The aim is to present the reader with introductory information on handling raster data within GRASS GIS.

Data Import

In a similar way to the vector data management, the import and export of raster data is underpinned by GDAL. As such, the modules, r.in.* and r.out.* and specifically, r.in.gdal and r.out.gdal are used. The module r.extenal can be used in lieu of importing a raster into GRASS.

A Geotiff can be imported into GRASS using the command line (input represents the full or relative path to the raster file you want to import; output is its raster name in GRASS). The same can be achieved using the GUI.

r.in.gdal input=elev_input_state500m.tif output=elev_input_state500m

A common issue that users are faced with is how to import several GeoTiffs? Obviously the above steps can be repeated using the GUI or copy-pasting the command line or more simply using the following BASH for loop:

for file in `ls *.tif`
 do
  r.in.gdal input=$file output=${file%.tif}
done