[geos-devel] Holes in holes
Sandro Santilli
strk at keybit.net
Tue Nov 24 10:25:15 EST 2009
A polygon with an hole in an hole is a multipolygon formed by a
polygon with an hole
and another polygon inside that hole. It is OGC-valid.
--strk;
On Tue, Nov 24, 2009 at 11:53 AM, Frederik Ramm <frederik at remote.org> wrote:
> Hi,
>
> I'm trying to create a polygon with a hole that has a hole (think: forest
> with a clearing but a patch of trees in the middle of that clearing).
>
> I must admit that I am slightly insecure on the question whether this is
> something that the OGC simple features spec supports; their definition of a
> polygon seems to be "something that has a closed outer ring and 0..n
> interior rings", but I cannot find information on whether those interior
> rings may contain each other or not.
>
> GEOS is of the opinion that a polygon made of three concentric rings, the
> inner two being "interior" rings, is invalid, as per this snippet:
>
> LinearRing *a = (LinearRing *) reader->read("LINEARRING(0 0, 10 0, 10 10,
> 0 10, 0 0)");
> Geometry *b = reader->read("LINEARRING(1 1, 9 1, 9 9, 1 9, 1 1)");
> Geometry *c = reader->read("LINEARRING(2 2, 2 8, 8 8, 8 2, 2 2)");
> vector<Geometry *> v;
> v.push_back(b);
> v.push_back(c);
> Geometry *p = global_factory->createPolygon(a, &v);
> cout << "valid: " << p->isValid() << endl;
>
> If I modify the above to create a multipolygon, consisting of the "forest
> with a hole" as polygon #1 and the "patch of trees inside the hole" as
> polygon #2, GEOS tells me that this geometry is valid:
>
> Is this the correct way to describe what I want - is a polygon with a hole
> in a hole always a multipolygon? Is the resulting structure really a valid
> multipolygon?
>
> Bye
> Frederik
>
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
--
Free GIS & Flash consultant/developer () ASCII Ribbon Campaign
http://foo.keybit.net/~strk/services.html /\ Keep it simple!
More information about the geos-devel
mailing list