Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support providing IDs only #110

Open
JosiahParry opened this issue Dec 1, 2023 · 2 comments
Open

Support providing IDs only #110

JosiahParry opened this issue Dec 1, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@JosiahParry
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
The python api supports providing only an item id see (https://developers.arcgis.com/python/guide/download-data/). We require a full URL. Perhaps we can handle both scenarios.

Describe the solution you'd like

arc_open("a04933c045714492bda6886f355416f2") should be able to open the layer listed at
https://www.arcgis.com/sharing/rest/content/items/a04933c045714492bda6886f355416f2?f=pjson

library(httr2)
library(arcgislayers)

item_url <- "https://www.arcgis.com/sharing/rest/content/items/342a05f149004bb0ab43eb976682beba?f=json"

req <- request(item_url)
resp <- req_perform(req)
res <- resp_body_json(resp)


paste0(
  "https://services1.arcgis.com/",
  res$orgId,
  "/arcgis/rest/services/",
  res$name,
  "/FeatureServer/0"
) |> 
  URLencode() |>
  arc_open()
#> <FeatureLayer <124 features, 8 fields>>
#> Name: Obesity_2013to2014_CHISNE
#> Geometry Type: esriGeometryPolygon
#> CRS: 2229
#> Capabilities: Query

Created on 2023-12-01 with reprex v2.0.2

Additional context

What about item types that are not a supported service like a flat file?

@JosiahParry JosiahParry added the enhancement New feature or request label Dec 1, 2023
@JosiahParry
Copy link
Collaborator Author

+1 from @daranzolin

@JosiahParry
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant