6

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

2

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.

1

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.

  • that's a great resource - thanks very much for sharing – Stephen Lead Dec 11 '11 at 22:50
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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