Calculating geographical distances between a point to multiple locations using R

I have following data

  1. Office location in - Lat and Long format
  2. Multiple Hospital locations - lat and Long format
  3. OSM Road layer.

I want to calculate road distance from office to each hospital using R Code. Final output should be line layer

with distances from office to each hospital.

3 Likes

Hi Prachidev90,

you can see to OPEN STREET MAP ROUTING SERVICE, it's the only free way (i'm trying it in last month) to calculate distance between two geolocate points throught the streets.

Through Routing you can find a link to R package named Routes/OpenRouteService-r.

There are a lot of functions and one calculate distance from two geolocate points through the streets, using ors_matrix but it need a subscriptions and a token to openrouteservice[dot]org.

Another way is osrm package.

hope this help
bye
MC

2 Likes