2

Is there any way to set the ZIndex of a Google Fusion Table layer in the Google Maps API? I have several Fusion layers added as overlays to a map with the ability to turn them on and off. I want certain layers to always be ontop if they are on, however Fusion Tables/Google Maps just renders them in the order that they are drawn.

For example:

Layer 1 starts On. Layer 2 starts Off. Layer 2 should Always be on top if it is being shown.

Click Layer 2 On, and it is on top.
Now, click Layer 1 Off and the On again, and now it is on top as it is the most recent layer drawn.

I'd ideally like to set the ZIndex of Layer 2 to higher than Layer 1 so that it is always on top, but there doesn't seem to be a way to do this. Any ideas?

2
  • Did you find a solution to this problem? I have the same inquiry. I have multiple KML layers with one Google Fusion Table layer (point). When I click on the google fusion table layer points, I get the InfoWindow of the KML polygon layers rested on the same place.
    – Toronto23
    Commented Jun 2, 2015 at 18:13
  • I moved on to Leaflet maps. The link that @hugh gave references the fact that is implemented now. FYI - your "answer" should have been a comment on the main question, since it isn't really an answer.
    – Josh
    Commented Jun 2, 2015 at 18:17

1 Answer 1

1

I don't see a method for doing this in the Google Maps API v3 reference, and that lack appears to be confirmed by this comment from a Google employee:

https://groups.google.com/d/msg/google-maps-js-api-v3/ovT1ekQ-HGQ/k-b8BSxCCjAJ

FusionTablesLayer (and KmlLayer & co) don't have the ability to re-order based on z-index.

There is an active feature request for adding sorting by Z-Index for KML layers here: http://code.google.com/p/gmaps-api-issues/issues/detail?id=2804

I am not aware of a corresponding feature request for FusionTableLayer objects, although perhaps the solving of one would facilitate the solving of the other.

2
  • 1
    I've worked around this with some clunky code to associate each possible layer with a Z value, then whenever a layer is added check which currently active layers have a higher Z value, delete them and redraw them in order. Which is obviously inefficient. Commented May 30, 2012 at 18:26
  • In the mean time, this has been added for kml layers, but not yet for fusion table layers. I created a new feature request for this: code.google.com/p/gmaps-api-issues/issues/detail?id=8869 Commented Nov 9, 2015 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.