Hi I have a little problem here. I have latitude, longitude and zoom of center of my map window (openstreet map). I have dimension map window. I also have pixel positions of specific events on the map in the window. Can Anyone help me how to convert these pixel positions into latitude and longitude coordinates or any other coordinate system that I will be able to visualize on different map later ? Here is an illustration of my problem. asked 09 Jul '20, 08:24 Jozef |
The projection you are displaying the map in is the so called spherical Mercator projection, you can convert Mercator coordinates to WGS84 lat/lon with the formulas from https://wiki.openstreetmap.org/wiki/Mercator (you will need to scale from you screen pixels or whatever to Mercator meters but that is a simple exercise left for the reader). Further note: Mercator latitude coordinates do not actually cover -90° to 90° degrees as your image would suggest. answered 09 Jul '20, 12:19 SimonPoole ♦ |
Thank I have found the solution using this formula (https://en.wikipedia.org/wiki/Web_Mercator_projection )
code below
answered 09 Jul '20, 15:43 Jozef |