1

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.

1
  • So, none of the GIS experts that supposedly use this site have any advise to offer on this point? It seems like it would be a fairly common consideration for geospatial analyses, so I expected there to be a canonical answer that I just can't find. Maybe GIS is all just guesswork for everybody (intentionally provocative). – Aaron Bramson Jan 27 at 9:17
2

I recommend using the geodesic distance. geopy provides this functionality, so you don't have to code it up. This way, you avoid the guess work about the domain of applicability of your suggested approximate methods.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.