Friday 1 March 2019

qgis - Reading and Exporting OSM Road Data as Network of Road Segments [Adjacency Matrices]



I wish to extract from an OSM file a road network, and export it as an array (adjacency matrix) where the nodes are the road intersections and the edges represent the road segments.


I don't want to just visualise it, but also export the resulting adjacency matrix as a file with a network data structure in at least one of the following formats: numpy file (.npy), pajek file (.net), gephi file (.gexf), csv file (.csv). Alternatively, a list of nodes and edges with geometric info would do.


I seek a solution using either Python or QGIS.


I was hoping for something like this Matlab package, especially the 3rd item in the description. Unfortunately, I don't have Matlab installed on my machine.



Answer



I do not know an exact solution, but will try to present you general ideas:


What you are looking for is adjacence matrix for an routing graph that is generated out of OSM geodata. While there is a huge interest in the routing topic at the community, there are just very few approaches to export the routing graph, as user usually want a full featured routing solution.



  • eWorld is a frontend for the SUMO engine that enables this simulator to make use of OSM. You can get network files etc.


  • osm2pgrouting fills a PostGIS DB according to the requirements of the pgrouting module

  • QGIS road graph plugin can also be used on OSM for example with the OSM import plugin or with preprocessed shapefiles

  • osm4routing might fit your export requirements, but I never heard of it before so I guess it's not in wide use...


A last idea would be to play with the trafficmining framework that seems to be very modular, so I guess you can get access to the processed data (but it's in JAVA)


All in all it depends on your use case.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...