getCountryCode: Return Country ISO Codes at Specified Locations

Description Usage Arguments Value References See Also Examples

Description

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

If allData=TRUE, additional data is returned.

Usage

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

allData

logical specifying whether a full dataframe should be returned

useBuffering

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

Value

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

References

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

See Also

SimpleCountries

getSpatialData

Examples

1
2
3
lon <- seq(0,50)
lat <- seq(0,50)
getCountryCode(lon,lat)


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

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.