[Routing] OpenLayers, KML: how to display route?

Jav Doorn jvdoorn2003 at yahoo.de
Wed Feb 18 11:53:40 GMT 2009


Hello,

I am working on a Openstreetmap project which includes routing. I can draw a
map:

map = new OpenLayers.Map( $('map'), {controls: [] } );
layerTilesAtHome = new OpenLayers.Layer.OSM.Osmarender("Osmarender"); 
map.addLayer(layerTilesAtHome); 

The map is drawn correctly.

Next I need to draw a route that is contained in a KML file:

var kmlFeedUrl =
"http://www.yournavigation.org/gosmore.php?flat=52.215676&flon=5.963946&tlat=52.2573&tlon=6.1799&v=motorcar&fast=1&layer=mapnik"

kmlLayer = new OpenLayers.Layer.GML("KML", kmlFeedUrl, {
      projection: new OpenLayers.Projection("EPSG:4326"),
                      format: OpenLayers.Format.KML,
                      formatOptions: {
                        extractStyles: true,
                        extractAttributes: true
                        }
      });

map.addLayer(kmlLayer);

I can step through this code in the debugger without errors in these
particular lines.
As you can see, the url returns a KML file.
Later I get the error ‘access denied’. The map is drawn anyway but no route
is displayed.

Can anybody help?


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/routing/attachments/20090218/81c6c3a8/attachment.html>


More information about the Routing mailing list