2013-07-29 55 views
-1

我想仅显示来自1个文件夹的地标,点击第一个控件时,第二个文件夹=第二个控件。第二个问题,即谷歌API使用样式只适用,当他们以外的文件夹标签仅在1个特定文件夹中显示地标

我的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库解决了问题

+0

有问题吗?或只是投诉? – geocodezip

+0

问题是:如何仅在1个特定文件夹中显示地标 – vlukham

+0

请更新您的问题,使其更明显。您是否调查过任何第三方KML解析器([像geoxml-v3](http://www.geocodezip.com/geoxml3_test/v3_geoxml-v3_KmlFolders.html))? – geocodezip

回答

0

这不适用于使用Google Maps JavaScript API v3 KmlLayer,您可以使用第三方解析器geoxml-v3来做到这一点。

相关问题