[OSM-talk] Mathematic genius needed

Bernhard zwischenbrugger bz at datenkueche.com
Mon Mar 22 03:20:20 GMT 2010


Hi all

Maybe that one is easy for someone out there, for me it's unsolvable.

I have
minlat, minlon, maxlat, maxlon
That describes an area in WGS84

The area should be placed on the screen.
To place it on the screen, I need the centerlat,centerlng and the zoomlevel.

To be shorter on that:

Given:
wgs84: minlat, minlon, maxlat, maxlon
screen: width, height

Needed:
lat,lng, center
---------

Hint:

At first you maybe think
centerLat = (minlat + matlat)/2;
centerLng = (minlng + matlng)/2;
could be the solution.

But that does not give the correct result.
The center must be the center in screen coordinates.


Bernhard




More information about the talk mailing list