Note: Taken from https://github.com/r-spatial/sf/issues/1201

st_kde(points, cellsize, bandwith, extent = NULL)

Arguments

points

sf object with POINT geometry

cellsize

size of cell

bandwith

bandwith for 2D kde, larger: smoother, smaller: spikier

extent

allows cropping to a specific subregion of the map

Value

raster

Examples

if (FALSE) {
librarry(sf)
libary(here)
library(magrittr)
library(dplyr)

shpBuildings <- SfSpHelpers::get_zipped_remote_shapefile ("https://data.montreal.ca/dataset/4ad6baea-4d2c-460f-a8bf-5d000db498f7/resource/866a3dbc-8b59-48ff-866d-f2f9d3bbee9d/download/uniteevaluationfonciere.geojson.zip")
shpCentroids <- shpBuildings %>% st_centroid

rasterKDECentroids <- st_kde(shpCentroids,0.01,0.01)
plot(rasterKDECentroids)
}