[GRASS-user] v.patch

Patrick S. patrick_GIS at gmx.ch
Wed Mar 14 14:19:39 EDT 2012


Dear list,

I am trying to merge several douzen vectorlayers in a loop. These are 
representing zones of neighboring municipalities, that have been 
imported from PostgreSQL and might overlap. Overlapping is not expected 
to be of relevant size, so it is more important to keep the number of 
objects as in the PostgreSQL-file.

As far as I understand, there are two possible ways to handle this GRASS:

1.)v.overlay with option=xor/or, this would result in an extended table 
with attributes a_** and b_**
2.)v.patch which would demand to create unique categories to avoid 
dissolving zones.

The first solution seems not ideal, as I don't want to enlarge the 
attribute table within each loop. The content of the layers will change 
in future, so I also can't hardcode to copy all the content of b_** to 
a_** with a sql-queries in each loop.
For the second solution I would have to query the cat-number within the 
loop "echo "SELECT MAX(cat) FROM GR_help1" | db.select". But I don't see 
how I could pipe this to the value of "v.category option=sum value= XX"

Is there some possibility to do s.th as:
v.category in=gr_help1 out=gr_help1_cat option=sum value="echo 'SELECT 
MAX(cat) FROM gr_help1' | db.select"

Or is there a simplier solution to this problem, which surely occurs often.

Thanks very much in advance, Patrick


More information about the grass-user mailing list