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

plen peteralen at earthlink.net
Fri Feb 27 20:20:11 EST 2009


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.




More information about the Users mailing list