Add start and end markers to a leaflet map
map_axis_start_end.Rd
This function adds start and end markers to a Leaflet map based on the provided start and end coordinates.
Arguments
- map
A Leaflet map object created using the 'leaflet' package.
- axis_start_end
A data frame containing start and end coordinates with columns 'X' for longitude and 'Y' for latitude.
- region_axis
A data frame containing region-specific axes to be displayed.
Examples
library(leaflet)
library(dplyr)
# Create a simple Leaflet map
my_map <- leaflet() %>%
setView(lng = 4.968697, lat = 45.103354, zoom = 8) %>%
addProviderTiles(providers$CartoDB.Positron)
# Create a data frame with start and end coordinates
coordinates_df <- data_get_axis_start_end(network_axis %>%
filter(fid == 5))
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
# Add start and end markers to the map
my_map <- map_axis_start_end(my_map, axis_start_end = coordinates_df,
region_axis = network_axis)
my_map