Trying to convert the OpenStreetMap database to a weighted graph in order to apply algorithms like Dijkstra or A*. Any ideas on how to make the algorithm working on the data? The thing is to convert all the database in one time and then apply the algorithm. Right now I'm thinking of just read the database and extract the information needed to construct the graph. Make the roads as edges. As for the nodes, it's hard to determine what kind of location to keep. Need help :) asked 04 Mar '22, 13:30 wothell |
osm4routing2 is a simple and useful tool that will take an OpenStreetMap .pbf file and convert it into a routable graph, which you can then build your routing algorithms on. answered 04 Mar '22, 13:45 Richard ♦ |
Don't reinvent the wheel. Use existing software like Graphhopper, OSRM, Valhalla if you want fast and powerful routing. If you are desperate to build your own (or need to because of educational project assignment etc.), at least look at Graphhopper or OSRM source code to understand how OSM data is converted into a graph. If you really really want to build your own from scratch, look at https://help.openstreetmap.org/questions/19213/how-can-i-convert-an-osm-xml-file-into-a-graph-representation answered 04 Mar '22, 13:41 Frederik Ramm ♦ |