[OpenLayers-Users] Finding lat/long of map click on feature callback.. how?

Eric Lemoine eric.c2c at gmail.com
Sat Feb 28 04:07:52 EST 2009


Hi

In your click handler try selectControl.handlers.feature.down, this is
the pixel position of the last mousedown. Note that this "down"
property isn't an API property, so it can possibly be removed or
changed in future version of OpenLayers.

Cheers,

Eric

2009/2/28, plen <peteralen at earthlink.net>:
>
> Hello,
>
> I am using the OpenLayers drawing controls and have set up an event callback
> function for the select control so that when a user clicks on one of the
> drawn features, I can get a call to my "click" function.  The sole argument
> that comes in is the feature object.  This is the same for point, line, and
> polygon features.  When you set up a click event for the map, you can get
> viewport Px and then can get the lat/long coordinate from that.  This isn't
> the case from clicks from a feature select control. While I am getting the
> feature object that was clicked on and can get the feature's coordinates,
> what I also need is the coordinates for where the mouse click occured.  The
> reason for this is that I want to add a popup balloon.  The problem comes
> when a line or a polygon is clicked on.  With a line, for example, I can get
> the two endpoint coordinates, but I would rather show the popup balloon
> where the user clicked the line, rather than put the popup on one of the
> endpoints.
>
> Just looking to see if anyone knows how to find out where the user clicked
> on the map (either a lat/long or a viewport Px) from a click event on a
> select control (again, only the feature is sent to the function).
>
> Thanks - Peter Len
> --
> View this message in context:
> http://n2.nabble.com/Finding-lat-long-of-map-click-on-feature-callback..-how--tp2399111p2399111.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>

-- 
Envoyé avec mon mobile



More information about the Users mailing list