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 ?