|

To learn about basic vector commands you will need to load a number of
vector maps containing the features of Rockingham County.
To import the ArcView shape data file of streams in Rockingham County
into a GRASS vector file:
- Type v.in.shape
input=lnh51165.shp
- input=name:
the name of the ArcView shape file with vector data
To load the vector map of the streams into the
monitor:
- Type d.vect
map=lnh51165
- map=name:
the name of the vector map to open
The stream map should now be visible in the monitor and will look similar
to Figure 4.1 below.
 |
|
Figure 4.1: Stream vector map
in a monitor
|
Displaying the scale
The scale for a vector map can be plotted over the map. To draw the scale:
- Type d.scale
bcolor=black
tcolor=white at=0,0
- bcolor=name:
background color underlying the scale and north arrow
- options: white,
red,
orange,
yellow,
green,
blue,
indigo,
violet,
magenta,
brown,
gray, and black
- tcolor=name:
foreground color in which the text, scale, and north arrow are drawn
- options: white,
red,
orange,
yellow,
green,
blue,
indigo,
violet,
magenta,
brown,
gray, and black
- at=x,y
: geographic coordinates designating the location at which the upper
left corner of the scale is to be placed
The vector map will now have a black and white scale on it in the monitor
and will look similar to Figure 4.2 below.
|
|
|
Figure 4.2: Stream vector map
with scale
|
Finding the coordinates of a point
The coordinates of a particular point in a vector map can be printed
to the command line interface. To print the location of a point:
- Type d.where
-1
- -1:
print the location of only the first point clicked on the map
The command line interface will prompt you to use the mouse to click
on the location of the point you want to locate. This prompt will look
similar to Figure 4.3 below.
 |
|
Figure 4.3: Where point prompt
|
- Place the mouse pointer over the location on the map you want to identify
and click the left mouse button.
The location of the point will be printed to the command line interface.
This location will look similar to Figure 4.4 below (your screen may look
different depending on what location you clicked on).
 |
|
Figure 4.4: Where point information
printed to the command line interface
|
Removing edge vectors
The edge vectors of a map can be removed (this is necessary in order
to merge the maps). Import the ArcView shape data files of the streets
(str51165.shp)
and the railroads (lnb51165.shp)
using v.in.shape.
To view the streets or railroads map, use d.erase
to remove the old map and d.vect
to open str51165
or lnb51165.
To remove the edge vectors from the streams, streets and railroads vector
maps:
- Type v.rmedge
input=lnh51165 output=streams
- Type v.rmedge
input=str51165 output=streets
- Type v.rmedge
input=lnb51165 output=railroads
- input=name:
the name of the original vector map
- output=name:
the name of the new vector map with the edges removed
Merging vector maps
Separate vector maps can be merged into a new map. To merge the three
vector maps of the streams, streets and railroads in Rockingham County,
into one vector map:
- Type v.merge
map=streams,streets,railroads output=merged
- map=name:
the names of the vector maps to merge
- output=name:
the name of the new merged vector map
To view the merged map use d.erase
to remove the old map and d.vect
to open merged.
The linear feature map should now be visible in the monitor and will look
similar to Figure 4.5 below.
 |
|
Figure 4.5: Linear features
vector map
|
Trimming excess lines
A new vector map can be created that trims small lines and spurs from
an original vector map. Use v.in.shape
to import lnc51165.shp
(a vector map of utility lines in Rockingham). To trim lines or nodes
of length 1 or less from the vector map of utility lines:
- Type v.trim
input=lnc51165
output=utility_trim factor=1
- input=name:
the name of the original vector map
- output=name:
the name of the new vector map with the trimmed lines
- factor=value:
the trimming factor, denoting the length of trimmed lines in map
units
To view the trimmed map use
d.erase to remove the old map and d.vect
to open utility_trim.
The utility line map should now be visible in the monitor and will look
similar to Figure 4.6 below. You can open the original map, lnc51165,
to compare the two.
 |
|
Figure 4.6: Trimmed utility
lines vector map
|
Pruning excess points
A new vector map can be created that removes redundant
points from an original vector map. To prune excess points every one unit
from a vector map of the streets of Rockingham:
- Type v.prune
input=streets
output=streets_prune thresh=1
- input=name:
the name of the original vector map
- output=name:
the name of the new vector map with the pruned points
- thresh=value:
the threshold value, in data base units
To view the pruned map use d.erase
to remove the old map and d.vect
to open streets_prune.
The pruned streets map should now be visible in the monitor and will look
similar to Figure 4.7 below. You can open the original map, streets,
to compare the two.
 |
