Measurement of Road Distance
Discover how to calculate real driving distances and durations between locations using the OpenStreetMap API. Understand API requests, parse JSON responses, and convert units to enhance route accuracy beyond geodesic estimates.
We'll cover the following...
We’ve calculated the distance on the surface of the Earth. Even though the geodesic method is closer to reality than the straight-line model, there’s still potential for optimization. Since the salesperson is supposed to drive the distance by car, we need to calculate the real driving distance instead of the surface distance.
The distance (using the geodesic method on WGS-84 ellipsoid) between the two stores, A and B, is 11.3 km (or approximately 7 miles). But how long would it take if we went by car? And how long would we need to cover this distance? We’ll use OpenStreetMap’s API to answer these questions.
OpenStreetMap
OpenStreetMap is a project founded in 2004 with the goal of creating a free map of ...