Update locationdata.py

fix polygone at 4+
This commit is contained in:
SpudGunMan
2025-09-17 12:13:03 -07:00
parent fde37313f5
commit ca83117180
+4 -5
View File
@@ -903,6 +903,10 @@ def distance(lat=0,lon=0,nodeID=0, reset=False):
total_distance_miles = total_distance_km * 0.621371
msg += f", Total: {total_distance_miles:.2f} miles"
# update the last point in howfarDB
if not dupe:
howfarDB[nodeID].append({'lat': lat, 'lon': lon, 'time': datetime.now()})
# if points 3+ are within 30 meters of the first point add the area of the polygon
if len(howfarDB[nodeID]) >= 3:
points = []
@@ -953,11 +957,6 @@ def distance(lat=0,lon=0,nodeID=0, reset=False):
lon_centroid = math.degrees(lon_centroid)
msg += f", Centroid: {lat_centroid:.5f}, {lon_centroid:.5f}"
# update the last point in howfarDB
if not dupe:
howfarDB[nodeID].append({'lat': lat, 'lon': lon, 'time': datetime.now()})
return msg
def get_openskynetwork(lat=0, lon=0):