Currently I'm able to draw a straight line between countries using the following code:
library(leaflet)
leaflet() %>% addTiles() %>% addPolylines(lat=c(38.8833, 35.00), lng=c(-77.0167, 103.00))
What I'm trying to produce is a more realistic flight path, where the straight line is actually curved. Similar to this:
For the sake of this question, I'd like to tailor the answer within the Leaflet
package. Any help would be much appreciated.
following up on mrub, just pass the object you get from gcIntermediate to leaflet. something like this:
library(leaflet)
library(geosphere)
gcIntermediate(c(5,52), c(-120,37),
n=100,
addStartEnd=TRUE,
sp=TRUE) %>%
leaflet() %>%
addTiles() %>%
addPolylines()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With