[postgis-users] Postgis topology help

Sandro Santilli strk at keybit.net
Wed Apr 4 10:49:03 PDT 2012


On Wed, Apr 04, 2012 at 09:57:10AM -0700, pcreso at pcreso.com wrote:
> Following on from the reply by strk (thanks!!) I'm still working through how to use topologies.
> 
> I have a script which creates a topology, adds 5 linestrings looking like:
>   
>    |      |      |
>  ---------------
>    |      |      |
>  ---------------
>    |      |      |
> 
> validates the result and then Polygonizes it, creating two faces. 


Like this ?

     |      |      |
    -+------+------+-
     |      |      |
    -+------+------+-
     |      |      |
  
> I'm using the SVN docs 
>http://www.postgis.org/documentation/manual-svn/Topology.html ) 
> as my reference, as this is the best I have found so far. 
> 
> What I want this script to do is run a query listing/describing the faces that have been created, then extract them as polygon geometries into a Postgis geometry column to be used as conventional polygons, but I can see no way in the docs of accomplishing this.

ST_TopologySummary gives you a good summary.

You can use GetFaceGeometry to extract the faces polygons,
maybe use it in a query to <yourtoponame>.face to see them
all. Remember that face_id=0 is the universe face, so you
want to skip that from the query.

> Once I get the script able to complete this operation I figure I should have a much better understanding of how Postgis topology works, & will stick it on the wiki as a working example. I'll also insert more commands to illustrate other operations, as I learn this stuff.
> 
> Any suggestions as to how to accomplish these next steps?

I think your next step should be looking at constructing TopoGeometry
objects :)

--strk;

  ,------o-. 
  |   __/  |    Delivering high quality PostGIS 2.0 !
  |  / 2.0 |    http://strk.keybit.net - http://vizzuality.com
  `-o------'




More information about the postgis-users mailing list