D
Daizo
06 Jun 2025 12:46
Link
I am trying to set up my Targon units and Garrisons to make a good protective mesh but cannot see anywhere how to judge distances on the map?
<!-Quote-!>Quote:import math
def haversine(lat1, lon1, lat2, lon2, radius=6000):
# Convert decimal degrees to radians
lat1, lon1, lat2, lon2 = map(math.radians, [lat1, lon1, lat2, lon2])
# Haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2
c = 2 * math.asin(math.sqrt(a))
distance = radius * c
return distance
# Example usage
latitude1 =-64.73
longitude1 = -133.73 # Los Angeles
latitude2 = -68.15
longitude2 = 147.05
distance = haversine(latitude1, longitude1, latitude2, longitude2)
print distance<!-/Quote-!>