get_data: Get data from within the package

View source: R/get_data.R

get_dataR Documentation

Get data from within the package

Description

returns world country polygons at a specified scale, used by ne_countries()

Usage

get_data(
  scale = 110,
  type = c("countries", "map_units", "sovereignty", "tiny_countries")
)

Arguments

scale

The scale of map to return, one of '110', '50', '10' or 'small', 'medium', 'large'.

type

country type, one of 'countries', 'map_units', 'sovereignty', 'tiny_countries'

Details

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

Value

A sf object.

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

## Not run: 
spdf_world <- ne_download(scale = 110, type = "countries")

plot(spdf_world)
plot(ne_download(type = "populated_places"))

# reloading from the saved file in the same session with same arguments

spdf_world2 <- ne_load(scale = 110, type = "countries")

# download followed by load from specified directory will work across sessions
spdf_world <- ne_download(scale = 110, type = "countries", destdir = getwd())
spdf_world2 <- ne_load(scale = 110, type = "countries", destdir = getwd())

# for raster, here an example with Manual Shaded Relief (MSR) download & load

rst <- ne_download(scale = 50, type = "MSR_50M", category = "raster", destdir = getwd())

# load after having downloaded
rst <- ne_load(
  scale = 50, type = "MSR_50M", category = "raster", destdir =
    getwd()
)

# plot
library(terra)
terra::plot(rst)
# end dontrun

## End(Not run)


rnaturalearth documentation built on May 29, 2024, 7:31 a.m.