I'm new in use map GraphHopper, OpenStreetMap, and others library. I want to draw route which generated by GraphHopper Routing Engine (actually in Java language). Is that possible for draw route from GH using OpenLayer?
I have read this GWT-OpenLayer, but I can't find how to write a route in real road like this GraphHopper Routing Example
I hope openlayers API can cover my need
- GH Routing Engine generate route from A (long, lat) to B (long, lat)
- OpenLayers GWT draw every route from GH
Any help will appreciate :)
The GraphHopper routing API is very similar to many other routing APIs, it can be fetched directly from a JavaScript application such as OpenLayers and the result contains a polyline as used in this example https://openlayers.org/en/main/examples/feature-move-animation.html (but the polyline can contain elevations and has a standard ie5 scale factor). Changing the OpenLayers example to use the route in your GraphHopper example (I copied the API key but for production you should get your own) the result is: