[postgis-users] TopologyException: side location conflict

Martin Davis mbdavis at refractions.net
Tue Apr 24 08:50:54 PDT 2007


Ah, right - that makes sense.  Ordinary Douglas-Peucker simplification 
is not guaranteed to maintain topology.

JTS has a TopologyPreservingSimplifier which is safe to use.  This is in 
GEOS, but is apparently not exposed in PostGIS, however.

As an interim measure, you might try using buffer(0), which should have 
the effect of cleaning up the invalid geometry.

Stefan Zweig wrote:
> Hi Martin,
>
> this is a geometry-example which causes the error. (already the result of simplify(p."the_geom",0.001))
>
> "SRID=4326;MULTIPOLYGON(((12.580188 51.373967,12.562256 51.393057,12.522384 51.405868,12.509405 51.422205,12.493471 51.421644,12.48965 51.428585,12.516928 51.447914,12.508014 51.473221,12.51922 51.492546,12.509222 51.492563,12.498616 51.525579,12.483908 51.532504,12.5090463 51.5359336,12.510126 51.542813,12.5197436 51.5336497,12.521997 51.543612,12.533731 51.542285,12.537291 51.554611,12.561063 51.561843,12.565748 51.576295,12.59227 51.574819,12.606697 51.586819,12.62031 51.574803,12.643358 51.570059,12.638377 51.562592,12.653986 51.555776,12.679631 51.567556,12.699531 51.552931,12.753434 51.567096,12.813991 51.565712,12.816714 51.559281,12.824765 51.563208,12.825679 51.546586,12.86806 51.551449,12.877856 51.545186,12.860509 51.545619,12.915288 51.537334,12.8992658 51.5202663,12.934356 51.501062,12.924406 51.478989,12.9096214 51.4779279,12.8932373 51.5065071,12.9001306 51.4729784,12.835224 51.46272,12.833034 51.450177,12.789232 51.468401,12.7522 51.453984,12.720131 51.45454,12.712384 51.445902,12.664772 51.449811,12.645697 51.43669,12.6469931 51.4274848,12.65846 51.425221,12.645563 51.417605,12.648839 51.406172,12.622621 51.408846,12.610952 51.382359,12.590127 51.383687,12.580188 51.373967)),((12.9265896 51.5226495,12.907823 51.5192242,12.906139 51.528584,12.9265896 51.5226495)),((12.9088754 51.5469124,12.922428 51.543913,12.897451 51.542675,12.896428 51.548283,12.9088754 51.5469124)))"
>
> meanwhile i have found out that the geometry is not valid because it has self-intersections which causes geos-analyzing functions to abort. if i do exclude invalid geometries from my query with isvalid() the query works fine. but this is only a workaround. it would be nice if either the simplification would not return self-intersecting geometries or geos could better deal with them e.g. not interrupt the whole query.
>
> is there maybe another workaround?
>
> regards.
>
>
>   
>> -----Ursprüngliche Nachricht-----
>> Von: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>> Gesendet: 23.04.07 18:33:32
>> An: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>> Betreff: Re: [postgis-users] TopologyException: side location conflict
>>     
>
>
>   
>> Can you post two geometries which cause the error?
>>
>> Both WKT and WKB would be nice.
>>
>> Stefan Zweig wrote:
>>     
>>> hi @ all,
>>>
>>> i have following problem with the postgis WITHIN method:
>>>
>>> i am trying to check whether some polygons from one layer/table are within a polygon from another layer/table and i am doing this with this sql command:
>>>
>>> SELECT p."POSTCODE"
>>> FROM _countys b AS b, postcodes AS p
>>> WHERE b."NAME"='florida' AND p."the_geom" @ b."the_geom" = true
>>> AND WITHIN(p."the_geom", b."the_geom") = true
>>> ;
>>>
>>> this works fine but takes i while to be procedured. so i wanted to make the within check faster by simplifying the source geometries (EPSG: 4326):
>>>
>>>
>>> SELECT p."POSTCODE"
>>> FROM _countys b AS b, postcodes AS p
>>> WHERE b."NAME"='florida' AND p."the_geom" @ b."the_geom" = true
>>> AND WITHIN(simplify(p."the_geom",0.001), simplify(b."the_geom",0.001)) = true
>>> ;
>>>
>>> but then i get the following error:
>>>
>>> NOTICE:  TopologyException: side location conflict (-81.0351,26.6027,26.6027)
>>>
>>> ERROR: GEOS within() threw an error!
>>> SQL Status:XX000
>>>
>>> i am wondering why the within operator does not work with simplified coordinates / geometries.
>>>
>>> btw.: i does not seem that this error occurs with any within/simplify usage, only in some cases.
>>>
>>> i appreciate any help.
>>>
>>> stefan
>>> _______________________________________________________________
>>> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
>>> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>   
>>>       
>> -- 
>> Martin Davis
>> Senior Technical Architect
>> Refractions Research, Inc.
>> (250) 383-3022
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>     
>
>
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>   

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





More information about the postgis-users mailing list