Search code examples
javascriptkmlgoogle-earthgoogle-earth-plugin

How to re-color polygon in KML file when styles use same id


I am trying to re-color polygons from a KML. I fetch it from a server, then use:

getFeatures().getChildNodes().items(n).getComputedStyle()

to manipulate the style, which works fine if there is no styleUrl element.

Some of the KMLs I want to load use the same styleUrl for all the polygons in the file, so changing one changes them all.

How can I add a unique styleUrl to each polygon, or better yet, change the style of an individual polygon?


Solution

  • Waht about getFeatures().getChildNodes().items(n).setStyleSelector?