谷歌地球:在图层列表中单击此地标后,是否可以更改地标的样式。默认情况下,如果你点击图层列表中的Placemark,Balooon (弹出窗口)将会在Placemark上打开。我也想改变风格。
谢谢
发布于 2015-07-07 21:21:27
KML允许使用StyleMap为给定的Placemark定义两组样式。
StyleMap允许您定义默认样式(正常)和高亮样式,当用户将鼠标悬停在地图上的要素上时,高亮样式将处于活动状态。
<Style id="normalState">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/paddle/A.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="highlightState">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/paddle/B.png</href>
</Icon>
</IconStyle>
</Style>
<StyleMap id="styleMapExample">
<Pair>
<key>normal</key>
<styleUrl>#normalState</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#highlightState</styleUrl>
</Pair>
</StyleMap>
这里有一个简单的例子,当你将鼠标悬停在图标上时,它会改变图标及其大小:
http://kml-samples.googlecode.com/svn/trunk/kml/Style/inline-stylemap.kml
https://stackoverflow.com/questions/31268250
复制相似问题