Allow basic filtering queries only at the moment. Will cache the results and handles multipart transfers.
Usage
featureServerLayerQuery(
url,
where = "1 = 1",
select = "*",
...,
limit = NULL,
crs = 4326,
queryParams = list()
)
Arguments
- url
the URL of the feature service layer (if layer is not known the first feature layer will be used)
- where
an SQL query (defaults to whole map)
- select
the columns to return (see featureServerLayerInfo())
- ...
Named arguments passed on to
.cache_post
body
a named list of POST data
as
how the response is delivered?
- limit
maximum rows to return
- crs
the coordinate reference system
- queryParams
additional query parameters passed to the request to the feature server
Examples
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")
# default all 4 nations:
sf = featureServerLayerQuery(layer)
cat(sf$CTRY24CD)
#> E92000001 N92000002 S92000003 W92000004
# england only
sf2 = featureServerLayerQuery(layer, where="CTRY24CD LIKE 'E%'")
cat(sf2$CTRY24CD)
#> E92000001
if (interactive()) {
# Download the first 4000 LSOAs. There are lots of LSOAs and this
# query has to be paginated. This also shows the limit feature
# and the verbose output of the cache.
lsoa = sprintf("%s/%s",svc,"LSOA_DEC_2021_EW_NC_v3/FeatureServer/0")
withr::with_options(list(cache.verbose=TRUE), {
sf_lsoa = featureServerLayerQuery(lsoa, limit = 4000)
})
cat(nrow(sf_lsoa))
}