I want to find coordinate from mouse position on the map. Is it possible?
Hello Eugen,
There are several ways to get the mouse position on the map – it just depends when you want to do it. For example, you can do it when you click somewhere on the map. In that case you can use the following code:
$("#map").bind("click", function(event) {
console.log("X: " + event.clientX + ", Y: " + event.clientY);
});
The event.clientX and event.clientY properties will return the mouse X and Y position respectively when you click over the map.
If you need to get those values in another event, then you can use the same code, shown above, just change the event name from “click” to whatever you need.
Hope this is what you need,
Martin Stoev
Just wanted to know if the proposed solution worked for you. If you share your success on achieving that, other users may benefit as well.
Thanks in advance,