I need to get the coordinate of the click when the user clicks on a vector feature on the OpenLayers map. The SelectControl only gives the feature that was clicked and not the coordinates of the click. Anyway to get at the coordinates of the click on a vector? I need to show AnchoredBubble at the point of the user click.
|
Actually, the click event sample gives you what you want.
If needed you can convert coordinates to pixel to display the popup. Edit - to get coordinates only on selecting feature :
|
|||||||||||
|
|
The API doesn't provide a way to get the click location from the In the meantime, you can access the mouse event on the feature handler used by the
This assumes (obviously) that you have a reference to the |
|||
|
|
|
You can use |
|||
|
|
I was able to get the lat lon of the click event using the following: Inside the
where |
|||
|
|