sf_intersect: Creating the Intersection of Two Spatial Polygons Data Frames...

View source: R/spatial_manipulation.R

sf_intersectR Documentation

Creating the Intersection of Two Spatial Polygons Data Frames using sf functions

Description

This uses sf::st_intersection to find ONLY the intersecting geometry of two SPDFs and return a single attribute variable from each.

Usage

sf_intersect(
  polygons1,
  polygons2,
  polygons1_attribute,
  polygons2_attribute,
  polygons1_attribute_output = NULL,
  polygons2_attribute_output = NULL,
  projection = NULL
)

Arguments

polygons1

Spatial polygons data frame. One of the two sets of geometry to intersect. polygons1@data must contain a variable with the name given as polygons1_attribute.

polygons2

Spatial polygons data frame. One of the two sets of geometry to intersect. polygons2@data must contain a variable with the name given as polygons2_attribute.

polygons1_attribute

Character string. The name of the variable in polygons1@data for the output to inherit values from.

polygons2_attribute

Character string. The name of the variable in polygons2@data for the output to inherit values from.

polygons1_attribute_output

Optional character string. The name of the variable in the output for the values inherited from polygons1. If NULL then the name from polygons1_attribute will be used. Defaults to NULL

polygons2_attribute_output

Optional character string. The name of the variable in the output for the values inherited from polygons2. If NULL then the name from polygons2_attribute will be used. Defaults to NULL

projection

Optional CRS object. Used as the projection for both polygons1 and polygons2. If NULL then the polygons@proj4string will be used instead. Defaults to NULL.


nstauffer/aim.analysis documentation built on Nov. 2, 2023, 12:52 a.m.