Geography Reference
In-Depth Information
(contours, lakes, rivers, and so forth) but also the metadata as we indi-
cated previously. When you plop them into GRASS, QGIS, or another
GIS application, they look just like you threw them down on the kitchen
table and tried to match them up. Fortunately, GRASS provides a fairly
easy way to make the maps play nicely with each other.
The steps to clip a raster are as follows:
1. Create a vector map to be used as the area of interest.
2. Convert the vector map to a raster map.
3. Use the new raster map as a mask for clipping.
4. Create the newly clipped raster using raster algebra.
5. Clean things up.
Let's work through the process and see whether we can't make our
rasters fit together nicely. First we have to import the rasters into
GRASS in a proper location. Generally you'll find your DRG is in UTM
coordinates. You'll need a GRASS location in the appropriate UTM zone
in order to import the raster. If you are fortunate enough to be working
with data all in the same zone, then you're all set. If your rasters span
UTM zones or you are working on a more regional scale, you may need
to project the rasters to a different coordinate system. You can easily
do this before you import into GRASS using
gdalwarp
. For examples of
For the sake of our example, I'm going to project the DRGs to the Alaska
Albers projection, since that's where I ultimately want to use them. This
will eventually allow me to create a seamless DRG layer for the whole
state. To warp the DRGs from UTM Zone 6 to Alaska Albers, I used the
following command:
gdalwarp -t_srs "+proj=aea +lat_1=55 +lat_2=65 +lat_0=50 +lon_0=-154 \
+x_0=0 +y_0=0 +ellps=clrk66 +datum=NAD27" i61149c6.tif i61149c6_albers.tif
Now you're thinking that doesn't look so simple, but the ugly-looking
part of the command comes from the need to specify the projection in
proj
format. Since the Alaska Albers coordinate system in meters doesn't
have an EPSG code, we have to spell it all out. If you're lucky, there will
be an EPSG code for your target projection, and you can just use the
EPSG:srid notation with
gdalwarp
to project the raster. For example,
had I wanted to use map units of feet, the EPSG projection 2964 is
perfect, and the
gdalwarp
command would have been this:
gdalwarp -t_srs EPSG:2964 i61149c6.tif i61149c6_albers.tif
Search WWH ::
Custom Search