MazamaSpatialUtils (version 0.6.4)

getVariable: Return SPDF 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(lon, lat, dataset = NULL, variable = NULL,
  countryCodes = NULL, allData = FALSE)

Arguments

lon

vector of longitudes in decimal degrees

lat

vector of latitudes in decimal degrees

dataset

name of spatial dataset to use

variable

name of dataframe column to be returned

countryCodes

vector of countryCodes

allData

logical specifying whether a full dataframe should be returned

Value

Vector or dataframe.

See Also

getSpatialData

Examples

Run this code
# NOT RUN {
loadSpatialData("NaturalEarthAdm1")
lon <- seq(0, 50)
lat <- seq(0, 50)
getVariable(lon, lat, "NaturalEarthAdm1", "gns_lang")
# }

Run the code above in your browser using DataLab