Skip to contents

Toronto PS ArcGIS Hub dataset wrapper. Thin dispatch to morie_datasets_tps_arcgis_hub_by_id() with the canonical hub item_id b8e3ef826ea84cbcb85951d051afc2fa.

Usage

morie_datasets_tps_2008_firs(
  format = "json",
  where = "1=1",
  max_features = NULL,
  layer_idx = 0L,
  offline = TRUE,
  dest = NULL
)

Arguments

format

One of "json" (default), "geojson", "csv", "shapefile", "fgdb".

where

SoQL-style WHERE filter passed to FeatureServer ?where= (default "1=1").

max_features

Optional cap on returned rows. Passed as resultRecordCount to FeatureServer; ignored for binary formats.

layer_idx

Integer index of the FeatureServer layer to pull (default 0L, the first layer).

offline

Logical; if TRUE, the hub_id is resolved via the included catalog (no network needed for the resolution step). Default TRUE – you can run this against the 71 catalog entries without network. Live data fetches always hit the network regardless of this argument; "offline" here only affects the hub_id -> FeatureServer URL lookup.

dest

Optional path for binary downloads (format %in% c("shapefile", "fgdb")); defaults to tempfile().

Value

A data.frame / GeoJSON list / file path; see morie_datasets_tps_arcgis_hub_by_id() for per-format semantics.

Details

2008 Field Information Requests (FIRS)

Tags: FIRS; Field Information Requests

Examples

# \donttest{
df <- try(morie_datasets_tps_2008_firs(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   CONTACTID TPS_PATROL_ZONE     NATURE_OF_CONTACT CONTACT_DATE CONTACT_TIME
#> 1      1761             414          Traffic Stop   2008.01.01     19:25:00
#> 2      1761             414          Traffic Stop   2008.01.01     19:25:00
#> 3      1761             414          Traffic Stop   2008.01.01     19:25:00
#> 4      2208             321 General Investigation   2008.01.01     13:20:00
#> 5      2206             523 General Investigation   2008.01.01     03:00:00
#>   CONTACT_YEAR AGE    SEX BIRTH_PLACE SKIN_COLOUR YEAR_MONTH_OF_BIRTH
#> 1         2008  21   <NA>        <NA>        <NA>            1986 SEP
#> 2         2008  21   Male        <NA>        <NA>            1986 JUL
#> 3         2008  22   Male    Pakistan       Brown            1985 JUN
#> 4         2008  62 Female        <NA>       White            1945 NOV
#> 5         2008  19   Male        Iraq       White            1988 AUG
#>   UNIQUE_PERSON_ID HOME_CITY HOME_PATROL_ZONE FID
#> 1            15846        NA              543   1
#> 2            15847        NA               NA   2
#> 3            15848        NA              424   3
#> 4            18534        NA              322   4
#> 5            18535        NA               NA   5
# }