If you find this document usefull, please consider ordering a printed hardcopy!
GRASS is very extensive especially with regards to raster analysis. In this section we will introduce some of the more frequently used raster GRASS modules. The modules and the applications discussed here represent only a few of those currently available.
In order to display a (line-) transect in a raster diagram the menu-driven module d.profile can be used (see Figure 16).
d.profile
Raster cell values or aggregated values in case of median and arithmetic average along one or more transects can be listed in ASCII format using the module r.profile. It is possible to give coordinate-pairs or interactively select start- and endpoint (option -i). The module r.transect provides a front end to the r.profile module. It only needs the startpoint of the transect and calculates the endpoint automatically based on the parameters azimuth and distance.
r.profile
r.transect
The r.los module performs a line-of-sight analysis based on an elevation map. A starting point, the height above the ground at this point as well as the distance from this point up to which the line-of-sight analysis is to be calculated can be indicated via a coordinate.
As an example, we will use the elevation map elevation.10m from the Spearfish data set. The initial coordinate is specified in this case but can also be determined by the module d.where:
# Put the setting on relief model but 20m resolution g.region rast=elevation.10m res=20 -pa # Calculation of visibility of a tower 15m over terrain # (computionally extensive at 10m original resolution...) r.los in=elevation.10m out=visibility coord=593670,4926877 \ obs=15 max=30000 # Control d.erase r.shaded.relief elevation.10m units=meters d.rast elevation.10m_shade d.rast -o roads d.rast -o visibility
As already mentioned it is possible to overlay raster maps visually. However, the module r.patch can be used to save the overlay as a new map. Thus, it is possible to combine several maps to a single map via patching:
r.patch in=map1,map2,map3,map4 out=total map
The first map indicated lies on top. All other maps are successively placed under each other and only appear in those places where the maps lying above have the value NULL (no data). As an example, the geological map and the roadmap from the Spearfish data set are to be overlayed. It is important to consider that GRASS modules basically work in the current region and resolution. Therefore the region with its resolution and area must be adjusted to the maps to be patched.
g.region rast=geology,roads -p [res=12.5] [-a] r.patch in=roads,geology out=roads.on.geol
If the order of the maps is changed, the entire roadmap is overlayed by the geological map. Such an output map would ultimately be identical to the map geology.
The module r.buffer allows the user to define a buffer based on the raster data. This function can be used for creating noise protection zones for the individual road categories of the map roads. Using the Spearfish data set, first list the available categories:
# Which road categories are available? g.region rast=roads -p r.report -h roads |1|interstate |2|primary highway, hard surface |3|secondary highway, hard surface |4|light-duty road, improved surface |5|unimproved road |*|no data
Problem: To define buffer zones with distances of 100, 250 and 500 meters around the "interstate" roads only. The initial map has a resolution of 30 m, which is maintained thoughout the exercise:
# Extracting the category 'interstate' with r.reclass r.reclass roads out=interstate << EOF 1 = 1 interstate EOF # or extracting the category 'interstate' with r.mapcalc r.mapcalc "interstate=if(roads==1,roads,zero())" # Creating buffer zones r.buffer in=interstate out=interstate.buf dist=100,250,500 # Control d.rast.leg interstate.buf
The resulting map shows the "interstates" with the three previously defined buffer zones. The specification of the buffer width is always referred to the middle of the feature to be buffered (in this case interstate roads) and is calculated in map units (e.g. meters) defined by the location. The units can be queried in GRASS via the module g.proj -p:
g.proj -p ... -PROJ_UNITS------------------------------------------------ unit : meter units : meters meters : 1.0
The conversion of a raster map into vector datamodel can be found in chapter 13.1.
If you find this document usefull, please consider ordering a printed hardcopy!