accessibility_greenspace {greenR}R Documentation

Generate Accessibility Map for Green Spaces and Export Data

Description

This function generates a leaflet map that shows green spaces accessible within a specified walking time from a given location. It also exports the spatial data as a geopackage file for use in GIS software like QGIS.

Usage

accessibility_greenspace(
  green_area_data,
  location_lat,
  location_lon,
  max_walk_time = 15,
  green_color = "green",
  location_color = "blue",
  isochrone_color = "viridis",
  output_file = NULL
)

Arguments

green_area_data

A list containing green area data, usually obtained from the get_osm_data function.

location_lat

Numeric latitude of the specified location.

location_lon

Numeric longitude of the specified location.

max_walk_time

Maximum walking time in minutes. Default is 15.

green_color

Color for the green areas on the map. Default is "green".

location_color

Color for the specified location on the map. Default is "blue".

isochrone_color

Color palette for the isochrone lines. Default is "viridis".

output_file

Path and filename for the output geopackage. If NULL (default), no file is exported.

Details

Note: This function requires an OSRM server for isochrone computation. By default, it uses the public OSRM API, which requires internet access. During CRAN checks and non-interactive sessions, the function will halt to prevent unintended web requests.

Value

A list containing a leaflet map object and the spatial data (sf objects).

Examples

## Not run: 
  # First, get OSM data (this requires internet connection)
  osm_data <- get_osm_data("Lausanne, Switzerland")

  # Now use the green areas data in the accessibility function
  result <- accessibility_greenspace(
    green_area_data = osm_data$green_areas,
    location_lat = 46.5196,
    location_lon = 6.6322,
    output_file = tempfile(fileext = ".gpkg")
  )

  # View the leaflet map
  result$map

  # Check the structure of the returned data
  str(result, max.level = 1)

## End(Not run)

[Package greenR version 0.0.1.3 Index]