Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

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

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
    
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 Feb 26 '13 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 Feb 27 '13 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 Mar 1 '13 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 Mar 1 '13 at 19:24
    
any code snippet for the union solution you can post here? thx –  Val Neekman May 19 '13 at 3:14
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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