The following commands perform operations in r.combine:
Command | | [Alias] | Followed by | Such as __________|______________________|________________________ NAME | name for raster | sandstone [name] | map output | __________|______________________|________________________ GROUP | category values | 1-40 (elevation.255) [group] | and a raster map | [grp] | | __________|______________________|________________________ AND | expression describ- | (grp 4 (soils)) [and] | ing a raster map | (grp 2 (owner)) [&][&&] | and categories | __________|______________________|________________________ OR | expression describ- | (grp 4 (soils)) [or] | ing a raster map | (grp 2 (owner)) [| ][| | ]| and categories | __________|______________________|________________________ NOT | expression describ- | (grp 2 3 (roads)) [not] | ing a raster map | [~] | and categories | __________|______________________|________________________ OVER | existing raster map | sandstone yellow [over] | and color | [overlay] | | __________|______________________|________________________ COVER | existing raster map | sandstone [cover] | | __________|______________________|________________________r.combine uses the same colors for all the operating commands. This is the r.combine color table:
0 black 4 blue 8 grey 12 blue/grey 1 red 5 purple 9 red/grey 13 purple/grey 2 yellow 6 green 10 yellow/grey 14 green/grey 3 orange 7 white 11 orange/grey 15 dark greyThe user may enter commands either line-by-line from within r.combine, or by typing the commands into a file which is then read into r.combine using the UNIX redirection symbol <. The command format is the same for the two methods. The line-by-line method, however, does not allow as much flexibility as does use of an input file. If a line containing a syntax error is entered on the r.combine command line, it is cleared; the line must then be re-entered in its entirety. Input files containing mistakes, however, can easily be modified (rather than recreated). An input file is especially advantageous when a more complex series of statements is input to r.combine.
r.combine uses two types of commands: those which perform operations, and those which have some other function.
r.combine can probably best be learned by following examples, so pay special attention to those included below with the operating command descriptions. Notice two things in particular:
example:
(NAME sandstone (GROUP 4 (geology)))
The above command will result in the creation of a new raster map layer
named sandstone, noting the
locations of cells with geology category value 4.
You must then run the GRASS program
r.support in order
to label the categories present in the new raster map layer.
Resultant categories:
0 - black: other than sandstone 1 - red: sandstone
2 1-18 1 2 5-7.
example:
(GROUP 1-40 (elevation.255))
Depicts only the area with elevation 1187 meters or less
(i.e., elevation map layer category values 1 through 40 only).
Resultant categories:
0 - black: elevation > 1187 m 1 - red : elevation <= 1187 m
example:
(NAME low.hi (GROUP 1-40 238-255 (elevation.255)))
Depicts only those areas with elevations of either 1187
meters or less, or in excess of 1787 meters
(elevation categories 1-40, and 238-255). The
graphic output is saved in the new raster map layer called
low.hi.
Resultant categories:
0 - black : elevation > 1187 m and < 1787 m 1 - red : elevation <= 1187 m and >= 1787 m
For example,
raster map 1 2 2 0 2 1 0 0 0 0 1 0 0 results AND--> 1 1 0 raster map 2 1 0 1 0 0 0 1 1 0 1 1 0
example:
(AND (GROUP 4 7-9 (geology)) (GROUP 2 (owner)))
Depicts the occurrences of categories
4, 7, 8, and 9 from the map layer
geology whenever they occur on U.S.
Forest Service property. Results are displayed to the terminal screen.
Resultant categories:
0 - black : no data occurred any of the raster map layers 1 - red : the AND condition is met
Note that if neither map layer contained any areas of "no data", the resultant raster map layer would include only 1's.
Example:
(NAME sand (AND (GROUP 4 7-9 (geology)) (GROUP 2 (owner))))
Same as above, except the results are saved in the map layer
sand.
raster map 1 2 2 0 2 1 0 0 0 0 1 1 1 results OR --> 1 1 0 raster map 2 1 0 1 1 1 0 1 1 0 1 1 0
Example:
(OR (GROUP 4 7-9 (geology)) (GROUP 2 (owner)))
Depicts all occurrences of categories 4, 7, 8, and 9
from the map layer geology as well as showing
all the land which is U.S. Forest Service property. Results are
displayed to the terminal screen.
Resultant categories:
0 - black: this area has neither the values of 4, 7, 8, or 9 nor is it on U.S. Forest Service property 1 - red : this area meets one or the other of the conditions noted above
Note that no distinction is made between those places where conditions are met in both map layers and where they are met in only one. See the r.combine command OVER if it is necessary to make that distinction.
Example:
(NAME rds (NOT (GROUP 0 (roads))))
Areas containing category zero in the existing map layer
roads indicate those locations
within the data base where roads do not exist.
Negating that expression leaves us with all other areas - i.e., those
locations at which roads do exist. Here, the graphic output is saved in the
raster map layer named rds.
Resultant categories:
0 - black: no roads 1 - red : roads
The same results could have been obtained with: (NAME rds (GROUP 1-5 (roads))). NOT is most useful in those cases where it is simpler to define something on the basis of what it is not than on the basis of what it is.
OVER may be run with or without an existing map layer name. If the user does not specify an existing raster map layer name, OVER applies the color specified to the expression in parentheses and displays the results. If an existing raster map layer name is specified, OVER applies the color to the expression (just as before) and then overlays the results on top of the existing raster map layer. In order to make sense of the colors which result, use only those existing map layers created using OVER.
OVER allows the user to specify just four colors:
color value red 1 yellow 2 blue 4 grey 8These four colors are then combined to form other colors. The number of progressive overlays allowed is limited to four (one for each of the basic colors above). The actual number of colors on the resultant raster map layer, however, varies depending on the distribution of the features and on the interaction of the features from the different map layers which are overlain. When two or more of these colors are overlain, new colors are created. The numerical values associated with the colors above are significant, in that the values of any additional colors created reflect the sum of two or more of the four above. These overlain color values appear on the resultant overlay as cell (category) values. The user should know what these values represent in order to know what category information is to be associated with the new map layer (entered using the GRASS r.support command), and to know the significance of this and subsequent analyses involving the new map layer.
Any of these colors and category values may result from OVER. Note that this is the same as the r.combine color table listed above.
0 black 4 blue 8 grey 12 blue/grey 1 red 5 purple 9 red/grey 13 purple/grey 2 yellow 6 green 10 yellow/grey 14 green/grey 3 orange 7 white 11 orange/grey 15 dark greyThe syntax for OVER makes no provision for a new raster map layer name. It is necessary to use the r.combine operator NAME to specify a new raster map layer name in which to save the graphic output generated by OVER. If the user runs OVER without specifying an output raster map layer name, output is displayed to the terminal. However, this output is available for future use only if it is saved using the NAME command.
example:
(NAME park.or.priv (OVER red (GROUP 1 (owner))))
The new raster map layer park.or.priv displays
private land (i.e., category 1 of the raster map layer
owner) in red, and displays U.S. Forest Service
land (i.e., "no data" areas within the owner map
layer) as black.
Resultant categories:
0 - black: park 1 - red : private land
example:
(NAME roads.or.not (OVER park.or.priv yellow (GROUP 0 (roads))))
Category 0 in the map layer
roads is overlain in yellow on top of the park.or.priv
map layer created above. The output is placed in a new map layer
named roads.or.not.
Resultant categories in roads.or.not are:
0 - black : park; road 1 - red : private; road 2 - yellow : park; no road 3 - orange : private; no road
example:
(NAME low.elev (OVER park.or.priv blue
(GROUP 1-19 (elevation.255))))
The elevation categories of 1123 meters or less from the
map layer
elevation.255 are assigned the color blue and
then overlain on park.or.priv (generated in the previous example).
Resultant categories in the new map layer low.elev are:
0 - black : park; > 1123 m 1 - red : private; > 1123m 4 - blue : park; <= 1123 m 5 - purple : private; <= 1123mNote how category 5 is the sum of red (1) + blue (4) (i.e., the intersection of areas containing low elevations and private lands with roads).
The user does not specify colors with COVER. COVER uses the default color table that is listed above with OVER. Colors are assigned starting with the lower map layer. The category values are assigned the color from the table that corresponds with that value. For example, 1 would be red; 2, yellow; 3, orange, etc. Moving to the upper map layer COVER starts wherever it left off after the lower one. If the highest value of the lower map layer was 5, then all non-zero (i.e., places where a feature exists) cells of the upper map layer would be assigned the value of 6 (green). Note that if, in this case, the upper map layer did not have any cells of value zero, then the entire resulting new map layer would be green. The upper map layer would have been assigned the value 6 and would have completely covered that which was below it.
This is what happens:
Expression 1 1 1 0 (top raster map) 1 1 0 0 0 0 0 0 6 6 6 0 result --> 6 6 2 0 oldmap 2 5 0 0 5 5 2 2 (bottom raster map) 0 5 2 0 5 5 2 2As many map layers may be overlain as is desired. However, there is a practical limit on the number of map layers that can be used while still generating sensible output. That number depends on the features involved in each map layer, and how many cells within the upper (overlying) map layers contain category values of zero (holes through which underlying data can be seen).
COVER has no provision for saving graphic output. Use the r.combine command NAME to save output in a raster map layer.
Example:
(NAME lo.elev (COVER owner (GROUP 1-19 (elevation.255))))
The categories that indicate elevation of 1123 meters or
less are placed on top of the existing map layer
owner. Output is saved in lo.elev.
Resultant categories:
1 - red : private ownership; elev > 1123 m 2 - yellow : park property; elev > 1123 m 3 - orange : park or private; elev <= 1123 m
Example:
(NAME sand.lo (COVER lo.elev (GROUP 4 (geology))))
Category 4 of geology (sandstone) is placed on top
of lo.elev, the raster map layer created in the previous example.
The output is saved in sand.lo.
Resultant categories:
1 - red : private ownership; elev > 1123 m; no sandstone 2 - yellow : park property; elev > 1123 m ; no sandstone 3 - orange : park or private; elev <= 1123 m; no sandstone 4 - blue : park or private; any elev; sandstone
Command| Alias | Followed By _______|____________________|______________________________ QUIT | quit q exit bye| CATS | categories cats | existing raster map EXP | exp expr | number of an expression ! | | shell command e.g. vi comb.1 < | | existing input file WINDOW | window | existing raster map layer HISTORY| history hist | HELP | help | combine command ERASE | erase |
For example:
[4]:(GROUP 5 (geology))
[5]:(NAME limestone (EXP 4))
Use the UNIX history mechanism (explained below) to determine the
specific numbers associated with particular expressions in your current
r.combine session.
!vi input !g.list type=rast
Unless otherwise specified by the user, when a file is created using a system editor (like vi) from within r.combine, this file will be placed in the user's mapset under the COMBINE directory. After the command is completed, control returns to r.combine.
First, the user would create the file: !vi comb.in
Second, the user would direct r.combine to take its input
from the
file: < comb.in
example:
(NAME good.place (AND (OR (GROUP 1 2 5 (geology)) (GROUP 1-5 (elevation.255)) ) (NOT (GROUP 1-4 (landuse)) ) ) )Such involved input to r.combine might conveniently be typed into an input file, and then input to r.combine using the UNIX redirection mechanism <.
Last changed: $Date: 2002/01/25 05:45:34 $