[geos-devel] Topology Exception with nested collections

Martin Davis mbdavis at refractions.net
Mon Jan 25 11:47:23 EST 2010


Yes, if you union all the polygons together they will produce a valid 
(Multi)Polygon. 

In fact, unary union *does* handle GeometryCollections - at least in 
JTS, hopefully GEOS & PostGIS as well.  So that's a simpler way to 
compute the union of the collection.

M

Obe, Regina wrote:
> Hmm more smurf code but in PostGIS.  I guess its been there for a while since my PostGIS 1.3.6 exhibits the same behavior.  I presume it must be then dumping out the collection before feeding it to GEOS if GEOS  doesn't support this directly.
>
>
> Martin -- If all the Polygons are valid though, then when I union them it should form a valid Polygon/Multipolygon since it would dissolve whatever boundaries are there correct?
>
> Anyrate I'll dump this out use an aggregate union and see if I end up with the same error.
>
> ________________________________________
> From: geos-devel-bounces at lists.osgeo.org [geos-devel-bounces at lists.osgeo.org] On Behalf Of Martin Davis [mbdavis at refractions.net]
> Sent: Thursday, January 21, 2010 5:53 PM
> To: GEOS Development List
> Subject: Re: [geos-devel] Topology Exception with nested collections
>
> 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
>
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
> -----------------------------------------
> 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