Basic Commands in Grass 5





In this part, we will explain how to use GRASS 5 as a beginner. Here are the few commands that you must know for a first contact with GRASS 5. On the next page, we will see a standard application of this software, showing more complicated commands. There are more than 150 commands in GRASS 5, therefore the user has to learn by himself, after these first steps, how to use this software for his own particular work. We will show how to use the graphic interface, but we will give at the same time the Shell commands (in red).
 

How can I launch the execution of GRASS 5 ?
 

This is described at the end of the page before.
If you have followed the instructions carefully, this menu-bar will appear :
 
 






How can I use the GRASS 5 manual ?
 

In GRASS 5, every action is associated to a Shell command.
Each time you launch an action in GRASS 5, a window appears; the command associated to this action is written at the top of this window.
If you want details about an action, choose on the menu bar . There, write the command that interests you, and click 'Run'.
help>manual pages
The equivalent command is :
 g.manual entries=d.colormode
Then, a full description of the use of the command appears.
 
 

I want to display a raster file.

Most of the maps are raster files in GRASS 5 datasets.
Before displaying a map, you must start and select a monitor : on the menu bar, choose
Display>Monitors>Start
and then, choose one of the monitors that are proposed (x0 for example).
Now, you must select this monitor :
Display>Monitors>Select> x0 (for example)
  d.mon start=x0 select=x0

A monitor appeared. It is a window like this :
 
 

Now you have this monitor, you can display a raster map. Choose on the menu bar
Raster>Display>Display raster maps.  (d.rast map=elevation.dem)
In the window that appears, click on 'raster' and choose one of the map that are proposed (elevation.dem as an example). Then, click 'Run'.

The map appears on monitor x0.
If you want to plot another raster map on another monitor, it is the same process with starting another monitor.
If you want to erase the drawings your monitor contains, choose on the menu bar
Display>ERASE display frame (d.erase)

Then, you can start over plotting maps on this monitor.
 
 

I want to display a Vector file over the Raster one.
 

For example, it is interesting to plot a vector file representing the streams over a full Raster map.
As for raster files, choose on the menu bar
Vector>Display>Display vector maps(d.vect map=streams )
In the window that appears, choose the vector map (streams for example) you want to display and click 'Run'.
The vector map appears over the raster one.
You can also plot Sites maps or others Raster maps (choosing the 'overlay' option -o not to mask the others maps).
 
 
 

I want to measure lengths and areas on a map.
 

When you study a map, one of the first thing which is interesting is to measure lengths and areas.
GRASS 5 has a very powerful command : once you have displayed a raster map, on the menu bar choose :
Raster>Analyse map>Measure lengths and areas
This window appears:

The equivalent command is (as you can see at the bottom of the window):

           d.measure -s c1=[color1] c2=[color2]

You have to choose the two colors that will constitute your measure lines.
When you click 'Run', a very helpful dialog box appears. By marking points with your mouse on the map, you can evaluate lengths, and also areas.
Here is an example of a dialog box :
 
 






On this dialog box is writen the use of each button of the mouse, the distances between the vertices you mark, the value of the areas constituted by these vertices...
 
 

I want to have a 3D-view of the Raster map I have plotted.
 

GRASS 5 includes a very powerful 3D-view software called NViz.
To run NViz, you just have to chosse on the menu bar
Display>NVIZ Visualization tool.
           nviz el=[elevation raster map to plot] ve=[vector map to plot] si=[sites map to plot]

A command window appears then just near the new 3D-map.
The use of NViz is very intuitive.
Let's look at an example of view we can get with NViz. On this map built from a SPOT satellite image from a region in Nevada.
The black lines are roads and the blue ones are rivers.
The density of roads at the bottom of the picture shows the existence of a city at this place.