How to show a route when calling the url
Hi,
I have an application that runs on a server with osrm. I would like to show a map with a route on my jsp. For now, I have an iframe whose source is the main.html file of the Project-OSRM-WEB. Is it possible to set options like localisation source and target to show a route ? I would like also to hide the main-wrapper box.
There are such a lot of js files and I'm quite lost here. If somebody could help me that would be great, thanks.
@DennisSchiefer
The web frontend wasn't built with that in mind. If you simply wish to display a route without interactivity the easiest solution is probably to simply create a leaflet map and draw a path on there and markers with leaflet functionality. Maybe you could elaborate a bit more on your use case, so that I can see what functionality you actually require from the web frontend.
Creation of the Leaflet instance can be found in OSRM.Map.js along with other initializations that are probably not needed for you.
Route display is done in a more complicaed fashion as we want also provide interactivity. But at its core a route is a Leaflet polyline with some wrappings around it. You can find the data structure in OSRM.Route.js.
For parsing the output returned by the server component, take a look at OSRM.Routing.js. The showRoute routine is called as a JSON response. It in turn calls a routine in OSRM.RoutingGeometry.js to decode the geometry.
I would like to show a route after the user click on a button or a link. In my case the user can choose the departure and then my application will find the closest place from it that are in my database. On this database I have the gps coordinates. This way I would have a link for each place that show a map with the route between the departure and the place. I modified the files so now markers can be placed at the beginning and the route is shown but yes I wanted to make it without modifying files but as you said the web frontend wasn't built with that in mind.
Thanks for you response, and I will see if a simple leaflet map could be a better solution.