我只想在单击第一个控件时仅显示一个文件夹中的地标,第二个文件夹 = 第二个控件。第二个问题,当它们在文件夹标签之外时,google api 仅适用于样式
我的 KML 看起来像
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Folder id="Fusiontables1">
<name>Fusiontables folder1</name>
<Style id="cameraIcon1">
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
<IconStyle>
<Icon>
<href>http://www.google.com/help/hc/images/maps_camera.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name><![CDATA[Sydney]]></name>
<styleUrl>#cameraIcon</styleUrl>
<description>
<![CDATA[<br><b>Name</b>: Sydney<br><b>Location</b>: -33.936293,151.165388]]>
</description>
<Point>
<coordinates>
151.165388,-33.936293,0
</coordinates>
</Point>
</Placemark>
</Folder>
<Folder id="Fusiontables2">
<name>Fusiontables folder2</name>
<Style id="cameraIcon2">
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
<IconStyle>
<Icon>
<href>http://www.google.com/help/hc/images/maps_camera.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name><![CDATA[Bondi beach]]></name>
<styleUrl>#cameraIcon2</styleUrl>
<description>
<![CDATA[<br><b>Name</b>: Bondi beach<br><b>Location</b>: -33.891813,151.273160]]>
</description>
<Point>
<coordinates>
151.27316,-33.891813,0
</coordinates>
</Point>
</Placemark>
</Folder>
</Document>
</kml>
这个js显示了所有地标,但我只需要一个
kmlLayer = new google.maps.KmlLayer(kmlUrl, {
preserveViewport: true,
suppressInfoWindows: false
});
UPD。geoxml库解决问题