问题
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 .
回答1:
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.
来源:https://stackoverflow.com/questions/13494175/dynamic-change-of-marker-based-on-value-in-kml-file