[OpenLayers-Users] LonLat capture from click problem with IE zoom

Tara Athan taraathan at gmail.com
Mon May 4 17:03:58 EDT 2009


I am reposting this because it somehow got linked with an existing 
thread, rather than starting a new one.
------------------------------------------------------------------------------------------------------------
Sometime ago, about a year I think, I built an OpenLayers page to 
capture a mouse click as lon-lat and pass it to a form. I could swear 
that I tested it in IE as well as Firefox, although Firefox is what I 
normally use. I was just looking at the site in these two browsers and 
it is still working fine in Firefox, but there is a glitch in IE (the 
"latest" version, whatever that is- it appears to be impossible to 
actually figure that out from the browser window). A click event causes 
a marker and pop-up window to be displayed - in IE the marker is 
displaced from the click location if [CTRL+] or {CTRL-] have been used 
to adjust the zoom level of the webpage. The lon-lat values actually 
agree with the marker location, not the original click location. I 
checked on the OpenLayers website and found some code for handling click 
events that was somewhat different than the sample code that I had 
followed when I first built the site, but there was no change in the 
problem.

The pages are given by URLs
http://www.alt2is.com/imcwma/copy/php/weedpoints_database/map/index7.php
and
http://www.alt2is.com/imcwma/copy/php/weedpoints_database/map/index7b.php 
(the modified version based on newer example)

The code involved in setting the lon-lat object is:

var lonlat = map.getLonLatFromPixel(new OpenLayers.Pixel(evt.xy.x , 
evt.xy.y) );

OR

var lonlat = map.getLonLatFromViewPortPx(e.xy);

Is there some way to get this operation to be robust to the IE zoom level?

Thanks, Tara



More information about the Users mailing list