Adding graphhopper to angular framework

How can i add graphhopper routing to openstreetmap in an angular app ?

Maybe you can include part of the frontend as a component, but then you should make a big refactor of this code, and place it all in NgZone. IMO simpler is to use leaflet out of the box, make your own angular client and that is it.

You can also try https://github.com/Asymmetrik/ngx-leaflet

Thank you for your reply actually i have already loaded my map using leaflet, i want to show a polyline from point A to point B using graphhopper and later i will place a current location feature which will automatically update itself. The thing is that i don’t know how to insert the graphhopper response in my app.

If you are using just API you need to subscribe on HttpClient response, access and decode points (paths[#].points, you can find decodePath code in repo,
image
and then create polyline from lon lat array (it was in this order as I remember).
Leaflet also can take geojson as an input.

Powered by Discourse