【发布时间】:2015-09-18 18:02:17
【问题描述】:
我对 KML 和 Google Maps Web API 有疑问。 如果我在 IconStyle 标签中使用颜色标签,则标记不会显示在地图上。 如果我删除颜色标签,它会显示在地图上。 我确信 KML 直到 2-3 个月前都可以正常工作。
这是我的 KML 文件:
<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://www.opengis.net/kml/2.2'>
<Document>
<name>MAP</name>
<description><![CDATA[]]></description>
<Folder>
<name>MAP</name>
<Placemark>
<styleUrl>#icon-961-62AF44</styleUrl>
<name>BLA BLA BLA</name>
<description><![CDATA[DESCRIPTION BLA BLA BLA]]></description>
<Point>
<coordinates>12.429284000000052,41.899191,0.0</coordinates>
</Point>
</Placemark>
</Folder>
<Style id='icon-961-62AF44'>
<IconStyle>
<color>ff44AF62</color>
<scale>1.1</scale>
<Icon>
<href>http://www.gstatic.com/mapspro/images/stock/961-wht-square-blank.png</href>
</Icon>
</IconStyle>
</Style>
</Document>
</kml>
这是我的javascript:
<script>
var map;
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(41.7,12.6),
zoom: 9
};
map = new google.maps.Map(document.getElementById("map"), mapOptions);
var ctaLayer = new google.maps.KmlLayer('http://test.com/test.kml', {preserveViewport: true});
ctaLayer.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
有什么建议吗? 谢谢。
【问题讨论】:
标签: javascript api google-maps kml