1
我有此KML文件:KML文件和自定義類?
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name>CDATA example</name>
<description>
<![CDATA[
<h1>CDATA Tags are useful!</h1>
<p><font color="red">Text is <i>more readable</i> and
<b>easier to write</b> when you can avoid using entity
references.</font></p>
]]>
</description>
<Point>
<coordinates>102.595626,14.996729</coordinates>
</Point>
</Placemark>
</Document>
</kml>
(來自谷歌地圖文檔拍攝的實施例) 當我一類添加到A HREF的KML的內部:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name>CDATA example</name>
<description>
<![CDATA[
<h1>CDATA Tags are useful!</h1>
<p><font color="red">Text is <i>more readable</i> and
<b>easier to write</b> when you can avoid using entity
references.<a class="read_more" href="http://google.com">Read More</a></font></p>
]]>
</description>
<Point>
<coordinates>102.595626,14.996729</coordinates>
</Point>
</Placemark>
</Document>
</kml>
的KML只是去掉它,我猜這是由於「內容洗刷」 https://developers.google.com/earth/documentation/balloons
這是我目前的javascript:
jQuery(document).ready(function($) {
function initialize() {
var myLatlng = new google.maps.LatLng(51.201465,-0.30244);
var mapOptions = {
zoom: 12,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var kmlLayer = new google.maps.KmlLayer({
url: 'http://*****.com/new/wp-content/themes/required-starter/KML_Samples.kml?rand='+(new Date()).valueOf(),
suppressInfoWindows: false,
map: map
});
google.maps.event.addListener(kmlLayer, 'click', function(kmlEvent) {
var text = kmlEvent.featureData.description;
alert(text);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
});
我無法找到正確的參數來停止數據清理或kml文檔中的選項將類添加到描述包裝器或氣泡。 我想這是由於我的勉強,請幫助! Chris