Creating fixed map view to show multiple routes to same destinations

I’d like to be able to plot multiple routes to our schools. I know the APIs don’t support multiple routes in a single request, so I was going to make multiple requests and layer them on top of each other. However, each request has a different view of the map, so layering isn’t possible. Can I fix the zoom level and area of the map view to keep this constant as I plot different routes?

Hi @DevMcom

I am not sure if I understood your question, specially when you said that “each request has a different view of the map”. The request would be run by your code and the response of ORS API will contain the route data. You can combine the data of multiple routes (with your code) and display all them in a single map view. The zoom level is defined by the code/libraries you are using to display the route data. Usually the libraries used to render geodata, like Leaflet, has the concept of fit bounds, what makes the zoom level to be adjusted to show all the features on the map.

Hi there… thanks for getting back to me… to clarify: if I run your directions service multiple times for all of the different starting points with the same end point for a specific school - I’ll get many map images back with the route shown from the student’s home to the school. The map image will be dependent on the starting point. I understand you’re suggesting I use the route data from your service to create a series of routes and use something like leaflet to display them on a single map. I am curious if there is a way to do this within your environment? Alternatively, I wanted to compute all the individual routes using your service on a “fixed map” so that I could simply overlay the images. Is that possible?


Hi there @DevMcom

The ORS API does not return map images. The JSON below is a simplification of an example of a route data returned by the API:


The ORS API does not support the request of multiple routes at once. You have then to perform multiple requests and use some basic programming + libraries to display this data in a map view. But be aware that even if the API supported a multiple routes request, it would still return the route data, and not map view/images. You would still have to use some basic programming + libraries to display this data in a map view.