# How Flight Works 9, Exercise 3: how far does a flat map mislead? # Compare the true great-circle distance with a flat-grid distance that treats degrees of latitude and longitude as equal squares. # Illustrative model only, not operating guidance. from math import radians, sin, cos, asin, sqrt def gc_km(lat1, lon1, lat2, lon2): p1, p2 = radians(lat1), radians(lat2) dl = radians(lon2 - lon1) a = sin((p2 - p1) / 2) ** 2 + cos(p1) * cos(p2) * sin(dl / 2) ** 2 return 2 * 6371 * asin(sqrt(a)) def flat_km(lat1, lon1, lat2, lon2): # distance measured as if latitude/longitude were a flat grid, 111.2 km per degree return 111.2 * sqrt((lat2 - lat1) ** 2 + (lon2 - lon1) ** 2) pairs = {"A": (40.64, -73.78, 51.47, -0.45), "B": (51.47, -0.45, 1.36, 103.99), "C": (-33.95, 151.18, -36.85, 174.77)} for name, p in pairs.items(): g, f = gc_km(*p), flat_km(*p) print(name, "great circle", round(g), "km, flat-grid", round(f), "km, difference", round(f - g), "km") # Output when run: # A great circle 5541 km, flat-grid 8243 km, difference 2702 km # B great circle 10881 km, flat-grid 12881 km, difference 2000 km # C great circle 2157 km, flat-grid 2643 km, difference 486 km # # Degrees of longitude get shorter away from the equator, so the flat-grid figure is too long. The straight line on a flat map is not the shortest route over the globe, which is why flights curve on it.