[OpenLayers-Dev] OpenLayers.getPixelFromLonLat don't return the correct values
ahocevar at opengeo.org
Wed May 15 04:56:20 PDT 2013
This is a matter of resolution. Think of a pixel and a geographic location
(o) inside the pixel:
| o |
This location is not in the center of the pixel. When you call
getPixelFromLonLat, you get the pixel in the above image. And when you then
call getLonLatFromPixel with the resulting pixel, you get the center of the
pixel as location:
| o |
This is the difference you're seeing, and there is no way to resolve it
other than doing this conversion at a resolution that is higher than your
desired accuracy of geographic coordinates.
On Tue, May 14, 2013 at 10:57 PM, waelinsat <waelinsat at gmail.com> wrote:
> Hi All;
> I just need some help. It seems like the OpenLayers.getPixelFromLonLat
> return a correct values, there's always a little difference.
> For example :
> map.getLonLatFromPixel( map.getPixelFromLonLat( new
> OpenLayers.LonLat(9.55,35.23) ) ) in a normal case returns the same
> which is (9.55,35.23) but this is not the result, i always had values like
> 9.59874, 35.60154 ... i know that it's not too far but i should resolve it.
> There 's any solution for this ?
> View this message in context:
> Sent from the OpenLayers Dev mailing list archive at Nabble.com.
> Dev mailing list
> Dev at lists.osgeo.org
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Dev