<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi George,<br><br>There is a simple example of a script using topology on the wiki at:<br><a href="http://trac.osgeo.org/postgis/wiki/UsersWikiTopologyExample">http://trac.osgeo.org/postgis/wiki/UsersWikiTopologyExample</a><br>& more help at<br><a href="http://trac.osgeo.org/postgis/wiki/UsersWikiPostgisTopology">http://trac.osgeo.org/postgis/wiki/UsersWikiPostgisTopology</a><br><br><br>The attached script was written to take the New Zealand mainland coastline comprised of various linestrings which had small gaps between them in some cases, & build a polygon from them. To do this it iterated through the linestrings, loading them into the topology one at a time with a small snapping distance to ensure all the start/end nodes aligned correctly. <br><br>It also loads data from various shapefiles of island polygons into the table & exports a shapefile
of the entire national coastline as polygons. I think you can pull out the appropriate SQL commands from this to do what you are asking about.<br><br>I haven't tried this with multilinestrings, only single linestrings. <br><br>If you need additional help, feel free to ask, though I'm just learning the topology stuff myself.<br><br>Cheers,<br><br> Brent Wood<br><br><br>--- On <b>Wed, 5/16/12, george wash <i><gws293@hotmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: george wash <gws293@hotmail.com><br>Subject: Re: [postgis-users] Closing polylines<br>To: pcreso@pcreso.com<br>Date: Wednesday, May 16, 2012, 12:28 PM<br><br><div id="yiv882639950">
<div>
On 5/16/2012 4:16 AM, <a rel="nofollow" class="yiv882639950moz-txt-link-abbreviated" ymailto="mailto:pcreso@pcreso.com" target="_blank" href="/mc/compose?to=pcreso@pcreso.com">pcreso@pcreso.com</a> wrote:
<blockquote type="cite">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="font:inherit;" valign="top">You can work around
this problem by using the Postgis topology capability. It
will build polygons (faces) from such lines which you can
use as topopolygons or extract as conventional geometries.<br>
<br>
--- On <b>Tue, 5/15/12, george wash <i><a rel="nofollow" class="yiv882639950moz-txt-link-rfc2396E" ymailto="mailto:gws293@hotmail.com" target="_blank" href="/mc/compose?to=gws293@hotmail.com"><gws293@hotmail.com></a></i></b>
wrote:<br>
</td>
</tr>
</tbody>
</table>
</blockquote>
<font size="+1">thank you pcreso, I had a look at the topology
section of the PostGIS manual</font>, but I must admit I am going
to need some guidance as to how to proceed as I never used it
before.<br>
Given the attachment in my earlier post, which is a dump of a simple
geometry table in the public schema, how do you suggest I proceed
with creating the topology and how do I then extract the closed
contours from it? Many thanks<br>
<br>
</div>
</div></blockquote></td></tr></table>