[postgis-users] Closing polylines

pcreso at pcreso.com pcreso at pcreso.com
Wed May 16 11:24:34 PDT 2012


Hi George,

There is a simple example of a script using topology on the wiki at:
http://trac.osgeo.org/postgis/wiki/UsersWikiTopologyExample
& more help at
http://trac.osgeo.org/postgis/wiki/UsersWikiPostgisTopology


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. 

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.

I haven't tried this with multilinestrings, only single linestrings. 

If you need additional help, feel free to ask, though I'm just learning the topology stuff myself.

Cheers,

   Brent Wood


--- On Wed, 5/16/12, george wash <gws293 at hotmail.com> wrote:

From: george wash <gws293 at hotmail.com>
Subject: Re: [postgis-users] Closing polylines
To: pcreso at pcreso.com
Date: Wednesday, May 16, 2012, 12:28 PM


  

    
  
  
    On 5/16/2012 4:16 AM, pcreso at pcreso.com wrote:
    
      
        
          
            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.

              

              --- On Tue, 5/15/12, george wash <gws293 at hotmail.com>
              wrote:

            
          
        
      
    
    thank you pcreso, I had a look at the topology
      section of the PostGIS manual, but I must admit I am going
    to need some guidance as to how to proceed as I never used it
    before.

    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

    

  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120516/e15e6c82/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mk_coast
Type: application/octet-stream
Size: 6443 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120516/e15e6c82/attachment.obj>


More information about the postgis-users mailing list