|
Figure 4.7: Pruned streets
vector map
|
Calculating areas and perimeters
The area and perimeter of an enclosed space in a vector map can be calculated.
Use d.erase
to remove the old map and v.in.shape
to import pla51165.shp
(a vector map of places in Rockingham). To calculate the area and perimeter
of an enclosed space of the vector map and fill in the space with red:
- Type v.area
-f map=pla51165 color=red
- -f:
the selected area to be filled with the selected color, otherwise
only the perimeter of the area will be drawn in the specified color
- map=name:
the name of the vector map
- color=name:
color for the perimeter or fill
- options: white,
red,
orange,
yellow,
green,
blue,
indigo,
violet,
magenta,
brown,
gray, and black
The command line interface will prompt you to use the mouse to click
inside the enclosed space you would like to calculate the area and perimeter
for. This prompt will look similar to Figure 4.8 below.
 |
|
Figure 4.8: Where point prompt
|
- Place the mouse pointer inside an enclosed space on the map you want
to calculate the area and perimeter for and click the left or right
mouse button.
The monitor will look similar to Figure 4.9.1 and command line interface
will look similar to Figure 4.9.2 (your screens may look different depending
on which space you chose).
 |
|
Figure 4.9.1: Highlighted area
(in red) on the vector map for which the area and perimeter were
calculated
|
 |
|
Figure 4.9.2: Calculated area
and perimeter printed to the command line interface
|
Displaying information about a map
An information report about a vector map can be
compiled and printed to the command line interface. To view information
for the vector map of the utility lines:
- Type: v.stats
-h map=lnc51165
- -h:
displays header information
- map=name:
the name of the vector map to print information for
A statistics report will be printed to the command line interface and
will look similar to Figure 4.10 below.
 |
|
Figure 4.10:Information report
about utility lines vector map
|
Generating statistics report
Three types of statistics reports (area, line and site) can be calculated
for vector maps. Use v.in.shape
to import lan51165.shp
(a vector map of landmark areas in Rockingham County). Create a statistics
report that provides information about this map, including a count of
the number of areas, and the area measure in square meters.
- Type v.report
map=lan51165 type=area units=c,me
- map=name
: the name of the vector map
- type=name:
type of report to produce
- options: area,
line,
site
- units=name(s):
the unit(s) to report in
- options: mi(les),
f(eet),
me(ters),
k(ilometers),
a(cres),
h(ectacres),
c(ounts)
A statistics report will be printed to the command line interface and
will look similar to Figure 4.11 below.
 |
|
Figure 4.11: Statistics report
for the landmark areas vector map
|
Use v.in.shape
to import lnd51165.shp
(a vector map of landmark lines in Rockingham County). Create a statistics
report that provides information about this map, including a count of
the number of lines, and the length of each line in meters and feet.
- Type v.report
map=lnd51165 type=line units=c,me,f
- map=name
: the name of the vector map
- type=name:
type of report to produce
- options: area,
line,
site
- units=name(s):
the unit(s) to report in
- options: mi(les),
f(eet),
me(ters),
k(ilometers),
c(ounts)
A statistics report will be printed to the command line interface and
will look similar to Figure 4.12 below.
 |
|
Figure 4.12: Statistics report
for the landmark lines vector map
|
Use v.in.shape
to import ltp51165.shp
(a vector map of landmark sites in Rockingham County). Create a statistics
report that provides information about this map, including a count of
the number of sites.
- Type v.report
map=ltp51165 type=site units=c
- map=name
: the name of the vector map
- type=name:
type of report to produce
- options: area,
line,
site
- units=name:
the unit(s) to report in
A statistics report will be printed to the command line interface and
will look similar to Figure 4.13 below.
 |
|
Figure 4.13: Statistics report
for the landmark sites vector map
|
Converting vector map to a raster or sites map
A vector map can be converted into a raster or sites map. To convert
the vector map of landmark sites to raster and sites maps:
- Type v.to.rast
input=ltp51165 output=landmarks_raster
- Type v.to.sites
input=ltp51165 output=landmarks_sites
- input=name:
the name of the original vector map
- output=name:
the name of the new raster or sites map
IMPORTANT: The created raster maps can be
viewed using the raster display command. The created sites map can be
viewed using the sites display command which is explained later in the
tutorial.
Changing the Mapset
Before continuing you will need to change the mapset to the next area
(City of Harrisonburg):
- Type g.mapsets
mapset=harrisonburg
- mapset=name:
name of existing GRASS mapset under the current location
Click the Next
button to learn basic sites manipulations.
|