[GIS] Google Maps – Use fitBounds on KML polygon fusion table layer

google-fusion-tablesgoogle-maps-api

I have seen example here how to use map.fitBounds on fusiontablelayer
here and here , but I think it works with markers table only. Its impossible to parse the lat and long when the vertex coordinates are in the geometry column as in a kml polygon layer.

Is there a solution to use fitBounds or other function to zoom to the extent of a kml polygon fusion table layer?

Best Answer

Yes. You are correct. Currently the functionality to zoom/fit bounds does not exist for polygon or line data from fusion tables. You will need to use the GVIZ (Google Visualization API) and the geoxml3 parser. I used some of the code from the following applications. One is a polygon example and the other is a line/arc example.

There is a post in the Google Fusion Tables group pointing out that the functionality is not there (yet). I had the same problem and I managed to get my application working recycling some of the code from the examples above. Hope it helps.

Update: Google Fusion Tables is being turned down in December 2019.

https://support.google.com/fusiontables/answer/9185417

Consider moving to GeoJSON for markers/lines and TopoJSON for complex polygons.

Related Question