This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

building graph from database structure to implement A* algorithm

0

I imported an osm file into a postgresql database using osm2pgsql. Now, I want to implement a route/path generating algorithm(routing algo) based on two locations entered by a user. It is not really clear for me where in my database structure I should search for these two points. For example if a user enters as starting point "Airport A" and as end point "Airport B" where should I search for these two locations so I can start implementing my routing algorithm. I need some clear information on how the database is structured and how to create a graph so that i can implement A* algorithm between the 2 points the user has enetered.

asked 08 Feb '18, 03:44

roshansivakumar's gravatar image

roshansivakumar
11112
accept rate: 0%

2

Using osm2pgsql is not the best way of doing this as it removes connection information between ways. Most routing tools use a separate geocoder to translate from location names to lat/lon. I would recommend using something like osm2pgrouting and PG routing in PostGis.

(08 Feb '18, 16:59) SK53 ♦

Source code available on GitHub .