prevR (version 5.0.0)

create.boundary: Provide national boundaries of a country.

Description

This function uses the data set TMWorldBorders. One or several countries can be selected and will be returned as an object of class sp::SpatialPolygons.

Usage

create.boundary(
  countries = NULL,
  multiple = FALSE,
  proj = "+proj=longlat +datum=WGS84"
)

Value

Object of class sp::SpatialPolygons.

Arguments

countries

a vector of character string corresponding to the name of the countries you want to extract from the dataset. If NULL, a dialogue box will be appear in order to select the desired country.

multiple

should the dialog box allow multiple selection (unused if countries is specified)?

proj

projection of clusters coordinates used in data (longitude and latitude in decimal degrees by default). One of (i) character: a string accepted by GDAL, (ii) integer, a valid EPSG value (numeric), or (iii) an object of class crs, see sf::st_crs().

See Also

TMWorldBorders.

Examples

Run this code
if (FALSE) {
boundary <- create.boundary()
}
# \dontshow{
par(ask = TRUE)
# }
boundary <- create.boundary("Burkina Faso")
boundary <- create.boundary("Burkina Faso",
  proj = "+proj=utm +zone=30 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
)
boundary <- create.boundary(countries = c("Burkina Faso", "Ghana", "Benin"))
# \dontshow{
par(ask = FALSE)
# }

Run the code above in your browser using DataLab