问题
I'm pretty much a rookie to using Google Fusion Tables/maps. We have a business directory with company names and addresses. I can get the geocoded map markers for each of their locations to display side by side with the Table "facility name" column. How do I code the facility names so the user can click the company/facility name and jump to the specific map marker info box for that facility in the map? Any help will be appreciated!
回答1:
Once the user clicks on the company name, you can create a new InfoWindow object manually. Then set it's position and content and finally put it on the map:
var map = new google.maps.Map(document.getElementById('map-canvas');
var infoWindow = new google.maps.InfoWindow();
var coordinates = new google.maps.LatLng(37.5, -122.1);
infoWindow.setPosition(coordinates);
infoWindow.setContent('Company/Facility XY');
infoWindow.open(map);
There is an InfoWindow example from Google, that even uses geocoding and a spatial query to get the closest hit from the database.
来源:https://stackoverflow.com/questions/11748211/google-fusion-tables-with-maps-link-table-field-to-map-info-window