Hi Horst,
Unfortunately, your script does not work with the invalid geometry
Stefan posted today
(http://postgis.refractions.net/pipermail/postgis-users/2008-April/019397.html).
It quietly drops a good portion of the linework when rebuilding the
multipolygon.
I think the problem lies in your approach for dealing with the resultset
from polygonize (when trying to figure out which polygons are outer
rings and which are holes). I think you may find that ST_BuildArea is
much better at this type of thing than ST_Polygonize.
I modified your script slightly, by removing the entire section from
"tmpPolygon = polygonize(tmpLinestring);" to the end of the LOOP,
replacing it all with "outGeom = buildarea(tmpLinestring);". This
approach deals nicely with Stefan's error geometry. I haven't tested it
with other invalid cases, nor have I tested the linear portion of the
script, but it looks promising.
Good work.
Cheers,
Kevin
Düster Horst wrote:
In the last few days I developed a plpgsql function to clean not valid
polygon and linestring geometries. This function cleans all ring-self-
and self-intersections in PostGIS layers.
The input is a valid or non valid geometry with one or more
self-intersections. The result is a clean Multi geometry where all
intersections are correct noded and divided into multiparts. I tested
it with polygon layers with more than 800000 objects and it works fine
for me. You can use the function with PostGIS >= 1.3.2. If you want to
use it with PostGIS 1.1.6 you have to modify the source and remove all
ST_ from the specific funktion names.
I hope the function could be helpful for you, for me it is.
Looking forward for your comments.
Best regards
Horst
------------------------------------------------
Dr. Horst Düster
GIS-Koordinator, Stv. Amtschef
Kanton Solothurn
Bau- und Justizdepartement
Amt für Geoinformation
SO!GIS Koordination
Rötistrasse 4
CH-4501 Solothurn
Telefon ++41(0)32 627 25 32
Telefax ++41(0)32 627 22 14
mailto:[EMAIL PROTECTED]
http://www.agi.so.ch
------------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users