Skip to contents

Wraps the City of Chicago "Boundaries - Wards (2023-)" open dataset (Socrata resource id sp34-6z76; portal landing https://data.cityofchicago.org/Facilities-Geographic-Boundaries/Boundaries-Wards-2023-/sp34-6z76). 50 wards in the current City Council district map. Resolves the ward foreign key carried by every morie_datasets_chicago_crime() row.

Usage

morie_datasets_chicago_wards(
  offline = TRUE,
  geometry = FALSE,
  max_features = NULL,
  resource_id = NULL,
  paginate = FALSE,
  page_size = 1000L,
  max_pages = 200L,
  app_token = NULL
)

Arguments

offline

If TRUE (default), read the bundled fixture.

geometry

If TRUE and offline = FALSE, include the the_geom MultiPolygon.

max_features

Optional row cap.

resource_id

Optional view id override (default "sp34-6z76").

paginate

Logical; 3OO/3QQ opt-in pagination via LIMIT n OFFSET m.

page_size

Per-page row count when paginating.

max_pages

Safety net.

app_token

Optional Socrata app token (sent as X-App-Token).

Value

A data.frame with 3 attribute cols (offline) or 4 including the_geom (live, geometry = TRUE).

Details

SODA3-only. The SODA2 endpoint /resource/sp34-6z76.json returns empty objects – this is a filtered/derived view on Socrata. Live mode uses SODA3 (/api/v3/views/sp34-6z76/query.json) via .morie_dataset_soda3_query().

Offline mode reads a bundled 50-row attribute-only fixture (inst/extdata/chicago_wards.csv: ward / shape_leng / shape_area). Live mode with geometry = TRUE also includes the the_geom MultiPolygon column.

References

City of Chicago Data Portal, "Boundaries - Wards (2023-)" (sp34-6z76).

Examples

df <- morie_datasets_chicago_wards(offline = TRUE)
head(df)
#>   ward shape_leng shape_area
#> 1    1  102569.70   69757594
#> 2   10  144026.60  548958843
#> 3   11   82824.46  142093460
#> 4   12   93073.34  116096508
#> 5   13   91758.17  117333022
#> 6   14   90165.80  143011019