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

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,
Rick Reeves

On Tue, Feb 12, 2008 at 10:21:50AM -0800, we recorded a bogon-computron collision of the <reeves@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

On Tue, 2008-02-12 at 10:21 -0800, Rick Reeves wrote:

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.

Sorry for suggesting the obvious things (which you might have checked):

* if you want to clip based on a rectangular, did you try the "spatial"
parameter (or subregion in the GUI)? -- grab the extents of your
rectangular raster with r.info

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.

v.cutter is in grass5 -->
http://grass.itc.it/gdp/html_grass5/vector.html

Probably not ported in grass6 -- but it's not really necessary.

Thanks for any help,
Rick Reeves
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
Nikos Alexandris
.
Department of Remote Sensing & Landscape Information Systems
Faculty of Forestry & Environmental Sciences, Albert-Ludwigs-University Freiburg
.
Tel. +49 (0) 761 203 3697 / Fax. +49 (0) 761 203 3701 / Skype: Nikos.Alexandris
.
Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany

Rick Reeves wrote:

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.

I assume you used 'v.in.ogr spatial='. This works like v.select.

There MUST be a way to clip all polygons to the bounding box edge.
Can any one suggest a way?

v.in.region + v.overlay.

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.

See the GRASS 5<->6 module porting list on the wiki:
  http://grass.gdf-hannover.de/wiki/GRASS_Module_Porting_List

and the GRASS 6.3 module synopsis:
  http://grass.ibiblio.org/gdp/grassmanuals/grass63_module_list.pdf

Hamish

      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

On 13/02/08 12:48, Hamish wrote:

Rick Reeves wrote:

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.

I assume you used 'v.in.ogr spatial='. This works like v.select.

There MUST be a way to clip all polygons to the bounding box edge.
Can any one suggest a way?

v.in.region + v.overlay.

Or v.in.region + v.select if you don't wan't to merge attribute tables.

Moritz

Rick Reeves wrote:

>> 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.

Hamish:

> I assume you used 'v.in.ogr spatial='. This works like v.select.

R:

>> There MUST be a way to clip all polygons to the bounding box edge.
>> Can any one suggest a way?

H:

> v.in.region + v.overlay.

Moritz Lennert wrote:

Or v.in.region + v.select if you don't wan't to merge attribute
tables.

v.select will act the same way as 'v.in.ogr spatial=' (or a personal
favourite: 'v.in.ogr -r') which was what the original question was
hoping to avoid. ie v.select leaves features in or out, while v.overlay
both allows or omits features AND modifies any features which cross.

Hamish

      ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping

Thanks Hamish - This Worked Great.

Hey, while I am writing, can you recommend any GRASS methods for cleaning line feature
topology, besides v.clean? I am trying to repair a lot of missed connections in the USGS
NHP2 stream network data so that I can accurately compute stream distances with v.net.path.

At this point I may be forced to resort to Arc GIS Network Analyst to diagnose the problems,
but would MUCH rather use the GRASS tools.

A final question: Is anyone aware of a version of the NHP stream dataset that HAS been
cleaned and repaired to support distance calculations? This would not be a trivial task,
even for portions of the dataset.

Thanks,
Rick R
Hamish wrote:

Rick Reeves wrote:
  

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.
        
Hamish:
  
I assume you used 'v.in.ogr spatial='. This works like v.select.
      

R:
  

There MUST be a way to clip all polygons to the bounding box edge.
Can any one suggest a way?
        

H:
  

v.in.region + v.overlay.
      
Moritz Lennert wrote:
  
Or v.in.region + v.select if you don't wan't to merge attribute
tables.
    
v.select will act the same way as 'v.in.ogr spatial=' (or a personal
favourite: 'v.in.ogr -r') which was what the original question was
hoping to avoid. ie v.select leaves features in or out, while v.overlay
both allows or omits features AND modifies any features which cross.

Hamish

      ____________________________________________________________________________________
Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On 22/02/08 17:53, Rick Reeves wrote:

Thanks Hamish - This Worked Great.

Hey, while I am writing, can you recommend any GRASS methods for cleaning line feature
topology, besides v.clean? I am trying to repair a lot of missed connections in the USGS
NHP2 stream network data so that I can accurately compute stream distances with v.net.path.

v.edit ? v.digit ?

At this point I may be forced to resort to Arc GIS Network Analyst to diagnose the problems,
but would MUCH rather use the GRASS tools.

Have you looked at the v.net.* tools ?

Moritz