sf (version 0.2-8)

st_interpolate_aw: areal-weighted interpolation of polygon data

Description

areal-weighted interpolation of polygon data

Usage

st_interpolate_aw(x, to, extensive)

Arguments

x
object of class sf, for which we want to aggregate attributes
to
object of class sf or sfc, with the target geometries
extensive
logical; if TRUE, the attribute variables are assumed to be spatially extensive (like population), otherwise, spatially intensive (like population density).

Examples

Run this code
nc = st_read(system.file("shape/nc.shp", package="sf"))
g = sf:::st_makegrid(nc, n = c(20,10))
a1 = st_interpolate_aw(nc["BIR74"], g, extensive = FALSE)
sum(a1$BIR74) / sum(nc$BIR74) # not close to one: property is assumed spatially intensive
a2 = st_interpolate_aw(nc["BIR74"], g, extensive = TRUE)
sum(a2$BIR74) / sum(nc$BIR74)
a1$intensive = a1$BIR74
a1$extensive = a2$BIR74
plot(a1[c("intensive", "extensive")])

Run the code above in your browser using DataLab