I am using the following sample code to embed a Google Fusion Tables map:
function initialize() {
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(37.4, -122.1),
zoom: 10,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'Address',
from: // My table id,
},
map: map
});
}
google.maps.event.addDomListener(window, 'load', initialize);
You can see from the above code that the "center" is set to a specific long and lat. If I remove the "center" property, it does not render the map at all.
I am looking at some way to automatically determine the best location to center in on. I believe using just general Google Maps that you can determine the boundaries of the location markers and center in on that? So maybe there is a way to get the list of locations from the table and then working out the boundaries from there?
Note: I understand there are other options for embedding the map, such as an iframe, but iframe is not an option for us in this project. Further, I understand that you can take the HTML/JS from the "Publish" option within the Fusion table, but the requirement is for the user to be able to embed the map with only the table id so they cannot copy/paste any HTML/JS.