
Fetch one TPS category as a CSV, paging until exhausted
Source:R/tps_fetch.R
morie_tps_fetch_category.RdWalks the ArcGIS REST /query endpoint for the category's
FeatureServer layer, accumulates all features in memory, and
writes a single CSV file to cache_dir. Returns the CSV path.
Usage
morie_tps_fetch_category(
category,
cache_dir = NULL,
where = "1=1",
overwrite = FALSE,
max_records_per_page = 2000L
)Arguments
- category
One of
morie_tps_list_categories().- cache_dir
Directory to write the CSV into. Defaults to
tempdir()(CRAN-safe; the Python default of~/.cache/morie/tpsrequiresR_user_diropt-in in R).- where
ArcGIS SQL
whereclause (default"1=1").- overwrite
If
FALSEand the output exists, return it without re-downloading.- max_records_per_page
Pagination size (server caps at 2000).
Examples
# The layers this can fetch -- a local lookup, no network.
morie_tps_list_categories()
#> [1] "Assault" "AutoTheft"
#> [3] "BicycleTheft" "BreakAndEnter"
#> [5] "Homicides" "Robbery"
#> [7] "ShootingAndFirearmDiscarges" "TheftFromMV"
#> [9] "TheftOver"
if (FALSE) { # \dontrun{
# Each fetch is a live ArcGIS query paged 2000 records at a time.
res <- morie_tps_fetch_category(morie_tps_list_categories()[1],
cache_dir = tempdir())
} # }