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

Puneet Kishor punk.kish at gmail.com
Mon Jan 9 14:54:58 EST 2012


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


More information about the Users mailing list