rasterintro (1) - Linux Manuals
Raster data processing in GRASS GIS
Raster maps in general
The geographic boundaries of the raster map are described by the north, south, east, and west fields. These values describe the lines which bound the map at its edges. These lines do NOT pass through the center of the grid cells at the edge of the map, but along the edge of the map itself.As a general rule in GRASS:
- 1
-
Raster output maps have their bounds and resolution equal to those of the current region. - 2
Raster input maps are automatically cropped/padded and rescaled (using nearest-neighbour resampling) to match the current region. - 3
Raster input maps are automatically masked if a raster map named MASK exists.
There are a few exceptions to this: r.in.* programs read the data cell-for-cell, with no resampling. When reading non-georeferenced data, the imported map will usually have its lower-left corner at (0,0) in the location's coordinate system; the user needs to use r.region to "place" the imported map.
Some programs which need to perform specific types of resampling (e.g. r.resamp.rst) read the input maps at their original resolution then do the resampling themselves.
r.proj has to deal with two regions (source and destination) simultaneously; both will have an impact upon the final result.
Raster import and export
The module r.in.gdal offers a common interface for many different raster formats. Additionally, it also offers options such as on-the-fly location creation or extension of the default region to match the extent of the imported raster map. For special cases, other import modules are available. Always the full map is imported.For importing scanned maps, the user will need to create a x,y-location, scan the map in the desired resolution and save it into an appropriate raster format (e.g. tiff, jpeg, png, pbm) and then use r.in.gdal to import it. Based on reference points the scanned map can be recified to obtain geocoded data.
Raster maps are exported with r.out.gdal into common formats. Also r.out.bin, r.out.vtk and other export modules are available.
Metadata
The r.info module displays general information about a map such as region extent, data range, data type, creation history, and other metadata. Metadata such as map title, units, vertical datum etc. can be updated with r.support. Timestamps are managed with r.timestamp. Region extent and resolution are mangaged with r.region.Raster map operations
GRASS raster map processing is always performed in the current region settings (see g.region), i.e. the current region extent and current raster resolution is used. If the resolution differs from that of the input raster map(s), on-the-fly resampling is performed (nearest neighbor resampling). If this is not desired, the input map(s) has/have to be resampled beforehand with one of the dedicated modules.If a raster map named "MASK" exists, most GRASS raster modules will operate only on data falling inside the masked area, and treat any data falling outside of the mask as if its value were NULL. The mask is only applied when reading an existing GRASS raster map, for example when used in a module as an input map. (see r.mask)
Raster map statistics
A couple of commands are available to calculate local statistics (r.neighbors), and global statistics (r.surf.area, r.sum). Profiles and transects can be generated (r.profile, r.transect) as well as histograms (d.histogram) and polar diagrams (d.polar). Univariate statistics (r.univar) and reports are also available (r.report,<a href="r.stats.html">r.stats, r.volume).Raster map algebra and aggregation
The r.mapcalc command provides raster map algebra methods. The r.resamp.stats command resamples raster map layers using various aggregation methods, the r.average command aggregates one map based on a second map. r.resamp.interp resamples raster map layers using interpolation.Raster map resampling and interpolation methods
GRASS offers various raster resampling and interpolation methods:-
-
Resampling with nearest neighbor, bilinear, and bicubic method (r.resamp.interp)
Inverse distance weighted average (IDW) interpolation (r.surf.idw2)
Regularized spline with tension (RST) interpolation 2D (r.resamp.rst)
Bilinear interpolation (r.bilinear)
Interpolating from contour lines (r.contour)
-
Hydrologic modeling toolbox
Watershed modeling related modules are r.basins.fill, r.water.outlet, r.watershed, and r.terraflow. Water flow related modules are r.carve, r.drain, r.fill.dir, r.fillnulls, r.flow, and r.topidx. Flooding can be simulated with r.lake. Hydrologic simulation model are available as r.sim.sediment, r.sim.water, and r.topmodel.Raster format
Raster data can be stored in GRASS as a 2D integer grid, 2D floating point grid (single or double precision), or as a 3D floating point grid (single or double precision). The internal raster format is architecture independent and portable between 32bit and 64bit machines. Internally, the integer format is called CELL, single precision floating point is called FCELL, double precision floating point is DCELL, and 3D raster is called GRID3D. The choice of the integer or floating point data depends on the application.GRASS distinguishes NULL and zero. When working with NULL data, it is important to know that operations on NULL cells lead to NULL cells.
See also
-
- Introduction to GRASS vector map processing
- Introduction to GRASS 3D raster map (voxel) processing
raster index - full index