[OpenLayers-Users] getLonLatFromPixel in IE

Frank Broniewski brfr at metrico.lu
Tue May 25 09:44:27 EDT 2010


Hi,

well obviously you can't pass any arguments to an event function (in 
IE). The function only has access to window.event. You can do

function coords(event) {
		var xy = event.object.getLonLatFromViewPortPx(event.xy);
		var x = xy.lon;
		var y = xy.lat;
		...
}

if you enable the console in IE8, you can do inside the event function: 
console.log(event) to see what you get

Frank



Am 25.05.2010 15:17, schrieb Luís de Sousa:
> Hi Frank,
>
> Thank you for your help, but the problem isn't registering the listener,
> but the argument IE is passing to it. The object with which the
> showCoords function is invoked seems to null, so the .xy property
> generates an error.
>
> Thanks,
>
> Luís
>
>
> On Tue, May 25, 2010 at 12:17 PM, Frank Broniewski <brfr at metrico.lu
> <mailto:brfr at metrico.lu>> wrote:
>
>     Hi,
>
>     I use
>     map = new OpenLayers.Map(map_div);
>     ...
>     map.events.register("click", map, showCoords);
>
>     where showCoords the function for display is. Alternatively see
>     http://dev.openlayers.org/releases/OpenLayers-2.9.1/examples/events.html
>     for an alternate example
>
>
>     Frank
>


-- 
Frank BRONIEWSKI

METRICO s.à r.l.
géomètres
technologies d'information géographique
rue des Romains 36
L-5433 NIEDERDONVEN

tél.: +352 26 74 94 - 28
fax.: +352 26 74 94 99
http://www.metrico.lu



More information about the Users mailing list