ne_states: Get natural earth world state (admin level 1) polygons

View source: R/ne_states.R

ne_statesR Documentation

Get natural earth world state (admin level 1) polygons

Description

returns state polygons (administrative level 1) for specified countries

Usage

ne_states(
  country = NULL,
  geounit = NULL,
  iso_a2 = NULL,
  spat_object = NULL,
  returnclass = c("sf", "sv")
)

Arguments

country

a character vector of country names.

geounit

a character vector of geounit names.

iso_a2

a character vector of iso_a2 country codes

spat_object

an optional alternative states map

returnclass

A string determining the spatial object to return. Either "sf" for for simple feature (from 'sf', the default) or "sv" for a 'SpatVector' (from 'terra').

Details

Note that the filename of the requested object will be returned if 'load = FALSE'.

If the data is to be loaded into memory ('load = TRUE'), the download will be handled using the GDAL virtual file system, allowing direct access to the data without writing it to disk.

Value

An object of class 'sf' for simple feature (from 'sf', the default) or 'SpatVector' (from 'terra').

See Also

ne_load, pre-downloaded data are available using ne_countries, ne_states. Other geographic data are available in the raster package : getData.

Examples


# comparing using country and geounit to filter
if (requireNamespace("rnaturalearthhires")) {
  spdf_france_country <- ne_states(country = "france")
  spdf_france_geounit <- ne_states(geounit = "france")

  plot(spdf_france_country)
  plot(spdf_france_geounit)

  plot(ne_states(country = "united kingdom"))
  plot(ne_states(geounit = "england"))
}


ropenscilabs/rnaturalearth documentation built on April 5, 2025, 6:06 a.m.