[postgis-users] Removing / Polygonising multiple overlapping lines
Ben Madin
lists at remoteinformation.com.au
Tue Jan 5 01:31:00 PST 2010
G'day all,
I have a problem with some administrative boundary data I have failing validity checks.
As an example, I had a polygon which kept reporting self-intersections. When I tried :
select st_exteriorring((st_dump(the_geom)).geom) as the_geom from tmp_admin where gid = 91;
So the one polygon returned 887 linestrings, which in themselves were valid, but :
prices=# select gid, st_geometrytype(the_geom), st_isvalid(the_geom), st_issimple(the_geom), st_isring(the_geom) from rubbish where st_isring(the_geom) is false;
gid | st_geometrytype | st_isvalid | st_issimple | st_isring
-----+-----------------+------------+-------------+-----------
103 | ST_LineString | t | f | f
197 | ST_LineString | t | f | f
199 | ST_LineString | t | f | f
313 | ST_LineString | t | f | f
485 | ST_LineString | t | f | f
489 | ST_LineString | t | f | f
470 | ST_LineString | t | f | f
474 | ST_LineString | t | f | f
516 | ST_LineString | t | f | f
887 | ST_LineString | t | f | f
(10 rows)
so for example 485 is in green and looks like (apologies if the picture is scrubbed). The blue island is OK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2010-01-05 at 5.24.40 PM.png
Type: image/png
Size: 13380 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100105/88d703ea/attachment.png>
-------------- next part --------------
It appears that the one line goes around the island three times, and this was the basis for the polygon. I'm a little stuck with 1.4.0 at the moment, so I can't use the st_lineCrossingDirection function, but what I really want is to produce a polygon which matches the outermost line of the object.
Any ideas... I'd rather do this in postgis as there are more of them...
cheers
Ben
More information about the postgis-users
mailing list