[OpenLayers-Dev] BUG: OpenLayers.LonLat.Lon - only with IE 6

Erik Uzureau erik.uzureau at metacarta.com
Wed Mar 14 19:04:47 EDT 2007


Yes Hi Richard,
On brief further investigation, chris's insight is the key. You have
to use the standard openlayers events object registering if you want
ot use the .xy property.

If you see this demo in ie6 it does work:
http://openlayers.org/dev/examples/click.html

What you need to do is register your map clicked function like this:

            map.events.register("click", map, function(e) {
                var lonlat = map.getLonLatFromViewPortPx(e.xy);
                alert("You clicked near " + lonlat.lat + " N, " +
                                          + lonlat.lon + " E");
            });

Not sure offhand *why* it should be still working in FF or other ie's
but at any rate, this
should for sure clear up the problem.

Let us know if this isn't the case
erik

On 3/14/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> On Wed, Mar 14, 2007 at 09:20:14PM -0000, Richard Thurbin wrote:
> > Sorry, I don't know if this is the right way to use this... I would like to
> > report a bug I have found when using the OpenLayers API.
> >
> > I have searched the FAQ, Wiki engine, current tickets, Google and have not
> > found any reference to this.
>
> I don't have an easy answer for you, but typically the best way to
> register map events is using the map.events.register() call, as in the
> click.html example:
>
>   http://openlayers.org/dev/examples/click.html
>
> Erik's expressed an interest in this, and I've already pointed him to
> the demo which displays the problem.
>
> So, in the meantime, you can change your code to use map.events.register
> as in click.html instead of OpenLayers.Event.observe.
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>



More information about the Dev mailing list