I am trying to write a function that calculates the GPS (decimal) coordinates of a point that is far of a given distance from a given point. Let say that we start from point 1 (The stripe of Dublin) and we want to move 25km east.
This is what I have written:
import math # Coordinates of "The Spire" (Dublin) lat1_dg=53.34972 lon1_dg=-6.26028 bearing=90 #degree from North distance=25000 # distance in meter alpha = math.radians(bearing) radius=6371000 # radius of Earth (in meter) gamma = distance / radius lat1_r= math.radians(lat1_dg) lon1_r= math.radians(lon1_dg) Δlat_r = gamma * math.cos(alpha) lat2_r = lat1_r + Δlat_r Δlon_r = gamma * math.sin(alpha)/math.cos(lat1_r) lon2_r = lon1_r + Δlon_r lat2_dg=(math.degrees(lat2_r)) lon2_dg=(math.degrees(lon2_r)) print(lat2_dg,lon2_dg)
This outputs the following, which is close to the correct answer
but if I calculate the distance between point 1 and point 2 with this tool, I get 25.008 meters...why?