Grass Tutorial | ||
---|---|---|
<<< Previous | Next >>> |
The "region" is a cornerstone concept in GRASS. If you want to be able to use GRASS to its full potential, you have to understand it. In fact, it is so important that you should know about it even if you only plan some light usage of GRASS. This chapter is an attempt at explaining as clearly as possible what the region is and what its effects are. It will also, hopefully, help you understand the usefulness of the region in GRASS.
The region defines the geographic area in which GRASS should work. It is characterized by several parameters:
geographical projection (e.g. UTM, latitude-longitude, Gauss-Krueger, etc)
geographical extension, i.e. the North/South/East/West limits of the area covered
number of columns and number of rows for the data
resolution, i.e. the extension divided by the number of rows (N-S resolution), respectively columns (E-W resolution).
The default values of these parameters for a given location are stored in the DEFAULT_WIND file in the PERMANENT mapset of that location. The current region settings are stored in the WIND in the current mapset. The stored values will stay valid, even if you exit GRASS and restart it.
As said above, the region defines the extension and resolution of the data on which most GRASS commands should work. But what does that mean ?
For instance, if the region is set to a smaller extension than that of the map you are working on, a display command for that map (such as d.rast) will only show the portion of the map that is contained in that region. Many other commands will also only work on that region, as for example many of the export commands, or many of the raster development modules. This allows working on only a portion of the map, thus not using up your computer's ressources for the rest of the map. Or you can export only the portion of a map that really interests you.
In a similar way, you can reduce the resolution of the region in order to use less machine resources. For example, you might want to convert a vector map to raster, but do not need the raster in very high resolution, as, for example, if you want to create a thematic map of the world, where the exact contours of the countries are not very important. You can, therefore, change the region settings to a lower resolution before launching the conversion, so that it takes less time and memory.
In general, you always have to be careful to assure that the region is set correctly before doing any work on your map. A typical problem of newcomers to GRASS is that they import a map and then try to display it, but only see an empty GRASS monitor. This is almost always due to wrong region settings which make the map fall outside the area currently covered by the region.
Ideally, the default region of a location should encompass the entire area covered by all the maps in that location. So if you reset your region to the default, subsequent commands should always cover your entire location. If however, you import a map that is larger than the default region, you can still set the current region to that new map's settings by using (see below for an explanation of these commands) g.region rast=name or g.region vect=name. However, whenever you use g.region -d you will reset your current region to the default which does not contain the new, larger map.
The main tool for working with the region is the g.region command. Read the man page thoroughly to get aquainted with all its possibilities. Here are some of the most common usages:
Print current region settings.
Reset current region to default for location.
Set the current region to the coordinates of the raster file
Set the current region to the coordinates of the vector file
Save the current region settings into the file filename
Set the current region to the coordinates saved in filename (created with g.region save=filename).
Set the northen, southern, eastern, western edges and the resolution to the respective values.
Will bring up a menu allowing you to access all of the options interactively.
You can also set the region values (except for the resolution) interactively with the mouse on the current monitor using d.zoom.
All these functions can also be accessed in Tcltkgrass via Region->Manage region.
Sometimes you would like to import a map that is larger than (or even completely outside of) the default region of the existing location. You can do that without any problem, but in order to visualize it, you will have to use g.region rast or g.region vect in order to adapt the current region to the map. However, anytime you use g.region -d the region will be reset to the old setting and your map will not be visible.
Here's a (somewhat quick and dirty) solution to this problem (hopefully g.region will be modified to include this as an option, one day): open a monitor (see the chapter called Managing GRASS Monitors), display all you maps (see the chapter called Displaying Maps), zoom and pan until you can see all you maps in the screen (if you know that the extension of one map englobes all the others, you can also use g.region rast or g.region vect, followed by d.erase before displaying all your maps). Once you are sure that the currently active region contains all your maps, you can make it into the default region as follows:
Begin by making a backup copy of your default region: cp $GISDBASE/$LOCATION_NAME/PERMANENT/DEFAULT_WIND ~/default_region.bak. If anything goes wrong you can reset to your old default region with cp ~/default_region.bak $GISDBASE/$LOCATION_NAME/PERMANENT/DEFAULT_WIND.
Make the current region into the default region with cp $GISDBASE/$LOCATION_NAME/$MAPSET/WIND $GISDBASE/$LOCATION_NAME/PERMANENT/DEFAULT_WIND.
Now, whenever you use g.region -d, the region will be set to your new default region
<<< Previous | Home | Next >>> |
Graphical User Interface | Up | Start a Project |