[OpenLayers-Users] the right way to get lon/lat from pixel

Andreas Hocevar ahocevar at opengeo.org
Tue Jan 10 05:10:57 EST 2012


[B] is the right way to do it - it uses an API function, whereas [A]
uses an internal function.

On Mon, Jan 9, 2012 at 8:54 PM, Puneet Kishor <punk.kish at gmail.com> wrote:
> I was using the following code without any errors
>
>    [A]
>
>    var lonlat = map
>        .getLonLatFromViewPortPx(e.xy)
>        .transform(proj.google, proj.latlng);
>
> however, I can't find any reference to the above methods anymore in the API docs. On the other hand, I found the following commands, so I changed my code accordingly
>
>    [B]
>
>    var lonlat = map
>        .getLonLatFromPixel( this.events.getMousePosition(e) ).
>        .transform(proj.google, proj.latlng);
>
> The above works well too, but I just want to confirm if [B] is indeed the way to do it, and if the method in [A] is deprecated.
>
> --
> Puneet Kishor_______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list