Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers 3

Fusion Layer Control

    function updateHeatmap() {
  var heatmap = document.getElementById('heatmap');
  layer.setOptions({
    heatmap: {
      enabled: heatmap.checked
    }
  });

Official Example with code: http://gmaps-samples.googlecode.com/svn/trunk/fusiontables/heatmap.html

share|improve this answer
    
Thanks, but that seems to toggle the layer between points/heatmap, not to toggle visibility? see FusionTablesLayerOptions –  Stephen Lead Nov 30 '11 at 20:14
add comment
up vote 1 down vote accepted

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.

share|improve this answer
add comment

I've found this.

https://sites.google.com/site/wildcardstestsite/home Check out the xml file which in this case is used in a blog as a module. use the html and javascript of this file and you have a working example of 2 layers on and off capabilities. Also I need to point out that only 5 fusion tables layers can be uses due to google limitations. I have not tried it with more in the javascript code to see what happens but I'm pretty sure if you add more than 5 on the list the 6th won't appear.

So it would be a great thing to add a limitation in the list. You could have for example 10 layers but only 5 can be loaded every time.

Hope this helps because it sure helped me.

share|improve this answer
    
that's a great resource - thanks very much for sharing –  Stephen Lead Dec 11 '11 at 22:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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