[geos-devel] Topology Exception with nested collections

Martin Davis mbdavis at refractions.net
Thu Jan 21 17:53:15 EST 2010


JTS/GEOS does not support unioning GeometryCollections.  Not sure how 
PostGIS is sidestepping this problem - perhaps it just ignores it? 

One issue is that just because a GeometryCollection of Polygons is valid 
does not mean that the set of Polygons would form a valid MultiPolygon 
(they might overlap).  In this case you would see this kind of failure.

Obe, Regina wrote:
> I'm actually not sure if this is a bug or not, but I always thought in a perfect world that if I union two valid geometries, I should not get errors.  I get a bunch of these in my torture tests (both against 3.1.1 and 3.2.0 GEOS) and verified they  pass the ST_IsValid test.
>
> One of these cases stripped down to its bear minimum - gives error :
> NOTICE:  TopologyException: side location conflict -9 50 --.  Anyway thought I would mention it in case its not a trivial thing.  I doubt anyone has monsters like this anyway.
>
> SELECT ST_Union(foo1.geom, foo2.geom)
> FROM (SELECT ST_GeomFromEWKT('SRID=4326;GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(-10 50),POLYGON((-9 50,51 -11,-10 50,-9 50))),GEOMETRYCOLLECTION(POINT(-10 70),POLYGON((-9 70,71 -11,-10 70,-9 70))),GEOMETRYCOLLECTION(POINT(-10 50),POLYGON((-8 50,52 -12,-10 50,-8 50))),GEOMETRYCOLLECTION(POINT(-10 70),POLYGON((-8 70,72 -12,-10 70,-8 70))),GEOMETRYCOLLECTION(POINT(10 50),POLYGON((11 50,51 9,10 50,11 50))),GEOMETRYCOLLECTION(POINT(10 70),POLYGON((11 70,71 9,10 70,11 70))),GEOMETRYCOLLECTION(POINT(10 50),POLYGON((12 50,52 8,10 50,12 50))),GEOMETRYCOLLECTION(POINT(10 70),POLYGON((12 70,72 8,10 70,12 70))),GEOMETRYCOLLECTION(POINT(30 50),POLYGON((31 50,51 29,30 50,31 50))),GEOMETRYCOLLECTION(POINT(30 70),POLYGON((31 70,71 29,30 70,31 70))),GEOMETRYCOLLECTION(POINT(30 50),POLYGON((32 50,52 28,30 50,32 50))),GEOMETRYCOLLECTION(POINT(30 70),POLYGON((32 70,72 28,30 70,32 70))),GEOMETRYCOLLECTION(POINT(50 50),POLYGON((51 50,51 49,50 50,51 50))),GEOMETRYCOLLECTION(POINT(50 70),POLYGON((51 70,71 49,50 70,51 70))),GEOMETRYCOLLECTION(POINT(50 50),POLYGON((52 50,52 48,50 50,52 50))),GEOMETRYCOLLECTION(POINT(50 70),POLYGON((52 70,72 48,50 70,52 70))))') As geom) As foo1
> 	CROSS JOIN
> 	(SELECT ST_GeomFromEWKT('SRID=4326;GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(-10 50),POLYGON((-9 50,51 -11,-10 50,-9 50))),GEOMETRYCOLLECTION(POINT(-10 70),POLYGON((-9 70,71 -11,-10 70,-9 70))),GEOMETRYCOLLECTION(POINT(-10 50),POLYGON((-8 50,52 -12,-10 50,-8 50))),GEOMETRYCOLLECTION(POINT(-10 70),POLYGON((-8 70,72 -12,-10 70,-8 70))),GEOMETRYCOLLECTION(POINT(10 50),POLYGON((11 50,51 9,10 50,11 50))),GEOMETRYCOLLECTION(POINT(10 70),POLYGON((11 70,71 9,10 70,11 70))),GEOMETRYCOLLECTION(POINT(10 50),POLYGON((12 50,52 8,10 50,12 50))),GEOMETRYCOLLECTION(POINT(10 70),POLYGON((12 70,72 8,10 70,12 70))),GEOMETRYCOLLECTION(POINT(30 50),POLYGON((31 50,51 29,30 50,31 50))),GEOMETRYCOLLECTION(POINT(30 70),POLYGON((31 70,71 29,30 70,31 70))),GEOMETRYCOLLECTION(POINT(30 50),POLYGON((32 50,52 28,30 50,32 50))),GEOMETRYCOLLECTION(POINT(30 70),POLYGON((32 70,72 28,30 70,32 70))),GEOMETRYCOLLECTION(POINT(50 50),POLYGON((51 50,51 49,50 50,51 50))),GEOMETRYCOLLECTION(POINT(50 70),POLYGON((51 70,71 49,50 70,51 70))),GEOMETRYCOLLECTION(POINT(50 50),POLYGON((52 50,52 48,50 50,52 50))),GEOMETRYCOLLECTION(POINT(50 70),POLYGON((52 70,72 48,50 70,52 70))))') As geom) As foo2
> -----------------------------------------
> The substance of this message, including any attachments, may be
> confidential, legally privileged and/or exempt from disclosure
> pursuant to Massachusetts law. It is intended
> solely for the addressee. If you received this in error, please
> contact the sender and delete the material from any computer.
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the geos-devel mailing list