[GRASS-user] Questions: Clipping polygon layer to the outer boundary of another layer...

Tom Russo russo at bogodyn.org
Tue Feb 12 13:38:28 EST 2008


On Tue, Feb 12, 2008 at 10:21:50AM -0800, we recorded a bogon-computron collision of the <reeves at nceas.ucsb.edu> flavor, containing:
> 
> Hello:
> 
> I'm using v.in.ogr to clip a polygon set (in this case, county boundaries) 
> to
> the boundary of a (rectangular) raster image.
> 
> As far as I know, this is the only way to do this; I tried to create a new 
> location
> with the same boundaries and import the polygon shapefile into the 
> location, but
> clipping did not occur as expected.
> 
> In any case, v.in.ogr did not clip the 'boundary polygons' to the the edge 
> of the
> raster image, but included the entire polygon. Only excluded polygons 
> completely
> outside of the bounding box are clipped.
> 
> There MUST be a way to clip all polygons to the bounding box edge. Can any
> one suggest a way?
> 
> The second edition of Netler's book discusses v.cutregion.sh and v.cutter 
> methods,
> but I cant find any evidence of these in GRASS 6.2. 
> Thanks for any help,

Couldn't you do it with v.overlay?

Generate a polygon for the outline of your raster, then use the "and" operator
in v.overlay to select only those polygons that are inside the raster outline.
Doing so will cut the polygons that go outside the border.

See, for example,
  http://grass.itc.it/grass57/tutorial/vectoroverlay.html
but note that the figures for "or" and "and" operations on that page are
accidentally interchanged.

-- 
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://kevan.org/brain.cgi?DDTNM
"And, isn't sanity really just a one-trick pony anyway? I mean all you get is
 one trick, rational thinking, but when you're good and crazy, oooh, oooh,
 oooh, the sky is the limit!"  --- The Tick


More information about the grass-user mailing list