1

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?

5
  • Accepted Answer is here: stackoverflow.com/questions/11955644/… answered by Geocodezip
    – Mapperz
    Commented Feb 25, 2013 at 20:57
  • I'd recommend moving this over to stackoverflow.
    – danagerous
    Commented Feb 25, 2013 at 21:53
  • @Mapperz: its not an answer to my question... kmllayer is not fusiontablelayer
    – DemarsM
    Commented Feb 26, 2013 at 15:37
  • You can Centre the fusiontablelayer - stackoverflow.com/questions/8434685/…
    – Mapperz
    Commented Feb 26, 2013 at 15:44
  • As I said, this method works only with markers fusiontablelayer. Not KML polygon loaded in fusiontablelayer...
    – DemarsM
    Commented Feb 26, 2013 at 15:49

1 Answer 1

4

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.

7
  • Thank you for your answer, it works for me. However, have you found a way to have the extent of all rows/features of the kml and not only one at a time in order to have the bounds of the entire table?
    – DemarsM
    Commented Feb 26, 2013 at 20:56
  • @DemarsM. Fusion Tables uses the ST_INTERSECTS to find map features within a defined area. This may work. I have not tested it myself. I need to do the same for some of my queries so I will give this a try soon. I thought it was deprecated but apparently it is not. Failing that I would think that creating a KML that is a 'box' containing your area and adding to the table may work for your selection(s). Another possibility is parsing the rows necessary to capture the entire area. These are just guesses/suggestions at this point.
    – danagerous
    Commented Feb 27, 2013 at 22:55
  • I dont know about ST_INTERSECTS. If you can do something interresting with that let me know. However, take a look a the second example, the one with line/arc. It shows how to zoom on the entire kml using union(). It works with polygon kml too.
    – DemarsM
    Commented Mar 1, 2013 at 1:02
  • Thanks for pointing that out. I totally missed that (or more like was not looking for it at the time). I'll give it a try. Cheers.
    – danagerous
    Commented Mar 1, 2013 at 19:24
  • any code snippet for the union solution you can post here? thx Commented May 19, 2013 at 3:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.