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

Sandro Santilli strk at keybit.net
Sun Oct 30 23:50:04 PDT 2011


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