getStateName: Return State Names at Specified Locations

Description Usage Arguments Value See Also Examples

View source: R/getStateName.R

Description

Uses spatial comparison to determine which 'state' polygons the locations fall into and returns the ISO 3166-2 2-character state code strings for those polygons.

Specification of countryCodes limits spatial searching to the specified countries and greatly improves performance.

If allData=TRUE, additional data is returned.

Usage

1
2
getStateName(lon, lat, dataset = "NaturalEarthAdm1", countryCodes = 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

countryCodes

vector of country codes

allData

logical specifying whether to return a full dataframe

useBuffering

logical flag specyfing the use of location buffering to find the nearest polygon if not target polygon is found

Value

Vector of state names in English

See Also

getSpatialData

Examples

1
2
3
4
5
6
## Not run: 
lon <- seq(-140,-90)
lat <- seq(20,70)
getStateName(lon,lat)

## End(Not run)

MazamaSpatialUtils documentation built on May 30, 2017, 12:27 a.m.

Search within the MazamaSpatialUtils package
Search all R packages, documentation and source code