I've got a network covering a large area, but the individual links are fairly small (<1km). For calculating edge lengths I'm trying to decide whether it would be better to use Haversine distance on the decimal degrees or Euclidean distance on all the geometries converted into a CRS designed for distance measurements.
Option 1: Haversine Distance on the (lon, lat) of endpoints in 'epsg:4326' (python code for reference):
####==== Calculate the great circle distance in meters for two lat/lon points
def haversineDist(lon1, lat1, lon2, lat2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2])
dlon = lon2 - lon1
dlat = lat2 - lat1
theAngle = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2
return 6367000 * 2 * math.asin(math.sqrt(theAngle)) ## distance in meters
Option 2: Pick a center point to set the CRS, convert the geometries to that CRS, and calculate edge lengths using Euclidean distance. For example, use the CRS +proj=eqc +lat_0=35.6812 +lon_0=139.7671 +units=m
for the area around Tokyo.
I think Option 2 is more accurate for areas fairly close to the reference point, but what if I am also measuring lengths of edges several degrees away, such as around 43.52, 141.62
? If I want to keep the measurements of length consistent and easily reproducible, then Option 1 seems better.
I am still fairly new to these considerations, so there may be even better options that I am not aware of.