getStateName | R Documentation |
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.
getStateName(
longitude = NULL,
latitude = NULL,
datasetName = "NaturalEarthAdm1",
countryCodes = NULL,
allData = FALSE,
useBuffering = FALSE
)
longitude |
Vector of longitudes in decimal degrees East. |
latitude |
Vector of latitudes in decimal degrees North. |
datasetName |
Name of spatial dataset to use. |
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. |
Vector of English language state names.
getSpatialData
## Not run:
library(MazamaSpatialUtils)
setSpatialData("~/Data/Spatial_0.8")
loadSpatialData("NaturalEarthAdm1")
longitude <- seq(-140, -90)
latitude <- seq(20, 70)
getStateName(longitude, latitude)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.