identify_area: identify_area

View source: R/identify_area.R

identify_areaR Documentation

identify_area

Description

This function takes a dataframe (with coordinate fields in decimal degrees), (optionally) a spatial object (either a shapefile, an sp::SpatialPolygonsDataframe, or an sf::polygon), and a field name from the polygon object. It then overlays the df with the polygon, and determines which discrete polygon contains each point from the df, and appends a new field containing this value. If no polygon is provided, the df will be assessed against NAFO subdivisions.

Usage

identify_area(
  df = NULL,
  lat.field = "LATITUDE",
  lon.field = "LONGITUDE",
  agg.poly.shp = NULL,
  agg.poly.field = NULL,
  flag.land = FALSE
)

Arguments

df

a dataframe to be analyzed.

lat.field

the default is "LATITUDE". the name of the field holding latitude values (in decimal degrees)

lon.field

the default is "LONGITUDE". the name of the field holding longitude values (in decimal degrees)

agg.poly.shp

default is NULL. This is either the path to the *.shp file of a shapefile, an sf spatial object; or an sp spatialpolygonsdataframe. If NULL, NAFO zones will be used.

agg.poly.field

default is NULL. This identifies the field within agg.poly.shp that contains the values that should be appended to the input dataframe. If NULL, "NAFO_BEST", will be used, which is the finest resolution NAFO subdivision.

flag.land

default is TRUE. This will result in positions determined to be on land to return the value "<LAND>" in the resulting dataframe. but would require updating

Value

a DataFrame with the column agg.poly.field added

Author(s)

Mike McMahon, Mike.McMahon@dfo-mpo.gc.ca


Maritimes/Mar.utils documentation built on April 5, 2025, 1:47 p.m.