Geography Reference
In-Depth Information
We're now ready to import the DRG into our Alaska Albers GRASS loca-
tion that we already have set up. To do this, we'll use r.in.gdal from the
GRASS shell. In fact, this whole process will be done using shell com-
mands rather than the GUI interface. Once we're done, we can check
the results by using gis.m in GRASS or by loading the rasters into QGIS.
To import the raster, do use:
r.in.gdal input=i61149c6_albers.tif output=ancb8_collars
Now we have the raster complete with collars in GRASS. The next thing
we need is a vector area map that outlines just the “good” portion of the
DRG in which we are interested. In most cases, you can find a vector
quadrangle boundary layer somewhere on the Internet that is perfectly
suited for this task. If not, you'll have to warm up your GRASS digitiz-
ing skills and create a new vector map by digitizing the four corners of
the DRG. If you do find a vector layer of the quadrangles for your area,
you have a bit of work to do as well, since we want only one of the quad-
rangle polygons. In the case of Alaska, the quadrangle vector map has
3,011 polygons, representing both the 1:250,000 and 1:63,360 scale
quadrangles. To clip the DRG, we need to create a new vector map
by extracting the quadrangle of interest. We do this using the v.extract
command:
v.extract input=itma output=ancb8 where="TILE_NAME='ANCB8'"
The input map is itma , and it contains the quadrangle boundaries.
We want to create a new map named ancb8 with the boundary of the
Anchorage B8 quadrangle. Notice the key part of the v.extract command:
the where clause. This tells GRASS to extract only features where the
attribute TILE_NAME is equal to “ANCB8,” giving us a single polygon,
which is what we want.
To use the boundary of the quadrangle as a mask, our new vector map
has to be converted to a raster using v.to.rast :
v.to.rast input=ancb8 output=ancb8_itma use=val
This creates a raster map named ancb8_itma that covers the area of the
polygon in ancb8 . The use=val parameter tells GRASS to set the cells to
the value specified by the value parameter. Of course, you noticed that
we didn't specify a value parameter. That's because it defaults to 1 if
not specified, and this is exactly what we want. If we were to load up
the ancb8_itma raster in GRASS or QGIS and look at the cell values,
we'd find that they are indeed all set to 1. This is important—when we
use this map as a mask, only those cells lying in our area of interest
 
Search WWH ::




Custom Search