R-ArcGIS / r-bridge

Bridge library to connect ArcGIS and R, including arcgisbinding R library.
Apache License 2.0
118 stars 26 forks source link

Can you do a wildcard search instead of supplying a feature layer's name in the URL for arc.open()? #93

Open Walshe-d opened 2 weeks ago

Walshe-d commented 2 weeks ago

This is an improvement/question not a bug. I have tried to search for this functionality or a work around but I haven't been able to find anyone else who wants to do this.

I am using this package to create local copies of geodatabases as backups that are currently stored in Arcgis online. I think it would be great if you could do a wildcard search for all the layers with a key term(s) in the feature layer's name so that you could loop through each layer and download them.

For example, I have three layers all associated with one project: Project1_Feature_Layer1, Project1_Feature_Layer2, Project1_Feature_Layer3 and the the current process is to specify the layer name as such: flayer1 <- arc.open("https://arcgis.com/insert_your_service/arcgis/rest/services/Project1_Feature_Layer1/FeatureServer/0") flayer2 <- arc.open("https://arcgis.com/insert_your_service/arcgis/rest/services/Project1_Feature_Layer2/FeatureServer/0") flayer3 <- arc.open("https://arcgis.com/insert_your_service/arcgis/rest/services/Project1_Feature_Layer3/FeatureServer/0")

However if we could search for all layers associated with the Project with a wildcard such as something like this: flayers <- arc.search("https://arcgis.com/insert_your_service/arcgis/rest/services/Project1*/FeatureServer/") that would make looping through each layer a lot easier.

Is this already built in and I've missed it? Is it possible to do?

scw commented 2 weeks ago

Nice thought! I think the arcgislayers package is the right place for this functionality since it has aspirations to cover more workflows related to interacting with the REST API than arcgisbinding itself does. There's an issue for search here: https://github.com/R-ArcGIS/arcgislayers/issues/22

If you wanted to do this today with existing code, you might look at the Python API which has the capabilities to search and download today, here's an example backing up services that might prove useful.