<div dir="ltr">This is a matter of resolution. Think of a pixel and a geographic location (o) inside the pixel:<div><br></div><div><font face="courier new, monospace"> -------</font></div><div><font face="courier new, monospace">|    o  |</font></div>
<div><font face="courier new, monospace">|       |</font></div><div><font face="courier new, monospace">|       |</font></div><div><font face="courier new, monospace"> -------</font></div><div><br></div><div>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:</div>
<div><br></div><div><div><font face="courier new, monospace"> -------</font></div><div><font face="courier new, monospace">|       |</font></div><div style><font face="courier new, monospace">|   o   |</font></div><div><font face="courier new, monospace">|       |</font></div>
<div><font face="courier new, monospace"> -------</font></div></div><div><font face="courier new, monospace"><br></font></div><div style><font face="arial, helvetica, sans-serif">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.</font></div>
<div style><font face="arial, helvetica, sans-serif"><br></font></div><div style><font face="arial, helvetica, sans-serif">Andreas.</font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 14, 2013 at 10:57 PM, waelinsat <span dir="ltr"><<a href="mailto:waelinsat@gmail.com" target="_blank">waelinsat@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All;<br>
<br>
I just need some help. It seems like the OpenLayers.getPixelFromLonLat don't<br>
return a correct values, there's always a little difference.<br>
<br>
For example :<br>
<br>
map.getLonLatFromPixel( map.getPixelFromLonLat( new<br>
OpenLayers.LonLat(9.55,35.23) ) ) in a normal case returns the same long/lat<br>
which is (9.55,35.23) but this is not the result, i always had values like<br>
9.59874, 35.60154 ... i know that it's not too far but i should resolve it.<br>
<br>
There 's any solution for this ?<br>
<br>
regards,<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/OpenLayers-getPixelFromLonLat-don-t-return-the-correct-values-tp5053241.html" target="_blank">http://osgeo-org.1560.x6.nabble.com/OpenLayers-getPixelFromLonLat-don-t-return-the-correct-values-tp5053241.html</a><br>

Sent from the OpenLayers Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@lists.osgeo.org">Dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Andreas Hocevar<br>OpenGeo - <a href="http://opengeo.org/">http://opengeo.org/</a><br>Expert service straight from the developers.<br>
</div>