W
W
Wasya UK2020-03-20 22:05:14
Geolocation
Wasya UK, 2020-03-20 22:05:14

How to find the angle of rotation of the route in the map?

I have 2 coordinate points, I use them to build a route. In this example, there is a line, the marker moves along it. How can I find out the rotation angle of the route so that both the marker and the map can be rotated so that they go vertically, and not at some angle?5e751353831d3731248820.jpeg

route: 
(3) [Array(2), Array(2), Array(2)]
0: (2) [24.04133, 49.83574]
1: (2) [24.04065, 49.83425]
2: (2) [24.04133, 49.83574]
length: 3

5e75153602125635548910.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hint000, 2020-03-21
@dmc1989

calculate the difference in longitude dlon=E24.04133-E24.04065=0.00068
calculate the difference in latitude dlat=N49.83574-N49.83425=0.00149
multiply the difference in latitude by the length of the meridian arc . (Strictly speaking, the length of the meridian arc varies slightly at different latitudes, but for your application, an approximate value will suffice: the length of the arc of 1° meridian ~ 111 km).
multiply the difference in longitudes by the length of the arc of the parallel , but it changes very much with latitude, you can take an approximate value from the table , or you can get confused and count according to the formula by selecting the parameters of the Earth ellipsoid .
So, multiplying the differences in degrees by the lengths of the arcs, we get the differences in a rectangular coordinate system, we denote them dlat1, dlon1. Then azimuth = (atan((dlat1)/(dlon1))).
It remains only to convert radians to degrees (if the arc tangent was calculated in radians), and not get confused with the direction of rotation (take into account the signs of the differences, the sign of the angle).
PS also here Captain Evidence from behind recalls that the azimuth is measured from the direction to the north (north = 0 °).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question