Get latitude and longitude from mouse click

64 views
Skip to first unread message

James H

unread,
Jan 14, 2022, 5:35:25 PM1/14/22
to openmap-users
Hi all,

I try to get the latitude and longitude from the location on the map where the mouse has been clicked such that I can use these values for input into another routine I have. I suspect a listener has to be added that listens to the appropriate MapMouseEvent, but I am not quite sure how to approach this.

Could someone give me a nudge in the right direction?

Thank you very much!

James

Don Dietrick

unread,
Jan 14, 2022, 6:12:55 PM1/14/22
to James H, openmap-users
Hi James,

This is a pretty open-ended question. Can you describe how you’re using OpenMap if you’re actually getting a MapMouseEvent? The MapMouseEvent has a getProjectedLocation() method which returns coordinates of that MouseEvent in the map projection, so x and y are decimal degrees if you can grab that.

- Don
> --
> You received this message because you are subscribed to the Google Groups "openmap-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to openmap-user...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/openmap-users/aadd0c0d-c2db-4132-a0e1-a81d696faf2an%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages