View source: R/nearest_greenspace.R
nearest_greenspace | R Documentation |
Determines the nearest specified type of green space from a given location and calculates the shortest walking route using the road network optimized for walking. The result is visualized on a Leaflet map displaying the path, the starting location, and the destination green space, with details on distance and estimated walking time.
nearest_greenspace(
highway_data,
green_areas_data,
location_lat,
location_lon,
green_space_types = NULL,
walking_speed_kmh = 4.5,
osrm_server = "https://router.project-osrm.org/"
)
highway_data |
List containing road network data, typically obtained from OpenStreetMap. |
green_areas_data |
List containing green areas data, obtained from |
location_lat |
Numeric, latitude of the starting location. |
location_lon |
Numeric, longitude of the starting location. |
green_space_types |
Vector of strings specifying types of green spaces to consider. |
walking_speed_kmh |
Numeric, walking speed in kilometers per hour, default is 4.5. |
osrm_server |
URL of the OSRM routing server with foot routing support, default is "https://router.project-osrm.org/". |
A Leaflet map object showing the route, start point, and nearest green space with popup annotations.
data <- get_osm_data("Fulham, London, United Kingdom")
highway_data <- data$highways
green_areas_data <- data$green_areas
map <- nearest_greenspace(highway_data, green_areas_data, 51.4761, -0.2008, c("park", "forest"))
print(map) # Display the map
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.