I use PostGIS 2.0 and Python API (GeoAlchemy) to work with it.

I want to convert topological informations (points, lines, faces) from PostGIS tables to topological network (points, lines) to study it with network analyses. Initial data is a planar graph (shapefile, POLYGON).In PostGIS, my first steps were : - to create a topological environment (with 'CreateTopology') - to convert a shapefile (geometry) into a topological table (topology, with 'AddTopoGeometryColumn', 'toTopoGeom')

Then, I've got : - a topological extension ('postgis_topology') - a topological schema (called 'my_topo') - a table with topological lines ('my_topo.edge_data') - a table with topological nodes ('my_topo.node') - a table with topological surface ('public.es', topological information is in 'topo' column)

I want to study topological surfaces coming from the shapefile as with network analysis, so, surfaces must be considered as nodes of the network. I know that 'NetworkX', a Python module, permit to read/write network data from/to PostGIS (module 'pg_net').

How can I convert my tables ('my_topo.edge_data', 'my_topo.node', 'public.es') to a network ? How can I convert polygons ('public.es.topo') to nodes ?


A node and a polygon are mutually exclusive defines although a polygon could potentially be composed of nodes as related by interior and or exterior edges. A shape file already has topological relations and can consume routing applications, so networks and nodes are already present. You are trying to reinvent the wheel perhaps? routing can consider an edge or a point but as a polygon it would have to consider all edges and all points which is self defeating form a perspective of pure logic. Which collection of edges converging on relevant node or nodes are more relevant. Another approach would be consider nodes as a collection of relevant edges, which edges are relevant and why, what rule defines this, what is the logic model product extract?

Your Answer

