D
D
Dear Egor Anatolyevich2015-03-14 13:04:08
PHP
Dear Egor Anatolyevich, 2015-03-14 13:04:08

How to arrange points on a cylindrical map?

There is a planet, round. There is a map, rectangular. There are coordinates of the type width-longitude.
Task: calculate where a point with such and such coordinates should be on a rectangular map.
I am looking for a description of the algorithm.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mrrl, 2015-03-14
@urbanknight

Depends on projection. Let the latitude of the point be u (measured in radians, from -pi/2 to pi/2), and the longitude v (from 0 to 2*pi).
The most common is the equidistant cylindrical projection. In it, the map has the size (2*pi) x pi, and the coordinates are calculated as x=v, y=u+pi/2.
In the Mercator projection, the width of the map is 2 * pi, and the height can be any, the whole planet still does not fit. Let's say the height is 2*H, the width is 2*pi. Then the coordinates will be x=v, y=ln(tan(u/2+pi/4))+H. For some points (near the poles) y will be outside the range (0.2*H), these points will not be on the map.
In the Lambert equal-area (area-preserving) projection, the map has size (2*pi) x 2, and the coordinates are calculated as x=v, y=sin(u)+1.
In an equidistant azimuthal projection (centered at the north pole), the map fits into a square with a side of 2*pi. x=pi+(pi/2-u)*cos(v), y=pi+(pi/2-u)*sin(v).
In the central projection (centered on the north pole), only part of the northern hemisphere fits on the map. Let's say the card is a square with a side of 2*M. Then x=M+ctg(u)*cos(v), y=M+ctg(u)*sin(v) (for u>0). The advantage of this projection is that the shortest paths between points are shown as straight lines.
In the stereographic projection (with the center at the north pole), the planet will not fit on the map either. Let's say the card is a square with a side of 2*M. Then x=M+ctg(u/2+pi/4)*cos(v), y=M+ctg(u/2+pi/4)*sin(v)
This is the first thing that came to mind (although the last three are not cylindrical). In general, there are many projections (and algorithms). Here is a short list (about 60 options): https://en.wikipedia.org/wiki/List_of_map_projections

M
Moskus, 2015-03-15
@Moskus

Don't reinvent the wheel, use proj4php.sourceforge.net - it's a PHP interface from this thing trac.osgeo.org/proj

D
Denis Ineshin, 2018-01-12
@IonDen

Python is a wonderful language. The best thing to start. Allows you to do a lot of things.
But if you are already planning to do something specifically for the android platform, then of course it would be wiser to learn Java and the features of using it to develop android applications.

P
Pavel Vakhnenko, 2018-01-12
@peppenn

If you are interested in the subject "for Android" then definitely Java.
Python can be used for your question, but it's more of a perversion....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question