Skip to contents

Proportionally allocate data from one set of polygons to another based on overlap area. Use to create crosswalks between fine-grain and coarse-grain geographies.

Usage

get_xwalk_sfx_to_sfy(
  from_geom,
  to_geom,
  from_key,
  to_key,
  overlap_tol = 0.05,
  preserve_representatives = FALSE
)

Arguments

from_geom

sf object. Fine-grain geometry to convert from.

to_geom

sf object. Coarse-grain geometry to convert to.

from_key

character vector. Key columns for from_geom.

to_key

character vector. Key columns for to_geom.

overlap_tol

numeric. Cutoff for accepted overlaps. Default 0.05.

preserve_representatives

logical. If TRUE, keeps at least one representative per from_geom. Default FALSE.

Value

data.table. Reallocated zone values with keys and overlap_ratio.

Details

  • Transforms geometries to equal area projection and buffers to avoid slivers.

  • Computes intersection areas and overlap ratios for allocation.

  • Handles multiple overlaps and preserves representatives if requested.

  • Returns data.table with keys and overlap ratios; does not modify by reference.

  • Assumes valid sf geometries and keys; errors if empty or invalid.

Settings

None.

See also

Examples

## Not run:
get_xwalk_sfx_to_sfy(from_geom, to_geom, from_key, to_key)
#> Error: object 'from_geom' not found
## End(Not run)