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. Andreas. On Tue, May 14, 2013 at 10:57 PM, waelinsat <waelin...@gmail.com> wrote: > Hi All; > > I just need some help. It seems like the OpenLayers.getPixelFromLonLat > don't > 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 > long/lat > 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 ? > > regards, > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/OpenLayers-getPixelFromLonLat-don-t-return-the-correct-values-tp5053241.html > Sent from the OpenLayers Dev mailing list archive at Nabble.com. > _______________________________________________ > Dev mailing list > d...@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/openlayers-dev > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers.
_______________________________________________ Dev mailing list d...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-dev