wdpa_fetch | R Documentation |
Fetch WDPA files
wdpa_fetch(id = NULL, type = "csv", overwrite = TRUE, ...)
id |
(numeric/integer) a WDPA site ID. if not given, we get all the data |
type |
(character) type of file, one of shapefile (default), kml, or csv |
overwrite |
(logical) Overwrite if exists. Default: |
... |
Further named parameters passed on to crul::HttpClient |
If you don't have the metadata file, we download it for you and read it in. After that we jus read the cached version. If for some reason that file is deleted, we'll detect it and download again.
The path file written to is managed via rw_cache
. See rw_cache.
Uses readr::read_csv for csv and sf::read_sf for shp and kml internally
varies depending on value of type
parameter
## Not run: # a single site wdpa_fetch(id = 76200, type = "csv") wdpa_fetch(id = 76200, "shapefile") wdpa_fetch(id = 76200, "kml") # another id wdpa_fetch(id = 2137, type = "csv") wdpa_fetch(id = 2137, "shapefile") wdpa_fetch(id = 2137, "kml") # entire dataset, beware, very large # wdpa_fetch() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.