1

I would like to add this KML-link from Google Maps to an OpenLayers Layer instance.

The following code is not working:

var layer = new OpenLayers.Layer.GML("KML", 
    "https://maps.google.de/maps/ms?authuser=0&  
      vps=2&hl=de&
      ie=UTF8&
      msa=0&
      output=kml&
      msid=203149634091768565111.0004cf65c9b03cc8ae76c", 
      {
        format: OpenLayers.Format.KML,
        formatOptions: {
          'extractStyles': true
        }
});

1 Answer 1

1

You should put the kml on the server and link to the file. Like this:

var layer = new OpenLayers.Layer.GML("KML", "kml/lines.kml", {
   format: OpenLayers.Format.KML
})
map.addLayer(layer);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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