st_kde: Produce a 2D kernel density estimate based on some POINTS...

View source: R/kde.R

st_kdeR Documentation

Produce a 2D kernel density estimate based on some POINTS geometry

Description

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

Usage

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

## Not run: 
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)

## End(Not run)

cgauvi/sfSpHelpers documentation built on June 30, 2023, 10:48 p.m.