attribute.shapefile: Attributing a spatial data frame using another spatial data...

View source: R/spatial_manipulation.R

attribute.shapefileR Documentation

Attributing a spatial data frame using another spatial data frame

Description

This function will take a SpatialPoints/PolygonsDataFrame and add one attribute fields from a second SpatialPoints/PolygonsDataFrame

Usage

attribute.shapefile(
  spdf1,
  spdf2,
  attributefield = NULL,
  newfield = NULL,
  projection = sp::CRS("+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs")
)

Arguments

spdf1

A SpatialPoints/PolygonsDataFrame containing the geometry to add an attribute to

spdf2

A SpatialPoints/PolygonsDataFrame containing the geometry to add an attribute from

attributefield

The name of the field in spdf2 as a string containing the values to add to spdf1

newfield

The name of the field in spdf1 as a string to add the values from spdf2$attributefield to. If NULL, the field will use attributefield. Defaults to NULL.

projection

An sp::CRS() argument to apply in the event that spdf1 and spdf2 have different projections. Defaults to CRS("+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs")

Value

The original SPDF spdf1 with the new field containing the values inherited from spdf2.

Examples

attribute.shapefile()

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