ne_load | R Documentation |
ne_download
returns loaded data as a spatial object.
ne_load(
scale = 110L,
type = "countries",
category = c("cultural", "physical", "raster"),
destdir = tempdir(),
file_name = NULL,
returnclass = c("sf", "sv")
)
scale |
The scale of map to return, one of '110', '50', '10' or 'small', 'medium', 'large'. |
type |
type of natural earth file one of 'countries', 'map_units', 'map_subunits', 'sovereignty', 'states' OR the portion of any natural earth vector url after the scale and before the . e.g. for 'ne_50m_urban_areas.zip' this would be 'urban_areas' OR the raster filename e.g. for 'MSR_50M.zip' this would be 'MSR_50M' |
category |
one of natural earth categories : 'cultural', 'physical', 'raster' |
destdir |
folder to load files from, default=tempdir() |
file_name |
OPTIONAL name of file (excluding path) instead of natural earth attributes |
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'). |
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.
An object of class 'sf' for simple feature (from 'sf', the default) or 'SpatVector' (from 'terra').
ne_download
## Not run:
# download followed by load from tempdir() works in same R session
spdf_world <- ne_download(scale = 110, type = "countries")
spdf_world2 <- ne_load(scale = 110, type = "countries")
# download followed by load from specified directory works between R sessions
spdf_world <- ne_download(scale = 110, type = "countries", destdir = getwd())
spdf_world2 <- ne_load(scale = 110, type = "countries", destdir = getwd())
# for raster download & load
rst <- ne_download(scale = 50, type = "OB_50M", category = "raster", destdir = getwd())
# load after having downloaded
rst <- ne_load(scale = 50, type = "OB_50M", category = "raster", destdir = getwd())
# plot
library(terra)
plot(rst)
# end dontrun
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.