distancegeopypgroutinggreat-circle

What metric does pgrouting use to calculate distances?


I was comparing distances between points using pgrouting and comparing it with Vincenty and great circle distances computed using geopy, but I'm finding that the min distance between two points is lower bounded by the pgrouting distances. This makes no sense because the "straight" (as the crow flies) distance between two points should be the min distance.enter image description here

How is pgrouting computing the "cost" between two points?

I'm sure I can find this by digging through the source code, but I'm not sure how to find my way around, and it could be faster to ask...


Solution

  • PgRouting doesn't calculate distances. It takes a 'cost' field for each edge and adds up the cost for each edge in a path. You need to figure out what cost value you're passing to PgRouting and get that straight. Maybe you measured on a different unit or projection.