mariosk89
mariosk89

Reputation: 954

set a color to a KML layer (Google Web Toolkit)

I create some KML files in my project and I want to present on my map doing something like this

KmlLayer ctaLayer = KmlLayer.create("url to kml");
ctaLayer.setMap(map);

However I have three categories of kmls (regarding what they represent) and I want a different color for each category. How can I do this using GWT?

//I'm using google maps v3 for GWT

Upvotes: 1

Views: 564

Answers (2)

jonasr
jonasr

Reputation: 1876

You can't change the style of your KmlLayers once you've created them. But since you're creating the KML files yourself, you should try to use the Style tag. If you want to change the color of markers for example,

<Style id="myStyle">
    <IconStyle>
        <color>ff00ff00</color>
    </IconStyle>
</Style>

and then reference it with

<styleUrl>#myStyle</styleUrl>

I think you can also set styles for polygons if that's what's in your KML files.

Upvotes: 2

geocodezip
geocodezip

Reputation: 161324

You can't dynamically style a KmlLayer. You can import the kml into FusionTables and dynamically style a FusionTablesLayer.

Looks like GWT supports FusionTablesLayers

Upvotes: 1

Related Questions