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
map.setCenter(results[0].geometry.location);
map.setZoom(10);
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.
Best Answer
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>
)Full code: http://gmaps-samples.googlecode.com/svn/trunk/fusiontables/search_and_zoom.html (view source)