How to draw lines and circles on cylindrical projection map?

251 Views Asked by At

I am trying to draw a circle with known radius around a coordinate on a cylindrical projection map. Which is a circle around equator and egg shaped closer to the poles.
And also trying to draw a line between 2 known coordinates.

In order to draw the shapes all I need is to know points on the circle and line. Then I can draw lines between points to complete line or circle.

This is the map I am using: http://www.shadedrelief.com/natural3/pages/textures.html

Here are some examples:
enter image description here
enter image description here

Question 1: How to find the coordinates of 20 points equal distance apart on the line between 2 points with known coordinates? (eg. lat1:17,34039 lon1:-8,3289903 lat2:18,3499 lon2:12,3928 )

Qestion 2: How to find the coordinates of a point 100 km away at N degrees from a point with known coordinates? (eg. lat1:15,90909 lon1:-3,2324 degree:185 distance: 123 km)

Note: I am not very familiar with Math signs used in this site. If you could do it in a way easy for me to translate to a programming language, I would appreciate that. Otherwise please assume I am 15 years old, and explain it to me like that.

Thanks.

Edit: I found Haversine formula to calculate distance between 2 coordinates.
https://www.movable-type.co.uk/scripts/latlong.html

1

There are 1 best solutions below

1
On

I found the solution myself.

NOTE: Units are in radians and meters. If you are using degrees, convert to radians before and to degrees after.

Distance: Finding great-circle distance between two points

φ: latitude  
Δφ: delta latitude
λ: longitude  
Δλ: delta longitude
R: earth's radius in meters  

Formula:
a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)
c = 2 ⋅ atan2( √a, √(1−a) )
d = R ⋅ c

Answer 1: Finding an intermediate point at any fraction along the great circle path between two points

φ: latitude  
λ: longitude  
R: earth's radius in meters  
δ: angular distance between 2 points which is distance / R

Formula:    
a = sin((1−f)⋅δ) / sin δ
b = sin(f⋅δ) / sin δ
x = a ⋅ cos φ1 ⋅ cos λ1 + b ⋅ cos φ2 ⋅ cos λ2
y = a ⋅ cos φ1 ⋅ sin λ1 + b ⋅ cos φ2 ⋅ sin λ2
z = a ⋅ sin φ1 + b ⋅ sin φ2
φi = atan2(z, √x² + y²)
λi = atan2(y, x)

Answer 2: Finding destination point given distance and bearing from start point

φ: latitude  
λ: longitude  
R: earth's radius in meters  
δ: angular distance between 2 points which is distance / R
θ: bearing (clockwise from north)


Formula:    
φ2 = asin( sin φ1 ⋅ cos δ + cos φ1 ⋅ sin δ ⋅ cos θ )
λ2 = λ1 + atan2( sin θ ⋅ sin δ ⋅ cos φ1, cos δ − sin φ1 ⋅ sin φ2 )