Skip to contents

Get neighbors of a given contry

Usage

geo_neighbors(src, countries, var = "sovereignt", crs = 4326, crop = FALSE)

Arguments

src

Source spatial data frame

countries

countries of interest

var

Variable name

crs

Coordinates reference system, default is WGS84 (EPGS:4326)

crop

Crop sfc to focus countries extent?

Value

      simple feature class

Examples

if (FALSE) {
 library(gisr)

 cntry <- "Zambia"

 shp_ne <- get_necountries()

 # Country + neighbors boundaries
 cntries <- geo_neighbors(src = shp_ne, countries = cntry)

 # Country + neighbors boundaries: crop to country extent
 cntries <- geo_neighbors(src = shp_ne, countries = cntry, crop = TRUE)

 cntries %>% gview()
}