Can a published R-ArcGIS based tool import packages?

55
0
03-25-2024 12:36 PM
Labels (2)
JohnFay_DukeUniv
New Contributor

Has anyone successfully run an R-based script tool on an Enterprise server -- that imports the sf package? Or even the stats package. I’m having this issue when trying to run an R-based script tool as a published geoprocessing service. I’m using ArcGIS 3.2.1, R 4.3.3, and ArcGIS Enterprise 11.2.

  • I created a R script that simply queries a feature class of US Counties for features with a user supplied FIPS code and returns the subset feature class (attached). I then created an ArcGIS Pro geoprocessing interface for this tool.
  • I created a second version of the script and geoprocessing tool, one which calls the `arc.data2sf()` function (line 60 is uncommented in attached script).
  • Both versions of the tool run perfectly fine as a local geoprocessing models, complete with showing messages generated by the script.
  • I then created service definitions from the successful runs of each model in the history, choosing the following options:
    • Save as Offline Service Definition
    • General: Reference all data
    • Configuration: Upload, Synchronous
  • I then published these service definitions as two separate services on my ArcGIS Enterprise Server
  • The version with `arc.data2sf()` runs fine, though no messages are shown.
  • The version with `arc.data2sf()` raises the error `This function requires the sf package.`

 

I do have R (v 4.3.3) installed on the server machine. The `arcgisbindings` and the `sf` package are both installed; I installed them while logged into the server machine using the ArcGIS Enterprise service account. I can confirm the sf package is installed by running `library(sf)` at the R command prompt, which runs without warning or error.

 

I’ve worked with three separate ESRI technical support specialists over the last month on this issue. However, I don’t believe any have worked with R. In the end, they told me that ESRI does not actually support the R-ArcGIS Bridge on an Enterprise Server (despite it showing up quite clearly in their Enterprise documentation).

 

I’d really like to know whether anyone has been able to get R-based tools that call 3rd party packages to work in a published geoprocessing service as that would suggest it’s an issue with my set up. And of course, if it is an issue with my set up, I’d love pointers on what I might tinker with.

 

Thanks for any advice you can provide.

Tags (2)
0 Replies