How can I import my own roads data in .OSM format into graphhopper?

Hi there,

We have our own roads data that we use in pgRouting to obtain the optimal route from point A to B using dijkstra’s algorithm. I am new to Graphhoper and would like to know how I can import my roads data to accomplish the same? Perhaps this type of question have been asked already. If so, could you please refer me to that post.

Kind Regards,
Leighton

I specified the .osm file here (t4a_highways.osm.pbf):
java -Ddw.graphhopper.datareader.file=t4a_highways.osm.pbf -jar *.jar server config-example.yml

when I execute the above and go to http://localhost:8989/, the map of Berlin is displayed, not the t4a_highways.osm.pbf specified.

I also received the above “Point 0 is out of bounds:…” error when I manually plotted the start and end locations in the geographical area of my osm file.

You probably need to remove the graph-cache or similar folder. GraphHopper stores it’s data into a folder (often called graph-cache, or berlin-latest-gh or similar) and only considers the OSM file you specify via datareader.file if this folder does not exist yet. From then on it will just ignore the datareader.file and load the graph from the folder instead. In your case GraphHopper probably just loads the Berlin graph that you imported earlier. You can also set the name of the folder to use explicitly via graph.location.

1 Like

Thank you easbar, your suggestion worked!

I deleted the graph-cache folder and reloaded java -Ddw.graphhopper.datareader.file=t4a_highways.osm.pbf -jar *.jar server config-example.yml and refreshed http://localhost:8989/

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.