I've created this map -- https://s3.amazonaws.com/pdb.files/lookup_auto2.html -- using Google Fusion Tables and Google Maps API. I'm attempting to modify the code so that the map will pan and zoom after executing the query. It seems that I need to use either the fitBounds function to display the bounds of the results, or something simpler like this:

// Change the center and zoom of the map

I'd prefer the second option so that I can set a consistent zoom level for each query. Any pointers or references for completing this are much appreciated.

1 Answer 1


Add a spatial search to your code:

FUSION TABLES allows ST_INTERSECT to be performed full reference: http://code.google.com/apis/fusiontables/docs/developers_reference.html#Select (see <spatial_condition> )

      // OPTIONAL: find the new map bounds, and run a spatial query to return
  // Fusion Tables results within those bounds. 
  sw = map.getBounds().getSouthWest();
  ne = map.getBounds().getNorthEast();
    query: {
      select: 'lat',
      from: tableid,
      where: "ST_INTERSECTS(lat, RECTANGLE(LATLNG(" + sw.lat() + "," + sw.lng() + "), LATLNG(" + ne.lat() + "," + ne.lng() + ")))"

Full code: http://gmaps-samples.googlecode.com/svn/trunk/fusiontables/search_and_zoom.html (view source)

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.