[OpenLayers-Users] Move listener curious behaviour

Tobias Reinicke ramotswa at gmail.com
Tue Jan 31 09:18:58 EST 2012


Thanks Andreas.

Toby



On 31 January 2012 14:15, Andreas Hocevar <ahocevar at opengeo.org> wrote:
> Hi,
>
> getLonLatFromLayerPx is an internal function that does not what you
> want and should not be used by applications. Try getLonLatFromPixel
> instead.
>
> Andreas.
>
> On Tue, Jan 31, 2012 at 3:05 PM, Tobias Reinicke <ramotswa at gmail.com> wrote:
>> Hello all,
>>
>> I have spotted some curious behaviour with the move listener on the
>> map object. (using OL 2.11).
>>
>> The code is pretty simple..
>>
>> map = new OpenLayers.Map({
>>    controls: [new OpenLayers.Control.Navigation() ],
>>    div: "map",
>>    eventListeners: {
>>        "move": updateCoord
>>    }
>>
>> });
>>
>> and the updatecoord function is just this:
>>   function updateMap() {
>>                 var tlPixel = new OpenLayers.Pixel(10,10);
>>                var tl = map.getLonLatFromLayerPx(tlPixel);
>>                document.getElementById('output').innerHTML = tl.toString();
>> }
>>
>>
>> The problem I'm seeing is that the coordinates are only updated every
>> time I zoom, rather than everytime I pan / drag etc...
>>
>> Any ideas?
>>
>> Thanks,
>>
>> Toby
>> _______________________________________________
>> 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