Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I zoom a Google Maps control to fit the contents of a Fusion Table layer? The layer only contains pushpin / marker point data.

One method is to perform a REST query on the Fusion Table and to calculate the bounds, and zoom to these (i.e. as illustrated here: ). However this seems very inefficient - especially for larger datasets, because all of the table data has to be sent to the client and compared.

This question appears to ask the same query, but the answer does not apply. The answer simply queries the data for the current map extents. Nice and efficient, but the opposite of what I want. I want to zoom to display all available data.

share|improve this question
up vote 2 down vote accepted

You can get your all your table data and find the bounds from the response:

      var bounds = new google.maps.LatLngBounds();
  for(i = 0; i < numRows; i++) {
      var point = new google.maps.LatLng(
          parseFloat(response.getDataTable().getValue(i, 0)),
          parseFloat(response.getDataTable().getValue(i, 1)));
  // zoom to the bounds

This comes from a good example: and view source

share|improve this answer
Thanks for the quick reply. Although perhaps more elegant in the implementation, this is essentially the same approach as the Google sample. It queries all of the points and then calculates the bounds locally on the client. My customer has a lot of pushpin data (yes, I know...) so I would prefer a more efficient solution (eg. getting the bounds directly from Fusion) if possible. – winwaed Mar 15 '12 at 14:04
In the end, I had to use a variation of this. I used an AJAX call to my server to get the data and use it to set the bounds. – winwaed Sep 23 '14 at 15:25

Your Answer


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.