If you find this document usefull, please consider ordering a printed hardcopy!



1 Importing raster formats

GRASS GIS supports the import of many different raster formats. Generally, three format types should be considered.

Image format: The individual rasters always have positive, integral values in the known pixel-based image formats such as PPM, PNG, JPEG, and GIF.
ASCII format: The individual rasters of the ASCII format can contain positive and negative, integral values as well as floating point values. The ASCII-GRID of Arcinfo is an example of this format.
Binary format: In the binary raster format the individual pixels with positive and negative, integral values or floating point values can also be saved in different channels with different resolutions. (Geo)TIFF or ERDAS/IMG are examples for this format.

Now, it is time to mention a property of GRASS GIS related to raster data import: raster maps are always imported with their original resolution and border coordinates but they are exported with the current resolution and border setting of the region (see chapter 7.1).

For importing non-georeferenced data there are two cases to be considered:

  1. If the location including resolution is defined and the map has to fit in, the scan resolution complies with the required resolution (GRID RESOLUTION).
  2. If the parameter of the location can comply with the map to be imported - especialy the resolution - it has to be installed in such a way that the image can be imported unchanged.

Table 7 gives a list of modules used to import raster data in different formats i.e. formats of other GIS systems as well as special formats of other remotesensing sectors.


Table 7: GRASS modules for importing raster data
GRASS Import
Module command Raster format
r.in.ascii GRASS ASCII
r.in.bin BIL, GMT binary files, LANDSAT TM5
r.in.gdal ARC/INFO ASCII/Binary GRID, BIL, ERDAS (LAN, IMG),
  USGS DOQ, JPEG, SAR CEOS, EOSAT, GeoTIFF, PPM/PNM, SDTS DEM,
  GIF, PNG
  (see also http://www.gdal.org/formats_list.html)

Importing a GeoTiff file

The most frequently used module for importing raster data is r.in.gdal. As described in table 7, it is able to read and write many different formats (r.out.gdal). As an example we will import a geo-referenced map in ERDAS IMG format. We have prepared a small ASTERDEM of 30 m resolution based on vector data of the city of Osnabrueck. This is available on the GDF Hannover bR
(http://www.gdf-hannover.de/download).

r.in.gdal in=asterdem30m.img out=asterdem30m
 Projection of input dataset and current location appear to match.
 Proceeding with import...
  100%
 CREATING SUPPORT FILES FOR asterdem30m
 COPYING COLOR TABLE FOR asterdem30m

With the flag -e a possibly necessary spacial extent of the location's definition will be achieved.

# Adapting the current region to the map:
g.region rast=asterdem30m -p

The resulting map can be displayed using the Display Manager d.m or with the command d.rast. For this purpose, a GRASS monitor has to be started before with d.mon x0.

# Starting the Display Manager 
d.m&

# Displaying the map in the prompt:
d.mon x0 
d.rast asterdem30m


If you find this document usefull, please consider ordering a printed hardcopy!


© 2005, GDF Hannover bR - Solutions for spatial data analysis and remote sensing
Last modified: 29-08-2005