How to transfer between screen coordinate (x,y) positions and map location (latitude, langitude) pairs using Unfolding map?

This is really a simple/naive question, but I’m fairly new and please be kind with your responses. More specifically,

screenCoord

the above image explains the screen (x,y) coordinates.

the second image above explains the map location (latitude, longitude) pairs in the map.

I’d like to know how to transfer between the two. For example, given the (x,y) coordinates, how to get the corresponding (latitude, longitude) pair in the map? On the other hand, given the (latitude, longitude) pair, how to get its corresponding (x,y) coordinate in the screen?

I think this might have something to do with the zoom level of the map? Any comments are greatly appreciated. Many thanks !

What exactly are you looking for. Last year I start to work on a Processing library for a similar purpose. Not finalised and published cause it is based on a JAVASCRIPT implementation and I’ve only implemented that parts I’m interested in.

I’ll check it this weekend an came back to you.
Sorry for the delay. You may find some ideas based on http://www.movable-type.co.uk/latlong.html
I’m still working on the processing library implementation.
Transformation between screen and work coordinates is than an other issue to be solved.

1 Like

I’m getting closer, based on this link: http://unfoldingmaps.org/javadoc/de/fhpotsdam/unfolding/utils/ScreenPosition.html

In a general case, the following link https://stackoverflow.com/questions/7019101/convert-pixel-location-to-latitude-longitude-vise-versa might be what I need. On the other hand, based on Unfolding map, this wonderful map.getScreenPosition(location) might be what I need. :wink: