2

From the Google Maps API, I see the getFeatureStyle function, but that requires you to pass in a feature ID. I want to change the fill/stroke opacity of the whole layer. Is this possible?

Was looking here, and tried to play around with the layer object, the only interesting functions were the set/get, which I think set arbitrary properties. Apart from that I see no way to do that, or even loop through all the features to toggle each one, which would be slow..

Here's the API.

knownasilya
  • 5,998
  • 4
  • 36
  • 59
  • I'm with you, @Knownasilya. We're looking for [similar things](http://stackoverflow.com/questions/22789669/google-maps-api-and-dynamicmapsenginelayer-loop-over-features-in-the-map). The way I see it, the `DynamicMapsEngineLayer` renders features in the client, so they have to be there somewhere. Right? – elrobis Apr 01 '14 at 18:53
  • Looks like there really is no way at the moment, but improvements are sure to come for GME integration with GMaps. – knownasilya Apr 01 '14 at 19:33

1 Answers1

0

There's no way to change the attributes of the entire layer at once. However, you can just iterate through all the features, which is pretty fast; I've got an app (not public yet, alas) that changes the appearance of 50+ very complicated coastline polygons at once, and the change is pretty much instant.

The other option would be to use GeoJSON, in particular the declarative style rules; then you can just change the values in the JSON and the display will update accordingly. You can read GeoJSON directly from the Maps Engine API.

lambshaanxy
  • 22,552
  • 10
  • 68
  • 92
  • In relation to GME, GeoJSON does not apply, also iterating over the features is fine, as long as you have a small amount. It's not as realistic for 1000+ features. – knownasilya Apr 04 '14 at 01:32
  • Hmm? You can read GME data into GeoJSON for rendering, see the link and demo above. – lambshaanxy Apr 04 '14 at 03:17