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 78361ed81cca40aebd1032a26ef52e5b.

Usage

morie_datasets_tps_2011_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

2011 Field Information Requests (FIRS)

Tags: FIRS; Field Information Requests

Examples

# \donttest{
df <- try(morie_datasets_tps_2011_firs(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   CONTACTID TPS_PATROL_ZONE NATURE_OF_CONTACT CONTACT_DATE CONTACT_TIME
#> 1    807313             552       EDP Related   2011.01.01     06:45:00
#> 2    807316             424      Traffic Stop   2011.01.01     09:53:00
#> 3    807318             542   Vehicle Related   2011.01.01     10:28:00
#> 4    807318             542   Vehicle Related   2011.01.01     10:28:00
#> 5    807318             542   Vehicle Related   2011.01.01     10:28:00
#>   CONTACT_YEAR AGE  SEX BIRTH_PLACE SKIN_COLOUR YEAR_MONTH_OF_BIRTH
#> 1         2011  20 Male        <NA>       White            1990 JUL
#> 2         2011  38 Male       China       Other            1972 APR
#> 3         2011  22 Male        <NA>       Black            1988 AUG
#> 4         2011  22 Male        <NA>       Black            1988 DEC
#> 5         2011  21 Male        <NA>        <NA>            1989 JUN
#>   UNIQUE_PERSON_ID   HOME_CITY HOME_PATROL_ZONE FID
#> 1          3911857    WINNIPEG               NA   1
#> 2          3911860 STOUFFVILLE               NA   2
#> 3           147714        <NA>               NA   3
#> 4           378170        <NA>               NA   4
#> 5          3911864        <NA>               NA   5
# }