4

I can successfully connect to an ArcGIS Pro feature dataset stored on my local computer in a file geodatabase in R like so:

library(arcgisbinding)
library(sf)
arc.check_product()

districts <- arc.data2sf(arc.select(arc.open("Maps/MyProject.gdb/districts"))) 

I'm trying to figure out whether it is possible to connect to files that are stored and updated on ArcGIS Online. These files are not "public", they are only available to myself and my team. Essentially, features that are part of "My Content" online.

I've tried the following using the URL available on the feature's page, but no luck (this is not a 'real' URL):

test <- arc.data2sf(arc.select(arc.open(
"https://services1.arcgis.com/jsdf8234sdfs/arcgis/rest/services/districts/FeatureServer")))

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘arc.select’ for signature ‘"arc.workspace_impl"’

2 Answers 2

6

After a lot of mucking around, I figured it out:

In ArcGIS Pro, right-click on the layer and choose "Properties". Go to the "Source" tab.

In the table, copy the "Url", e.g.,

https://services1.arcgis.com/sdfkjh234uwrhfs/arcgis/rest/services/service_b2348hwiskhgh4578kjsi45iuskhs/FeatureServer

To this Url, add the name of the Feature Class. It may actually just be a number. My final character string looked like this:

https://services1.arcgis.com/sdfkjh234uwrhfs/arcgis/rest/services/service_b2348hwiskhgh4578kjsi45iuskhs/FeatureServer/0

Then, ensure you are connected to a valid license in R and copy-paste the URL into where you would normally put a fgdb:

library(arcgisbinding)
arc.check_product()

test <- arc.data2sf(arc.select(arc.open(
"https://services1.arcgis.com/sdfkjh234uwrhfs/arcgis/rest/services/service_b2348hwiskhgh4578kjsi45iuskhs/FeatureServer/0")))
0

I came across a similar issue and wanted to note that you can get the link via another method. If you use arc.open and use the URL from the ArcGIS online (as above) you get a container class. This has a "children" slot which contains the ID of the feature layer.

You then use arc.open with the ID pasted after the URL. So in the example https://services1.arcgis.com/jsdf8234sdfs/arcgis/rest/services/districts/FeatureServer/**ID of Feature Layer**

This worked for me but I have not tested it much or on open access feature layers just my own.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.