4

Hello everybody I am currently an intern at a company which does business applications. First my task was to implement an GiS component who queried google directions api (this was straight forward).

Now I have implement an offline routing GiS component. The problem is that my advisors don't have any know-how and cannot give me a starting point.

So far I found out, that I will need a osm file and graphHoper. Well sounds simple, but I don't understand the docs for graphHoper and I couldn't find something on osm-offline routing. Summed up: I am lost since two days and struggle to find an "entry point" for learning.

Is there a hello-world like tutorial on osm-offline routing? Are there already offline routers in java which I could integrate? (I tried to search, but I couldn't figure it out if they indeed where offline routers)

Kind regards

David

David Lehnherr
  • 225
  • 1
  • 10

2 Answers2

4

Okay so here are my closing words:

Go to: https://www.viaboxx.de/route-optimization/distances-for-vehicle-routing-with-graphhopper/

Which is an excellent writeup for offline-routing with ghrapHopper. Just copy the snippets and glue them together (you won't need any additional code).

Be aware, that for the first compilation, graphHopper will parse the osm file (takes about 10min on my laptop). Et voila! You are doing offline routing now B)

For the arguments:

woringDir : just a string for your workspace location root/.../eclipse-workspace

osmFile: just the whole path of your osm file (e.g on desktop).

Some "naive" benchmarks: i) 10000 random routes over Berlin with google directions: takes way over 5 min (stopped at 8) ii) 10000 random requests over Berlin with offline ism routing: 11 sec, case closed.

While my questions couldn't be answered by users, I still want to thank you for your time. I think that my initial question lacked some details.

see you around ,

david

David Lehnherr
  • 225
  • 1
  • 10
0

There are various OSM routing engines available.

Since you already choose GraphHopper see the Quick Start Guide for Developers for installation instructions and Routing API - Directions API documentation for usage instructions.

scai
  • 20,297
  • 4
  • 56
  • 72
  • First of, thank you for your answer. The docs only Cover the usage for online routing. I am more interested in: How to Access an osm file using java, represent it as a graph and run a djikstra on it (and I hoped that there would be an api for this). – David Lehnherr Jul 18 '18 at 15:02
  • This is what GraphHopper does internally (more or less). Start your local instance and obtain directions via its web API. Alternatively if you don't like the web API then see [Routing via Java API](https://github.com/graphhopper/graphhopper/blob/master/docs/core/routing.md) and the [low level API](https://github.com/graphhopper/graphhopper/blob/master/docs/core/low-level-api.md). – scai Jul 19 '18 at 06:52