问题描述
我正在使用KML文件在Google地图上覆盖我的数据。实际上,我想根据KML文件中的某些值更改标记颜色。
我该怎么做。首先,KML支持图标的样式,但是< color> 对于
< iconStyle>
,Maps-API不支持code> -element,因此您无法更改图标的颜色(请参阅了解更多详情)。
你可以做的是使用不同的图标图像与所需的颜色。
但afaik没有动态方式更改<图标>
的< href>
。然而,您可能会创建一个服务器端脚本来解析原始KML并将修改后的KML提供给Google。
I am using KML file to overlay my data on google map . Actually I want to change the marker color based on some value which in the KML file .
How can I do that .
First of all: KML supports the styling of icons, but the <color>
-element is not supported for <iconStyle>
by the Maps-API, so you cannot change the color of an Icon(see https://developers.google.com/kml/documentation/kmlelementsinmaps for more details).
What you can do is use different icon-images with the desired colors.
But afaik there is no "dynamic" way to change the <href>
of an <icon>
.
However, you may create a serverside script that parses the original KML and delivers a modified KML to google.
这篇关于基于KML文件中的值的标记的动态变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!