+ },
+
+ _read_gxcoords: function (el) {
+ var text = '', coords = [];
+ text = el.firstChild.nodeValue.split(' ');
+ coords.push(new L.LatLng(text[1], text[0]));
+ return coords;
+ },
+
+ parseGroundOverlay: function (xml) {
+ var latlonbox = xml.getElementsByTagName('LatLonBox')[0];
+ var bounds = new L.LatLngBounds(
+ [
+ latlonbox.getElementsByTagName('south')[0].childNodes[0].nodeValue,
+ latlonbox.getElementsByTagName('west')[0].childNodes[0].nodeValue
+ ],
+ [
+ latlonbox.getElementsByTagName('north')[0].childNodes[0].nodeValue,
+ latlonbox.getElementsByTagName('east')[0].childNodes[0].nodeValue
+ ]
+ );
+ var attributes = {Icon: true, href: true, color: true};
+ function _parse(xml) {
+ var options = {}, ioptions = {};
+ for (var i = 0; i < xml.childNodes.length; i++) {
+ var e = xml.childNodes[i];
+ var key = e.tagName;
+ if (!attributes[key]) { continue; }
+ var value = e.childNodes[0].nodeValue;
+ if (key === 'Icon') {
+ ioptions = _parse(e);
+ if (ioptions.href) { options.href = ioptions.href; }
+ } else if (key === 'href') {
+ options.href = value;
+ } else if (key === 'color') {
+ options.opacity = parseInt(value.substring(0, 2), 16) / 255.0;
+ options.color = '#' + value.substring(6, 8) + value.substring(4, 6) + value.substring(2, 4);
+ }
+ }
+ return options;
+ }
+ var options = {};
+ options = _parse(xml);
+ if (latlonbox.getElementsByTagName('rotation')[0] !== undefined) {
+ var rotation = latlonbox.getElementsByTagName('rotation')[0].childNodes[0].nodeValue;
+ options.rotation = parseFloat(rotation);
+ }
+ return new L.RotatedImageOverlay(options.href, bounds, {opacity: options.opacity, angle: options.rotation});