Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to generate a route in openlayers with a start and end points and some points during track.

I read about openroute:

But I don't know how can I include it on my webpage. My idea is about to have a button which when you press it, it generate the route between all markers in map.

I want that possibility of download it would be available.

In openroute webpage you can introduce points and it generates the route but I don't find an api to see how I can introduce it on my webpage.

Do you know other way to generate route in openlayers?

share|improve this question
are you looking for some kind of webservice to do your ruting for you, or do you want to implement your own routing engine based on your own data? the topic of routing is not new her, check the routing tag: – atlefren Apr 23 '12 at 14:25
I don't want to create a routing engine. I just want to generate the route from any engine already created. – Biribu Apr 24 '12 at 7:36

there are some source on net when you googling. you can check following links for some information.

1.Graphserver - The open-source multi-modal trip planner.

2.pgRouting III: PHP + OpenLayers Interface

3.pgRouting 1.01 with OpenLayers 2.5 on Ubuntu 7.10

4.Getting the OpenLayers-Code for the Routing-application


if you search ready to use service of routing you can use ArcGIS Online locator and routing services. For some information you should read this. But you must know that you are restirected with European Routing and North American Routing.It has multi - language support.

For north Amerikan support the service details are there and when you want to use this you shoul write your details here

So from arcgis service you can add json result to openlayers in this way. i have my routing service on arcgis and i âm using this way for routing....

i hope it helps you

share|improve this answer
I checked your pages, thanks for them. I have something that I don't understand. I read that all road need an entry for specifying the start and end point. So, this mean that I have to set all streets in my map? I guess I am wrong, I think it is crazy trying to do that for one person. I downloaded the code of 4th page to try it but it didn't display any map. I set OpenLayers.js properly but still wrong. In my application, start and end point will always be the same. Just mid points can change. I edit: I found this post: I think, if – Biribu Apr 23 '12 at 14:10

Use OSRM. The transformation from its format and GeoJSON/features in OpenLayers is something you'll need to build on your own.

share|improve this answer
DO you know other way to do it? I downloaded osrm and spanish map from geofabrik. When I try to prepare the map, it tells me that there is not enough memory... – Biribu Apr 25 '12 at 14:45
Use the OSRM API and its server install, or get a server to run this kind of task. – tmcw Apr 25 '12 at 15:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.