Google Earth Determining zoom level from bounding box?

The best place to find this kind of information is on the Google Earth Api Forum . That said the following active scripting method from there should be exactly what you need.

Up vote 5 down vote favorite 1 share g+ share fb share tw.

I got a Windows Forms app making use of Google Earth where users can draw a polygon on the map which is used as a geofence. What I'd like to do is to be able to zoom to the polygon so that it fits nicely on screen with a click of a button. A sort of zoom to fit function.

Finding the centre of the polygon and setting the Google Earth camera to that lat/long is easy. What I need is an algorithm that takes a bounding box of lats \ longs, screen height \ width and then determines the altitude to set the camera. Does anyone have this algorithm or know where one can be found?

Thanks! Geospatial google-earth computational-geometry google-earth-plugin link|improve this question edited Jul 19 '10 at 2:34Fraser3,5471621 asked Jul 14 '10 at 15:30Dominic26029 57% accept rate.

The best place to find this kind of information is on the Google Earth Api Forum. That said the following active scripting method from there should be exactly what you need. Function createCameraFromRectangle(plugin, lat1, lng1, lat2, lng2) { // Approx.

Radius of the earh. Var r = 6378700; // Field of view var fov = 32; var camera = plugin. CreateCamera(''); camera.

SetLatitude((lat1 + lat2) / 2.0); camera. SetLongitude((lng1 + lng2) / 2.0); camera. SetHeading(0.0); camera.

SetTilt(0.0); // determine if the rectangle is portrait or landscape var dy = Math. Max(lat1, lat2) - Math. Min(lat1, lat2); var dx = Math.

Max(lng1, lng2) - Math. Min(lng1, lng2); // find the longest side var d = Math. Max(dy, dx); // convert the longest side degrees to radians d = d * Math.

PI/180.0; // find half the chord length var dist = r * Math. Tan(d / 2); // get the altitude using the chord length var alt = dist/(Math. Tan(fov * Math.

PI / 180.0)); camera. SetAltitude(alt); return camera; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions