1/ Create Data
First, let’s build a list of the 12 largest hospitals in inner Paris.
## Factor w/ 12 levels "Armand-Trousseau",..: 11 2 8 6 4 7 3 1 9 12 ...
2/ Look for closest hospital based on user’s position
Let’s calculate the distance from user’s position to all hospitals. We then order the hospitals according to their distance.
Below is an example of output with the coordinates (48.86; 2.34) :
## name lat lng dist
## 12 Hotel Dieu 48.85395 2.34776 881.3277
3/ Use speed to calculate time to reach the closest hospital.