我想在点击第一个控件,第二个文件夹=第二个控件时只显示1个文件夹中的地标。第二个问题,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库解决了这个问题