[OpenLayers-Users] Finding lat/long of map click on feature
eric.c2c at gmail.com
Sat Feb 28 04:07:52 EST 2009
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.
2009/2/28, plen <peteralen at earthlink.net>:
> 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
> 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:
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> Users mailing list
> Users at openlayers.org
Envoyé avec mon mobile
More information about the Users