Is there any api or package in R to calculate the distance between the two locations given their lattitudes and longitudes ?
I found two interesting packages -
- gmapsdistance uses Google Maps API to calculate the distance between given coordinates. You can find more detail with a bunch of examples here -
Pro - You can use different traveling modes like “driving”, “walking” or "bicycling"
Catch - You need to have an API key from gmaps.(You can get it from here)
- Also, geosphere looks promising. It has a set of different algorithms to calculate distance.
Hope this helps,
Use haversine() for direct distance calculation