OpenStreetMap

Routing in cdauth’s map

Posted by Candid Dauth on 15 March 2010 in English.

I have added experimental routing support to my map. I am using the YOURS API to calculate the routes and try to provide an easy user interface that is similar to Google’s. You can drag and drop the route start and end point and also drag parts of the route to create Via points. It works pretty well (only tested on Firefox so far), but a few bugs still occurr some time.

You can try it out on http://osm.cdauth.de/map-routing/. Please be aware that this is a temporary URL, normally you can access my map on http://osm.cdauth.de/map/.

If you want to try this in your own map, include the JavaScript file http://osm.cdauth.de/map-routing/prototypes.js (remember: this is a temporary URL) and use the following code:

var layerRouting = new OpenLayers.Layer.cdauth.XML.Routing("Routing");
map.addLayer(layerRouting);
layerRouting.setType(OpenLayers.Layer.cdauth.XML.Routing.Type.FASTEST);
layerRouting.setMedium(OpenLayers.Layer.cdauth.XML.Routing.Medium.CAR);
layerRouting.setFrom(new OpenLayers.LonLat(5.963946, 52.215676));
layerRouting.setTo(new OpenLayers.LonLat(6.1799, 52.2573));

The drag’n’drop will work automatically.

Discussion

Comment from ianlopez1115 on 15 March 2010 at 02:24

It also works on IE7 as well (sort of)

Log in to leave a comment