Fusion Table + Google Maps

2019-09-16 18:07发布

问题:

So I have a fusion table and I can map it out. However, I'd like to know how to make it so that if I click on a specific page, the map will just show that specific place.

To make it clearer, it's similar to what Yelp is doing.

So if I search a local business, and I see the page, Yelp have that business on Google Map, zoomed in.

Another example: http://alamatku.com/direktori/united-parcel-service-inc-ups) - Here you can see that the map is specifically located for UPS.

I'd like to do something like this but I can't find a way. Anybody can help me perhaps? =D

Thank you so much in advance!

回答1:

Here is an excelent example of querying the table with javascript. http://geochalkboard.wordpress.com/2011/05/19/adding-a-fusion-table-to-google-maps/



回答2:

Fusion table has an SQL API which allows you to 'select' or 'query' table and the result of which you can use with google maps api. Go to this link for more details :

Google Fusion Tables API



回答3:

While editing the table under Visualize > Map, click the 'options' link beside 'Showing all rows'.

Then create a filter for the row you want to find, 'id = 1234' for example. Click apply. This should filter the demo map to just one element.

Now, click the 'Get embeddable link' link. That should provide you with an embeddable code that you can edit. Should look something like this (note that I've masked my table id to #######):

<iframe width="500" height="300" scrolling="no"  src="https://www.google.com/fusiontables/embedviz?viz=MAP&q=select+col4+from+#######+where+col0+%3D+'1234'&h=false&lat=42.90790860608937&lng=-78.84992963798828&z=7&t=1&l=col4"></iframe>

The important part for you is to find the filter condition:

where+col0+%3D+'1234'

This is what you want to edit when generating a link for different places. For instance in my case I would change '1234' to whatever id I've stored for my place.

Hopefully this steers you in the right direction. If you're using the javascript Google Maps API then there are other ways to do this.