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

I've created this map -- -- 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.

share|improve this question
up vote 1 down vote accepted

Add a spatial search to your code:

FUSION TABLES allows ST_INTERSECT to be performed full reference: (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.lng() + "), LATLNG(" + + "," + ne.lng() + ")))"

Full code: (view source)

share|improve this answer

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.