Download a geojson url, optionally simplifies and cache the result
Source:R/load-maps.R
downloadGeojson.RdDownload a geojson url, optionally simplifies and cache the result
Arguments
- geojsonUrl
the URL of the geojson resource or ESRI feature service layer
- simplify
do you want to simplify the map
- ...
Named arguments passed on to
featureServerLayerQuerywherean SQL query (defaults to whole map)
selectthe columns to return (see featureServerLayerInfo())
limitmaximum rows to return
crsthe coordinate reference system
queryParamsadditional query parameters passed to the request to the feature server
...Named arguments passed on to
.cache_postbodya named list of POST data
ashow the response is delivered?
Named arguments passed on to
.cached.nocachean option to defeat the caching which can be set globally as options("cache.disable"=TRUE)
.stalethe length of time in days to keep cached data before considering it as stale. can also be set by options("cache.stale")
Examples
# The ONS UK country files:
if (interactive()) {
svc = "https://services1.arcgis.com/ESMARspQHYMw9BZ9/ArcGIS/rest/services"
fs = sprintf("%s/%s",svc,"Countries_December_2024_Boundaries_UK_BUC/FeatureServer")
layer = sprintf("%s/%s",fs,"0")
map = downloadGeojson(layer)
map %>% dplyr::glimpse()
}