How to convert latitude and longitude to x, y in Java?

I am working on a geographical project in Java.

Input data: coordinates: 24.4444 N, etc. Exit: A PLAIN map (not rounded) that displays the coordinate point.

I don’t know how the conversion algorithm from coordinates to x, y on JComponent, can anyone help me?

The map is as follows: http://upload.wikimedia.org/wikipedia/commons/7/74/Mercator-projection.jpg

thank

+3
source share
2 answers

, (90.0N - 90.0S) (180W - 180E). - , (90,0... 90,0) (180,0... 180,0).

- , 140x120 - :

x = (latitude * canvas_height / 180.0) + (canvas_height / 2)
y = (longitude * canvas_width / 360.0) + (canvas_width / 2)

x = (longitude * 120.0 / 180.0) + (120/2)
y = (latitude  * 140.0 / 360.0) + (140/2)

. , (0,0) , , .

: , (, , , )

+3

Source: https://habr.com/ru/post/1745012/


All Articles