0
votes

I'm looking for something similar to google maps' "LatLngBounds" in Google Earth API , but I can't find one in the Google earth API Refrence.
I Need this to center the camera view on all the markers/placemarks placed and zoom to a proper level.
Is There is such thing? or do I need to do it myself?

1

1 Answers

1
votes

You might check out the Earth API Utility Library, specifically the computeBounds() function.

Note that it walks the KML DOM and sums over the bounds, so it might be rather slow depending on the number of objects you want to have in view, and it will be conservative when calculating that view, so the bounds may end up larger than is optimal. If you want to take what's there and customize it, though, the source code is right there for the taking.