You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a GPS receiver with an amazing precision up to 7mm.
I want two, collect their data, and calculate the free-sight straight-line distance between them.
Unfortunately I didn't receive too much math eduction, but Pi and Pythagoras I do understand.
Now English isn't my native language, plus all the overbearing geo terminology, is pretty difficult to me.
However, I do understand earth is not flat.
This is the code I have now:
from math import sqrt
from pyproj import Transformer
# 3km in Rome (according to Google Maps) + 4km altitude, to make a "3/4/5ish" triangle:
lon1=12.5
lon2=12.488
lat1=41.94215768476
lat2=41.91667795833
alt1=4000
alt2=0
gps2xyz = Transformer.from_crs('EPSG:4979', 'EPSG:4978', always_xy=True)
pt1 = gps2xyz.transform(lon1, lat1, alt1)
pt2 = gps2xyz.transform(lon2, lat2, alt2)
distance3d = sqrt((pt1[0] - pt2[0])**2 + (pt1[1] - pt2[1])**2 + (pt1[2] - pt2[2])**2)
print("distance 3D: %s m" % distance3d)
One approach to check the outcome, was using the central-angle-of-a-circle (earth) to calculate the never-exactly-90deg-angle + altitude + the length-of-the-non-curved-side, to find the hypotenusa (which would be the distance between my two gadgets).
That outcome came very close.
Still I wonder if this formula to calculate distance between 3D points is entirely correct applied for this data - or am I mixing two different worlds?
And if it's correct, then still, is this the most efficient and accurate way to accomplish the thing I'm trying?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I found a GPS receiver with an amazing precision up to 7mm.
I want two, collect their data, and calculate the free-sight straight-line distance between them.
Unfortunately I didn't receive too much math eduction, but Pi and Pythagoras I do understand.
Now English isn't my native language, plus all the overbearing geo terminology, is pretty difficult to me.
However, I do understand earth is not flat.
This is the code I have now:
One approach to check the outcome, was using the central-angle-of-a-circle (earth) to calculate the never-exactly-90deg-angle + altitude + the length-of-the-non-curved-side, to find the hypotenusa (which would be the distance between my two gadgets).
That outcome came very close.
Still I wonder if this formula to calculate distance between 3D points is entirely correct applied for this data - or am I mixing two different worlds?
And if it's correct, then still, is this the most efficient and accurate way to accomplish the thing I'm trying?
Beta Was this translation helpful? Give feedback.
All reactions