我想在这两个点之间添加折线。我该怎么做?
m <- leaflet() %>%
addPolylines() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng = -87.6266382, lat = 41.8674336,
popup = "starting") %>%
addMarkers(lng = -87.64847, lat = 41.9168862,
popup = "Destination")
m # Print the map
数据示例。
| region | from_lat | from_long | to_lat | to_long |
|-------------|------------|------------- |-------------|----------- |
| 1 | 41.8674336 | -87.6266382 | 41.887544 | -87.626487 |
| 2 | 41.8674336 | -87.6266382 | 41.9168862 | -87.64847 |
| 3 | 41.8674336 | -87.6266382 | 41.8190937 | -87.6230967|