[postgis-users] Intersection errors

Carl Anderson carl.anderson at vadose.org
Wed Jun 8 18:30:22 PDT 2005


Markus Schaber wrote:

>Hi, Ethan,
>
>Ethan Alpert wrote:
>  
>
>>While we're on the topic of multipolygons. I've noticed that the
>>shapefile specification doesn't have any convention for communicating
>>outer and inner rings. That said how do apps like shp2pgsql and ogr2ogr
>>determine whether the next polygon in a list is an inner or a new outer?
>>    
>>
>
>If you need a really stable algorithm, current JTS releases contain a
>polygonize function that converts arbitrary linework into polygons. This
>should work without any dependencies on ring order or clockwise
>ordinates, but I suspect this to be rather inefficient.
>
>Markus
>
>
>  
>
Alternatively, the treatment of shapefile polygons the same as the 
accumulated symdifference of each ring.
look at ESRI's handling of polygons which have parts that cross each 
other for how that works.

If you can cast each ring to a PostGIS polygon you can use the 
symdifference function to assemble all the parts.
It's still relatively expensive, but not as expensive as the polgonize 
function.

(expressed in no particular language)
mp = part[1]
i = 2
while ( i < nparts) loop
    mp = symdifference(mp, part[i]);
end loop

C.

>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>  
>




More information about the postgis-users mailing list