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 d691a9391c2a4c6d85bb761530d33310.

Usage

morie_datasets_tps_motorcylist_ksi(
  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

Motorcyclist-related KSI collisions (2006 - 2023).

Tags: Killed or Seriously Injured; KSI; Motorcyclist; Traffic; Collision; Traffic Collision

Examples

# \donttest{
df <- try(morie_datasets_tps_motorcylist_ksi(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   OBJECTID  INDEX_ ACCNUM         DATE TIME              STREET1        STREET2
#> 1        1 3388101 892810 1.142053e+12  915      MORNINGSIDE AVE SHEPPARD AVE E
#> 2        2 3388102 892810 1.142053e+12  915      MORNINGSIDE AVE SHEPPARD AVE E
#> 3        3 3407218 900010 1.144469e+12 1150 4559 SHEPPARD Aven E           <NA>
#> 4        4 3407219 900010 1.144469e+12 1150 4559 SHEPPARD Aven E           <NA>
#> 5        5 3407831 900242 1.144642e+12 1744        ADELAIDE ST E   FREDERICK ST
#>   OFFSET     ROAD_CLASS              DISTRICT LATITUDE LONGITUDE
#> 1     NA Major Arterial           Scarborough 43.80194 -79.19979
#> 2     NA Major Arterial           Scarborough 43.80194 -79.19979
#> 3     NA Major Arterial           Scarborough 43.78874 -79.26289
#> 4     NA Major Arterial           Scarborough 43.78874 -79.26289
#> 5     NA Major Arterial Toronto and East York 43.65185 -79.36989
#>            ACCLOC       TRAFFCTL VISIBILITY    LIGHT RDSFCOND          ACCLASS
#> 1 At Intersection Traffic Signal      Clear Daylight      Dry            Fatal
#> 2 At Intersection Traffic Signal      Clear Daylight      Dry            Fatal
#> 3            <NA>     No Control      Clear Daylight      Dry Non-Fatal Injury
#> 4            <NA>     No Control      Clear Daylight      Dry Non-Fatal Injury
#> 5 At Intersection Traffic Signal      Clear Daylight      Dry Non-Fatal Injury
#>          IMPACTYPE           INVTYPE   INVAGE INJURY FATAL_NO INITDIR
#> 1 Turning Movement Motorcycle Driver 45 to 49  Fatal       NA    East
#> 2 Turning Movement            Driver  unknown   None       NA   South
#> 3        SMV Other     Vehicle Owner  unknown   None       NA    <NA>
#> 4        SMV Other Motorcycle Driver 30 to 34  Major       NA   North
#> 5         Rear End            Driver 55 to 59   None       NA    East
#>                     VEHTYPE     MANOEUVER                   DRIVACT DRIVCOND
#> 1                Motorcycle Turning Right Disobeyed Traffic Control  Unknown
#> 2 Automobile, Station Wagon   Going Ahead          Driving Properly  Unknown
#> 3                     Other          <NA>                      <NA>     <NA>
#> 4                Motorcycle Turning Right          Driving Properly   Normal
#> 5 Automobile, Station Wagon       Stopped          Driving Properly   Normal
#>   PEDTYPE PEDACT PEDCOND CYCLISTYPE CYCACT CYCCOND PEDESTRIAN CYCLIST
#> 1      NA     NA      NA         NA     NA      NA         NA      NA
#> 2      NA     NA      NA         NA     NA      NA         NA      NA
#> 3      NA     NA      NA         NA     NA      NA         NA      NA
#> 4      NA     NA      NA         NA     NA      NA         NA      NA
#> 5      NA     NA      NA         NA     NA      NA         NA      NA
#>   AUTOMOBILE MOTORCYCLE TRUCK TRSN_CITY_VEH EMERG_VEH PASSENGER SPEEDING
#> 1        Yes        Yes    NA            NA        NA        NA       NA
#> 2        Yes        Yes    NA            NA        NA        NA       NA
#> 3       <NA>        Yes    NA            NA        NA        NA       NA
#> 4       <NA>        Yes    NA            NA        NA        NA       NA
#> 5        Yes        Yes    NA            NA        NA        NA       NA
#>   AG_DRIV REDLIGHT ALCOHOL DISABILITY HOOD_158            NEIGHBOURHOOD_158
#> 1     Yes      Yes      NA         NA      146                 Malvern East
#> 2     Yes      Yes      NA         NA      146                 Malvern East
#> 3    <NA>     <NA>      NA         NA      128 Agincourt South-Malvern West
#> 4    <NA>     <NA>      NA         NA      128 Agincourt South-Malvern West
#> 5     Yes     <NA>      NA         NA       73                    Moss Park
#>   HOOD_140                  NEIGHBOURHOOD_140 DIVISION
#> 1      132                      Malvern (132)      D42
#> 2      132                      Malvern (132)      D42
#> 3      128 Agincourt South-Malvern West (128)      D42
#> 4      128 Agincourt South-Malvern West (128)      D42
#> 5       73                     Moss Park (73)      D51
# }