[OpenLayers-Users] FW: Using OpenLayers.Format.KML in IE9

Andrew Miller a.miller at neath-porttalbot.gov.uk
Thu Apr 25 09:05:01 PDT 2013


I am trying to save a layer to KML using the OpenLayers.Format.KML class.  Here is my code:

var format = new OpenLayers.Format.KML();
var kml = document.createElementNS('http://earth.google.com/kml/2.0', 'kml');
var kml_folder = format.createFolderXML();
kml.appendChild(kml_folder);

var feature = format.createPlacemarkXML(DrawingLayer.features[0]);
kml_folder.appendChild(feature);

This works under Chrome and FireFox, but fails in IE9 with the following error:

"DOM Exception: HIERARCHY_REQUEST_ERR (3)"

It is the fourth line that is causing the error.  It seems that IE does not recognise kml_folder as a DOM Element.  Is there a way around this?

Thanks,

Andrew



More information about the Users mailing list