Can R-bridge arc.write to a Feature Service?

2985
12
Jump to solution
06-18-2021 10:05 AM
AndrewPadilla
Frequent Contributor

Hello R-ArcGIS community,

I am new to ArcGIS R-Bridge, but have moderate experience in R and ArcGIS. I am looking for a way to use R to write to a feature service. The R arcgisbindings package allows one to read a feature via arc.open but it doesn't seem to allow writing back (arc.write) to the feature service. Is there a way to accomplish this? I am looking to QA/QC the data in R as I find it more simple. Any help would be great. Thanks for your time.

0 Kudos
1 Solution

Accepted Solutions
BenjaminDorsey
Occasional Contributor

Hey Andrew,
I have been working through a few similar challenges with bridge. My solution right now is to use R to execute python commands. With Arc Py and the ArcGIS python libraries we can do pretty much anything. I have attached a super simple R script and Python script. That demonstrates a second approach - which is to tell R to run a python script once you have a Feature Class written to a temp data base. The python script can overwrite or append the data to a Feature Service.  Make sense?

View solution in original post

12 Replies
by Anonymous User
Not applicable

Hey Andrew,

We do not have a direct way to write to a portal, yet. The workaround would be:

1. Write feature as a feature class in a gdb using arc.write

2. Use the Share ribbon in ArcGIS Pro to share that feature class as a feature service.

I know this is not an automated approach, however. If you host data frequently you can perform the above step once and put the Share step in a scheduler in Pro.

0 Kudos
AndrewPadilla
Frequent Contributor
Hi Orhun,

Thanks for your quick response. I haven't shared a feature class before, would I be able to write over an existing feature service or would it need to be a few one?

Thanks,
Andy
0 Kudos
by Anonymous User
Not applicable

Hi Andy - thanks for the question.  Yes you can easily overwrite an existing web layer using either of the two workflows outlined here:

https://pro.arcgis.com/en/pro-app/latest/help/sharing/overview/overwrite-a-web-layer.htm

thanks!

-Nick Giner

0 Kudos
BenjaminDorsey
Occasional Contributor

Hey Andrew,
I have been working through a few similar challenges with bridge. My solution right now is to use R to execute python commands. With Arc Py and the ArcGIS python libraries we can do pretty much anything. I have attached a super simple R script and Python script. That demonstrates a second approach - which is to tell R to run a python script once you have a Feature Class written to a temp data base. The python script can overwrite or append the data to a Feature Service.  Make sense?

AndrewPadilla
Frequent Contributor

Hi Benjamin,
Thanks for providing me with your solution. Yes, it does make sense. I have been working with some python scripts in R so I think it shouldn't take too much.
Cheers,
Andy

0 Kudos
NicholasGiner1
Esri Contributor

@BenjaminDorsey@AndrewPadilla 

Finally, I have a positive response to this! We've recently developed and announced a new R metapackage {arcgis} with several subpackages that can read AND write feature services, amongst many other capabilities.   The goal of the project is to provide an R interface to ArcGIS location services.

  • It's free, open-source, and available on CRAN
  • It does not require an ArcGIS Pro installation/license (unlike {arcgisbinding})
  • {arcgisbinding} can still be used for working with local data or developing R-driven geoprocessing tools
  • We'll continue to develop {arcgis} and {arcgisbinding}, so stay tuned!

Blog article announcing the new R metapackage

Link to documentation + getting started and tutorials

BenjaminDorsey
Occasional Contributor

Wonderful news! I look forward to trying it out!

 

0 Kudos
AndrewPadilla
Frequent Contributor
That sounds great, thank you for the update. I will give it a go and see how it works!
0 Kudos
AndrewPadilla
Frequent Contributor

Hi @NicholasGiner1 ,

I attempted to install the new library(arcgis) as outline in the documentation. However, It seems that the layers have been removed from the CRAN repository (https://cran.r-project.org/web/packages/arcgis/index.html😞

 

Package ‘arcgis’ was removed from the CRAN repository.

Formerly available versions can be obtained from the archive .

Archived on 2024-08-19 as requires archived package 'arcgislayers'.

A summary of the most recent check results can be obtained from the check results archive .

Please use the canonical form https://CRAN.R-project.org/package=arcgis to link to this page.

Is there a work around?

 

Thank you for your time,

Andy