[GRASS-user] Adjacent polygons rejected by v.patch

Markus Metz markus.metz.giswork at gmail.com
Wed Nov 19 02:35:13 PST 2014


Humberto Cereser Ibanez wrote:
> Hi,
>
> I'm trying to join polygons, but unfortunately some, at the boundaries
> are been rejected by v.patch. The Screenshot attached is showing this.
>
> 1) Import shapefile with v.in.ogr:
>    v.in.ogr dsn=ma.shp output=maGrass snap=0.001 min_area=0.0001
>    The same for others shapefiles pi, ce, rn, pb, pe, al, se and ba
>
> 2) Aggregate polygons with v.patch
>    v.patch
> input=maGrass,piGrass,ceGrass,rnGrass,pbGrass,peGrass,alGrass,seGrass,baGrass output=nePatched
>
> I do not figure out how I can solve this issue.

There are 3 ways to patch shapefiles:

1) before import with ogr2ogr -append. I don't know what happens when
the attribute tables are not compatible.

2) during import
you need to use to folder with the shapefiles as dsn for v.in.ogr,
then all OGR layers are imported at once and patched together. Each
OGR layer will result in a separate GRASS layer in the output GRASS
vector. Each GRASS vector layer will have its own attribute table,
i.e. it does not matter if attribute tables are not compatible.

3) after import with v.patch
Categories might need to be prepared first in order to avoid that
areas from different input vector maps end up with the same category.
Preserving attributes with v.patch is not trivial.
The output of v.patch will require further cleaning. From the manual:
"Boundaries may need to be cleaned with v.clean tool=break,rmdupl,rmsa
repeatedly until the rmsa tool (Remove small angles at nodes) no
longer modifies any boundaries. If vector topology is still not clean,
boundaries may also need to be snapped with v.clean
tool=snap,break,rmdupl."

HTH,

Markus M


More information about the grass-user mailing list