| Title: | Redistribute Values Between Geographic Areas |
|---|---|
| Description: | Estimate attribute values for one set of polygons from values measured on a different, misaligned set. Provides area-weighted areal interpolation and a dasymetric method that distributes values across a point layer (such as parcel centroids). Count (extensive) measures are total-preserving; rate (intensive) measures use area-weighted means. |
| Authors: | Aaron Schroeder [aut, cre] (ORCID: <https://orcid.org/0000-0003-4372-2241>) |
| Maintainer: | Aaron Schroeder <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-19 09:26:53 UTC |
| Source: | https://github.com/dads2busy/sdc.redistribute |
Area-weighted redistribution between polygon layers
redistribute_direct( source, target, extensive = NULL, intensive = NULL, preserve_totals = TRUE, suffix = NULL )redistribute_direct( source, target, extensive = NULL, intensive = NULL, preserve_totals = TRUE, suffix = NULL )
source |
An |
target |
An |
extensive |
Character vector of count column names in |
intensive |
Character vector of rate/density column names in |
preserve_totals |
Logical; if |
suffix |
Optional string appended to each new column name. |
Extensive measures (counts) are redistributed by each intersection's share of
the source polygon area and, when preserve_totals = TRUE, rescaled so the
target totals match the source totals. Intensive measures (rates/densities)
are area-weighted means: the sum of each source value times the intersection's
share of the target polygon area (the standard areal-weighting intensive
estimator). This equals a true area-weighted mean when the target is fully
covered by the source and treats any uncovered part of a target as
contributing zero. NA source values are omitted from the weighted sums.
Targets that no source polygon covers receive 0 for extensive measures and
NA for intensive measures. If target already has a column named like a
redistributed measure, it is overwritten; pass suffix to keep both.
The target layer (an sf object) with one new column per
redistributed measure.
src <- sf::st_sf(pop = 100, geometry = sf::st_sfc( sf::st_polygon(list(rbind(c(0,0), c(2,0), c(2,2), c(0,2), c(0,0)))), crs = 3857)) tgt <- sf::st_sf(id = c("A", "B"), geometry = sf::st_sfc( sf::st_polygon(list(rbind(c(0,0), c(1,0), c(1,2), c(0,2), c(0,0)))), sf::st_polygon(list(rbind(c(1,0), c(2,0), c(2,2), c(1,2), c(1,0)))), crs = 3857)) redistribute_direct(src, tgt, extensive = "pop")src <- sf::st_sf(pop = 100, geometry = sf::st_sfc( sf::st_polygon(list(rbind(c(0,0), c(2,0), c(2,2), c(0,2), c(0,0)))), crs = 3857)) tgt <- sf::st_sf(id = c("A", "B"), geometry = sf::st_sfc( sf::st_polygon(list(rbind(c(0,0), c(1,0), c(1,2), c(0,2), c(0,0)))), sf::st_polygon(list(rbind(c(1,0), c(2,0), c(2,2), c(1,2), c(1,0)))), crs = 3857)) redistribute_direct(src, tgt, extensive = "pop")
Distributes each source value across the points (e.g. parcel centroids)
that fall inside it, then reaggregates the point-level values to target
polygons. With weights = NULL the value is split evenly across points;
otherwise it is split in proportion to a points column (the extension point
for household-size or unit-count weighting).
redistribute_parcels( source, target, points, extensive = NULL, weights = NULL, suffix = NULL )redistribute_parcels( source, target, points, extensive = NULL, weights = NULL, suffix = NULL )
source |
An |
target |
An |
points |
An |
extensive |
Character vector of count column names in |
weights |
Optional name of a numeric column in |
suffix |
Optional string appended to each new column name. |
Each source value is split across the points inside that source polygon in
proportion to weights (equally when weights = NULL), then summed within
each target polygon. A source polygon that contains no points contributes
nothing to any target (its value cannot be placed). If the total weight of a
source's points is zero, that source likewise contributes nothing.
If target already has a column named like a redistributed measure, it is
overwritten; pass suffix to keep both.
The target layer (an sf object) with one new column per measure.
src <- sf::st_sf(pop = 100, geometry = sf::st_sfc( sf::st_polygon(list(rbind(c(0,0), c(2,0), c(2,2), c(0,2), c(0,0)))), crs = 3857)) tgt <- sf::st_sf(id = c("A", "B"), geometry = sf::st_sfc( sf::st_polygon(list(rbind(c(0,0), c(1,0), c(1,2), c(0,2), c(0,0)))), sf::st_polygon(list(rbind(c(1,0), c(2,0), c(2,2), c(1,2), c(1,0)))), crs = 3857)) pts <- sf::st_sf(geometry = sf::st_sfc( sf::st_point(c(0.5, 1)), sf::st_point(c(1.5, 1)), crs = 3857)) redistribute_parcels(src, tgt, pts, extensive = "pop")src <- sf::st_sf(pop = 100, geometry = sf::st_sfc( sf::st_polygon(list(rbind(c(0,0), c(2,0), c(2,2), c(0,2), c(0,0)))), crs = 3857)) tgt <- sf::st_sf(id = c("A", "B"), geometry = sf::st_sfc( sf::st_polygon(list(rbind(c(0,0), c(1,0), c(1,2), c(0,2), c(0,0)))), sf::st_polygon(list(rbind(c(1,0), c(2,0), c(2,2), c(1,2), c(1,0)))), crs = 3857)) pts <- sf::st_sf(geometry = sf::st_sfc( sf::st_point(c(0.5, 1)), sf::st_point(c(1.5, 1)), crs = 3857)) redistribute_parcels(src, tgt, pts, extensive = "pop")
A small, self-contained set of sf layers used in examples and vignettes.
sdc_examplesdc_example
A named list with three sf elements:
Two source polygons (tract, pop).
Three target polygons (nbhd).
Parcel centroid points (units).