I am trying to figure out how open layers converts a screen co ordinate into
latitudes and longitudes. To figure it out I downloaded version 1 of open
layers(for ease of reading due to less lines of code) and found the
following function:
getLatLonFromPoint: function (point) {
var center = this.getCenter(); //map center lat/lon
var res = this.getResolution();
var size = this.getSize();
var delta_x = point.x - (size.w / 2);
var delta_y = point.y - (size.h / 2);
return new OpenLayers.LatLon(
center.lat - delta_y * res,
center.lon + delta_x * res );
}
In the latest version this has changed a bit but the logic remains the same.
Can someone please let me know how this works. I searched for ways to
convert a screen co ordinate to latitude and longitude and stumbled upon a
couple of them. But, none of them seem to match what open layers is doing.
--
Cheers,
Abhi
_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev