MazamaSpatialUtils (version 0.6.4)

getUSCounty: Return US county name at specified locations

Description

Uses spatial comparison to determine which county polygons the locations fall into and returns the county name strings for those polygons.

Specification of stateCodes limits spatial searching to the specified states and greatly improves performance.

If allData = TRUE, additional data is returned.

Usage

getUSCounty(lon, lat, dataset = "USCensusCounties", stateCodes = NULL,
  allData = FALSE, useBuffering = FALSE)

Arguments

lon

vector of longitudes in decimal degrees

lat

vector of latitudes in decimal degrees

dataset

name of spatial dataset to use

stateCodes

vector of stateCodes used to limit the search

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

Value

Vector of county names in English.

References

http://www.naturalearthdata.com/downloads/10m-cultural-vectors/

See Also

getSpatialData

Examples

Run this code
# NOT RUN {
lon <- seq(-140, -90)
lat <- seq(20, 70)
getUSCounty(lon, lat)
# }

Run the code above in your browser using DataLab