[GRASS-user] Clipping Raster Map

Glynn Clements glynn at gclements.plus.com
Fri Jan 1 16:07:43 EST 2010

Rich Shepard wrote:

>    While the raster DEM displays quickly in the GUI it is unacceptably slow
> trying to display in the CLI monitor. Does the large number of colors explain
> the time difference?

I doubt it. The most likely reason for a difference is if the current
region has a much higher resolution than the display.

Modules which read raster maps normally resample them to the current
region. The display library then resamples the data to the display

IIRC, the GUI sets the current region resolution to match the display
resolution. This will reduce the size of the intermediate data,
eliminating redundant colour lookups.

> GRASS 6.4.0svn (Oregon):/usr4/grassbase/Oregon > d.mon x0
> using default visual which is TrueColor
> ncolors: 16777216
> Graphics driver [x0] started
>    I want to extract only those sells within the project bounds. I don't see
> an r.overlay or r.select equivalent to the vector commands.
>    Running 'g.region -c map=dem vector=abernethy' did nothing.

"map=" isn't a valid option for g.region. Maybe you mean r.region?

r.region exists for one specific purpose: if you have imported a map
and its bounds are incorrect (which is often the case if the file
doesn't have associated georeferencing information), r.region can be
used to set the correct bounds.

If you need to use r.region at all, you need to use it as part of the
importing process. You should never need to use it after that.

> I don't know
> if there's a conflict between the '-c' option (use current region) and the
> definition of the vector boundary map. When I removed the '-c' option and
> ran the command the result appears to be the entire original map squeezed
> into the smaller region's bounds. Not what's needed.

You probably shouldn't be using r.region here. You need to either run
it again to set the map's bounds to the correct values, or (safer)
re-import the map.

>    Do I need to build a raster version of the vector project area, and use
> that to mask everything external to zero? I cannot display the DEM using a
> script because it would take a _very_ long time for that one map to display.

No. If you want to use a sub-region of a raster map, change the
current region with g.region, either using n=/s=/w=/e= to set specific
coordinates, or rast=/vect= to use the bounds of some other map, or
region= to use a saved region. Using rast= will change both the bounds
and resolution; you can change the resolution separately with res=.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list