[postgis-users] Trying to figure out topology

William Kyngesburye woklist at kyngchaos.com
Tue Jun 5 10:38:17 PDT 2007


I'm trying to figure out the topology functions in postgis - a little  
experimentation to see what's there, hoping to possibly use node data  
for pgrouting functions.  I want to generate topology for a line

The wiki is a little technical right now with no real examples, but I  
got this far in setting up topology (working with the pgrouting  
sample data, 'kanagawa' roads):

- load the topology.sql to create the 'topology' schema.

- select topology.CreateTopology('kanagawa', 4326);

(I imported with GDAL and set the srid to 4326 instead of -1 you get  
with shp2psql)

- select topology.AddTopoGeometryColumn('kanagawa', 'public',  
'kanagawa', 'topology', 'LINE');

- select topology.CreateTopoGeom('kanagawa', 'LINE', 2);

Now I get to generating topology for each line in the layer.  The  
wiki has:

select topology.CreateTopoGeom(topology_name, feature_type, layer_id  
[as returned from AddTopoGeometryColumn], TopoElementArray);

but the link to TopoElementArray doesn't really tell me where to get  
those element type/element id pairs for the array.  Would those be  
the geom types and feature IDs of the layer?  Would I use a SQL  
select to pipe in all the rows of the layer?  Examples would be much  
appreciated.


-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy





More information about the postgis-users mailing list