CloudMade/Leaflet — Issue #474: latLngToLayerPoint giving incorrect values
Author: jacobtoye
Created: 2012-02-09 02:37:43+00:00
State: open

I am trying to convert a lat lng to the screen relative pixel position. I assume that map method ```latLngLayerPoint``` would do this. For the initial load it would be perfect, however after panning the map the returned Point does not change. I would expect this to change by the offset.

Am I using this method for the wrong purpose?

Looking into the code it seems that ```latLngLayerPoint``` is using ```_initialTopLeftPoint```.. This variable is only updated when the view is reset.

I also notice that ```_getTopLeftPoint``` (line 600) is subtracting the map pane's offset. Should ```latLngLayerPoint``` be updated to also subtract the same offset?

At the moment I am using:

```map.project(new L.LatLng(lat, lng)).round().subtract(map._getTopLeftPoint());```

I would prefer to use one of the public methods.