我正在使用 jquery 插件 gmap3 并且正在使用 kmllayer。如何从 kml 获取标记?我需要按区域过滤标记
问问题
810 次
2 回答
1
var klms = [{"url":"http:\/\/example.com\/points_in_a_kml_file.kml"}];
if(klms){
$.each(klms, function(i, klms){
$('#map').gmap3({
action: 'addKmlLayer',
url: klms.url,
options:{
suppressInfoWindows: true,
preserveViewport: false
}
})
})
}
“points_in_a_kml_file.kml”:
<?xml version="1.0" encoding="UTF-8"?>
<Document>
<Style id="style0">
<IconStyle scale="0.181818">
<Icon>
<href>http://example.com/pin.png</href>
</Icon>
</IconStyle>
</Style>
<Folder>
<name>pulau_weh_point</name>
<Placemark>
<name>Mama's</name>
<description><![CDATA[Point's description]]></description>
<Point>
<coordinates>95.255227,5.875082,0.000000</coordinates>
</Point>
<styleUrl>#style0</styleUrl>
</Placemark>
</Folder>
</Document>
于 2013-06-18T09:41:26.937 回答