Description Usage Arguments Examples
View source: R/custom_buffer-points-linear.R
Weight is calculated as 1 - distance / (1 + radius)
.
1 | buffer_points_linear(points, radius = 2, res = 8)
|
points |
matrix, data frame
or object of class |
radius |
number of rings (used as buffer around points) |
res |
resolution of hexagons to return |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(sf)
library(leaflet)
bart_stations <- system.file("geojson/bart_stations.geojson", package = "h3forr") %>%
st_read(quiet = TRUE)
buffer <- buffer_points_linear(bart_stations, radius = 2, res = 8)
hexagons <- h3_to_geo_boundary(buffer$h3_index) %>% geo_boundary_to_sf()
pal <- colorNumeric("Blues", buffer$norm)
map <- leaflet() %>% addTiles() %>%
addPolygons(
data = hexagons,
fillOpacity = 0.9,
fillColor = pal(buffer$norm),
weight = 1,
color = "white",
label = sprintf("%s", buffer$norm)
) %>%
addMarkers(data = bart_stations)
if (interactive()) map
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.