[postgis-users] Build topology for polygon layer using postgis2.0

Elton Chan elton.chan at yahoo.com
Wed Nov 2 22:26:08 PDT 2011


Hi Sandro,

I tried to run the two commands that you suggested. However, it returns some empty layers only. (e.g. test.edge, test.face...). I check that there are some warning message in the output pane.

I wonder if it is due to some geometry problem in the data set so that it cannot generate the topology. 

Besides, I am thinking to use ST_SNAP to clear some gaps between polygons. I have done some small test, it works. However, to apply the same for a layer containing hundreds polygons, it requires to loop through all the possible adjacent polygons respecting to each polygon. It will take a very very long processing time. Any other idea? Any method to filtering those gaps first?

Meanwhile, it seems ST_CreateTopoGeo is doing similar things as you describe in the proposed toTopoGeometry. Correct me if I am wrong. It seems the toTopoGeometry performance should be better than the ST command, right?

elton


--- On Mon, 10/31/11, Sandro Santilli <strk at keybit.net> wrote:

> From: Sandro Santilli <strk at keybit.net>
> Subject: Re: [postgis-users] Build topology for polygon layer using postgis2.0
> To: elton.chan at yahoo.com, "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
> Date: Monday, October 31, 2011, 2:50 PM
> On Sun, Oct 30, 2011 at 10:37:31PM
> -0700, Elton Chan wrote:
> > Hi there,
> > 
> > I would like to build topology for a polygon layer
> using postgis 2.0. The polygon layer contains contiguous
> polygons snap to each another but some are having some
> geometry error such as gap is found between polygons.
> > 
> > Does anybody know the procedure to build topology with
> abovemention polygon data? More precisely, any procedure to
> convert all the polygons to line strings, then remove
> duplicate lines, and build topology and remove
> > small polygons.
> 
> SELECT topology.CreateTopology('test', 4326);
> SELECT topology.ST_CreateTopoGeo(ST_Collect(the_geom)) from
> mylayer;
> 
> Let it go while trick & treating as it'll take a
> lot...
> 
> A more scalable solution (the above does most work in
> memory) and one
> which would also create the TopoGeometry objects for you to
> re-construct
> the original point set in a value to use in your table, is
> the toTopoGeometry
> function which takes a GEOMETRY and put it into a topology
> giving you back
> the topologically-defined version of your GEOMETRY. Such
> function is yet
> to be done but is planned: http://trac.osgeo.org/postgis/ticket/1017
> and it is looking for co-funders (let me know if you're
> interested).
> 
> --strk; 
> 
>   ()   Free GIS & Flash
> consultant/developer
>   /\   http://strk.keybit.net/services.html
> 



More information about the postgis-users mailing list