Learn R Programming

MazamaSpatialUtils (version 0.8.6)

getVariable: Return SFDF variable at specified locations

Description

Uses spatial comparison to determine which polygons the locations fall into and returns the variable associated with those polygons.

If allData = TRUE, the entire dataframe is returned.

Usage

getVariable(
  longitude = NULL,
  latitude = NULL,
  dataset = NULL,
  variable = NULL,
  countryCodes = NULL,
  allData = FALSE,
  useBuffering = FALSE
)

Value

Vector or dataframe.

Arguments

longitude

Vector of longitudes in decimal degrees East.

latitude

Vector of latitudes in decimal degrees North.

dataset

Name of spatial dataset to use.

variable

Name of dataframe column to be returned.

countryCodes

Vector of ISO 3166-1 alpha-2 country codes.

allData

Logical specifying whether a full dataframe should be returned.

useBuffering

Logical flag specifying the use of location buffering to find the nearest polygon if no target polygon is found.

See Also

getSpatialData