Skip to contents

Portal-agnostic sibling to morie_datasets_tps_arcgis_hub_by_id(). Works for ANY ArcGIS Online item GUID (not just TPS Hub catalog entries). Same five format paths (json / geojson / csv / shapefile / fgdb).

Usage

morie_datasets_arcgis_item_by_id(
  item_id,
  format = "json",
  where = "1=1",
  max_features = NULL,
  layer_idx = 0L,
  dest = NULL
)

Arguments

item_id

32-char hex GUID.

format

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

where

Optional SoQL-style WHERE for the FeatureServer query. Default "1=1".

max_features

Optional row cap.

layer_idx

Integer layer index (default 0L).

dest

Optional destination path for binary downloads.

Value

A data.frame (json / csv), parsed GeoJSON list, or file path (binary).

Details

The hub_id is ALWAYS resolved live (via the items API) because there's no included catalog for non-TPS items. If you find yourself calling this against the same item repeatedly, consider adding a named wrapper (e.g. the shipped morie_datasets_toronto_zoning_per_neighbourhood wraps EsriCanadaEducation's af06159170914808983959df6163fc86 with included fixtures for offline use).

Examples

# \donttest{
df <- try(morie_datasets_arcgis_item_by_id(
  "af06159170914808983959df6163fc86",
  format = "json"
))
if (!inherits(df, "try-error")) head(df)
#>   OBJECTID           Neighbourhood Total_Area Total_Population Pop_Males
#> 1        1          Yonge-St.Clair        1.2            11655      5235
#> 2        2 York University Heights       13.2            27715     13580
#> 3        3        Lansing-Westgate        5.4            14640      6950
#> 4        4      Yorkdale-Glen Park        5.9            14685      6750
#> 5        5     Stonegate-Queensway        7.9            24690     11935
#> 6        6  Tam O'Shanter-Sullivan        5.5            27390     12840
#>   Pop_Females Pop0_4years Pop5_9years Pop10_14years Pop15_19years Pop20_24years
#> 1        6420         395         345           235           285           645
#> 2       14125        1645        1385          1380          1750          3280
#> 3        7695         845         725           745           795           965
#> 4        7940         640         690           815           835           845
#> 5       12745        1395        1235          1265          1295          1190
#> 6       14555        1460        1380          1370          1560          1765
#>   Pop25_29years Pop30_34years Pop35_39years Pop40_44years Pop45_49years
#> 1          1355          1125           900           860           755
#> 2          2815          2120          1800          1820          1940
#> 3          1185          1290          1170          1175          1150
#> 4           890           895           860          1050          1085
#> 5          1270          1575          1865          1990          2190
#> 6          1665          1605          1850          1965          2230
#>   Pop50_54years Pop55_59years Pop60_64years Pop65_69years Pop70_74years
#> 1           715           760           820           755           525
#> 2          1750          1335          1150           870           890
#> 3          1035           855           750           515           405
#> 4          1030           850           765           610           690
#> 5          2120          1790          1515           940           830
#> 6          1925          1655          1435          1235          1220
#>   Pop75_79years Pop80_84years Pop85yearsandover Seniors55andover
#> 1           445           365               395             4075
#> 2           825           545               395             6010
#> 3           360           330               360             3565
#> 4           755           690               700             5070
#> 5           755           635               825             7295
#> 6          1190           945               970             8595
#>   Seniors65andover Child0_14 Youth15_24 HomeLanguageCategory Language_Chinese
#> 1             2505       985        925                11445              250
#> 2             3545      4405       5040                26340             1750
#> 3             1960      2300       1755                14285              995
#> 4             3450      2140       1690                13685              640
#> 5             3985      3895       2465                23980              330
#> 6             5520      4170       3305                26195             8220
#>   Language_Italian Language_Korean Language_Persian Language_Portuguese
#> 1              120              55              120                  55
#> 2             2280             265              370                 285
#> 3              165             580              630                  90
#> 4             2950              50               70                 810
#> 5              755             135               65                 555
#> 6              340             170              420                  70
#>   Language_Russian Language_Spanish Language_Tagalog Language_Tamil
#> 1              180              230               95             10
#> 2              430             1475              930           1175
#> 3              770              320              460             15
#> 4               85              625              605            120
#> 5              635              455              260             25
#> 6               65              315              820           1150
#>   Language_Urdu
#> 1            10
#> 2           580
#> 3            45
#> 4            60
#> 5            35
#> 6           780
# }