Pulls attribute records from an ArcGIS REST layer, paginating through
the server transfer limit automatically (ArcGIS caps a single query
at maxRecordCount features, typically 1000-2000).
Usage
morie_fetch_arcgis(
layer_url,
where = "1=1",
out_fields = "*",
params = NULL,
page_size = 2000L,
max_records = Inf
)Arguments
- layer_url
The layer URL, ending in
/FeatureServer/<n>or/MapServer/<n>.- where
SQL-style WHERE filter (default
"1=1", all rows).- out_fields
Comma-separated field list (default
"*").- params
Optional named list of extra query parameters.
- page_size
Records requested per page (default 2000).
- max_records
Cap on the total number of records (default
Inf– fetch the whole layer).
Examples
# \donttest{
# Toronto Police Service public hub layer (same layer the TPS
# bridge in tps_statphysics.R pages from).
layer <- paste0(
"https://services.arcgis.com/S9th0jAJ7bqgIRjw/arcgis/rest/",
"services/Neighbourhood_Crime_Rates_Open_Data/FeatureServer/0"
)
df <- try(morie_fetch_arcgis(layer, max_records = 50))
# }
