[GRASS-user] Import of multi-part polygons using v.in.ogr?

Hi List --

Looking at function centroid() in geom.c
of v.in.ogr, it seems to me that the code
for import of polygons always assumes that
the first ring is the exterior boundary and
the following ones are all interior boundaries
(see comment on lines 70 and 71).

Is this a limitation of GRASS' vector model
or would it be possible to import multi-part
polygons with more than one outer boundary by
amending the code in v.in.ogr?

I understand that it is possible to import
multi-part geometries into GRASS and assign
each part the same "cat" number. However,
when exporting with v.out.ogr, they will be
exported as separate parts, each with its
own attribute table row. Is there any
way to preserve multi-part features using
v.in.ogr and v.out.ogr?

If this is currently not possible: Would it
be a viable solution to add a "-j" (join)
flag to v.out.ogr so that it will merge
geometries with the same "cat" into multi-
part features on export?

Cheers,

Ben

--
Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer

   benducke@fastmail.fm

On Sun, Dec 2, 2012 at 3:33 PM, Benjamin Ducke <benducke@fastmail.fm> wrote:

Hi List --

Looking at function centroid() in geom.c
of v.in.ogr, it seems to me that the code
for import of polygons always assumes that
the first ring is the exterior boundary and
the following ones are all interior boundaries
(see comment on lines 70 and 71).

Is this a limitation of GRASS' vector model
or would it be possible to import multi-part
polygons with more than one outer boundary by
amending the code in v.in.ogr?

Import of multi-features such as wkbGeometryCollection,
wkbMultiPolygon, wkbMultiLineString, wkbMultiPoint is supported by
v.in.ogr. For centroid(), see lines 160ff, for geom(), see lines
432ff.

I understand that it is possible to import
multi-part geometries into GRASS and assign
each part the same "cat" number. However,
when exporting with v.out.ogr, they will be
exported as separate parts, each with its
own attribute table row. Is there any
way to preserve multi-part features using
v.in.ogr and v.out.ogr?

Multi-part features are preserved by v.in.ogr, all included features
get the same category.

For v.out.ogr, I think this is not so easy because not every
OGR-supported output format supports multi-features (may be wrong).

If this is currently not possible: Would it
be a viable solution to add a "-j" (join)
flag to v.out.ogr so that it will merge
geometries with the same "cat" into multi-
part features on export?

I guess technically yes, if multi-features are supported by the
selected output format.

Markus M