Skip to contents

Download a geojson url, optionally simplifies and cache the result

Usage

downloadGeojson(geojsonUrl, simplify = FALSE, ...)

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 featureServerLayerQuery

where

an SQL query (defaults to whole map)

select

the columns to return (see featureServerLayerInfo())

limit

maximum rows to return

crs

the coordinate reference system

queryParams

additional query parameters passed to the request to the feature server

...

Named arguments passed on to .cache_post

body

a named list of POST data

as

how the response is delivered?

Named arguments passed on to .cached

.nocache

an option to defeat the caching which can be set globally as options("cache.disable"=TRUE)

.stale

the length of time in days to keep cached data before considering it as stale. can also be set by options("cache.stale")

Value

the `sf` object for this geoJson

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()
}