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

Lambertus osm at na1400.info
Sun Feb 22 11:09:32 GMT 2009


A webbrowser does not allow you to do cross site AJAX calls. You will 
need to setup a local proxy on your webserver who relais the 
yournavigation.org queries.


Jav Doorn wrote:
> 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?
> 
> 
>       
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Routing mailing list
> Routing at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/routing





More information about the Routing mailing list