PostgreSQL to graph-tool

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

PostgreSQL to graph-tool

Duccio Aiazzi
I'm interested in calculating some centrality measures on a road network of a city. The geometry of the road network, from Open Street Map, is stored in a postgreSQL / postGIS database and can also be exported as a shapefile or a geojson. What is the best way to import the geometry in graph-tool as a planar graph?
Thank you, 
Duccio 

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL to graph-tool

Rafael Pereira
Hi Duccio Aiazzi,

I don't have an answer to your specific question, but I just want to call your attention to the OSMnnx , which makes it incredibly simple to create a road network from OpenStreetMaps data with a single line of code. https://github.com/gboeing/osmnx

OSMnnx  also allows one to save the graph as a GraphML file, which I believe can be easily read by graph-tool as a planar graph if I'm not mistaken.

best,

Rafael H M Pereira

On Sat, Dec 2, 2017 at 7:28 AM, Duccio Aiazzi <[hidden email]> wrote:
I'm interested in calculating some centrality measures on a road network of a city. The geometry of the road network, from Open Street Map, is stored in a postgreSQL / postGIS database and can also be exported as a shapefile or a geojson. What is the best way to import the geometry in graph-tool as a planar graph?
Thank you, 
Duccio 

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool



_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL to graph-tool

Tiago Peixoto
Administrator
On 02.12.2017 20:22, Rafael Pereira wrote:
> OSMnnx  also allows one to save the graph as a GraphML file, which I believe
> can be easily read by graph-tool as a planar graph if I'm not mistaken.

It seems to me this is by far the easiest choice.

In addition to exporting to graphml, it is also simple to iterate over the
edges of the OSMnnx graph and add them to a graph-tool graph.

(Note that road networks need not to be planar; they may contain bridges and
tunnels.)

Best,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
--
Tiago de Paula Peixoto <tiago@skewed.de>