[GIS] How to toggle Fusion Tables layer on/off based on map scale

google mapsgoogle-fusion-tables

In the Google Maps API v3 I'm displaying points derived from a Fusion Table by specifying a FusionTablesLayer

Is it possible to set a minimum/maximum scale on this layer, so it turns off when zooming out?

EDIT: I'm presuming that I'll need to listen to the map's zoom_changed event, and handle the visibility manually. But how can I change the visibility of a Fusion Tables layer?

A marker has the boolean property Visible and the method SetVisible() but I can't see an equivalent for a layer.

An overlay can have show/hide methods – do I need to build my Fusion Tables layer as an overlay? (I'm a Google Maps novice so I don't know much about overlays vs layers)

Thanks

Best Answer

This seems to work - it doesn't seem to be a problem to call setMap if it's already set:

google.maps.event.addListener(map, 'zoom_changed', function() {
    zoomLevel = map.getZoom();
    if (zoomLevel >= minZoomLevel) {
        FTlayer.setMap(map);
    } else {
        FTlayer.setMap(null);
    }
}); 

Thanks to Chris Broadfoot from the GM team for this tip.