Sharing R-script in Arcgis server

1396
8
10-07-2017 02:38 AM
SebastiánVázquez1
New Contributor II

Hello,

I wonder if there is any chance to share an R-script as a geoprocessing service. I suppose it would be necessary to install R in the server. Would there be any document explaining the steps? I've been searching for it but couldn't find any.

Any help will be very appreciated.

Best regards

Sebastián

0 Kudos
8 Replies
ShaunWalbridge
Esri Regular Contributor

Sebastián,

You're right that we haven't documented this, I'll add an issue to my list for adding instructions on this. Here's the basic process:

  1. Install R on the Server. You'll want to make sure to install the 64-bit version of R.
  2. Install any packages you intend on using in R (you can also do this in your geoprocessing script, but it's best practice to do it beforehand).
  3. Install the R-ArcGIS Bridge on Server. You can do this through R directly, see this screencast.
  4. Create your Geoprocessing Service that references R as you would create a Python service. With the necessary pieces in place, it should execute like any other GP Service.

Let us know if you have any further questions,

Cheers, Shaun

SebastiánVázquez1
New Contributor II

Thank so much you for response, Shaun

I would be grateful if you could answer one more question. What versions of arcgis server will support it? I suppose it must be related to supported desktop versions.

Best regards,

Sebastián

0 Kudos
ShaunWalbridge
Esri Regular Contributor

Sebastián, no problem, happy to help. Yes, you're right -- it's supported in the same versions of Server as Desktop. So Server 10.3.1 or newer will work.

Cheers, Shaun

GiacomoFavaron
New Contributor III

This is the only post/documentation I can find about running geoprocessing services based on R scripts on Server but it doesn't work for me.

I followed the steps but when I try to install R-ArcGIS Bridge on Server I gives me an error message saying that it cannot find ArcGIS Pro.

Do I have to install Pro on the same environment where ArcGIS Server is? I have 10.5 

FrancescoTonini2
Occasional Contributor II

Everyone,

I have my Amazon AWS deployment up and running with an ArcServer site and a Web AppBuilder (Dev Edition) using R-based GP services without any of the issues listed above. I am currently using ArcGIS 10.4.1 and R 3.4.0. Maybe not the latest rbridge but I would say 2-3 sub versions behind the latest. R was installed using the dual 32- and 64-bit installer from CRAN since the whole architecture like Shaun says has to be 64-bit for it to work along with ArcServer.

Not sure about the specific error you are reporting since that might be more appropriate for an ESRI tech person to answer you. In my case, I did not receive any error and have a few GP services published using R and the R-bridge. The only thing that took a while to figure out to make it work was the ScratchFolder output...in the R script you want to use $scratchWorkspace from the arcgisbindings package, or the derived output of a script won't be correctly written and throw an error. See this GeoNet blog discussion about it.

0 Kudos
GiacomoFavaron
New Contributor III

Thanks for your suggestion Francesco.

I did the same you did with the R installers and have the 64-bit version on server. However, when I tried to install arcgisbinding in R on the server I got the following:

> utils:::menuInstallLocal()

package ‘arcgisbinding’ successfully unpacked and MD5 sums checked

> library(arcgisbinding)

*** Please call arc.check_product() to define a desktop license.

> arc.check_product()

Error: Could not bind to a valid ArcGIS Pro installation.

Do I need to have ArcGIS Pro installed on the server as well? 

I have a ticket open with ESRI but they are not the fastest to answer.

I have the same arcgisbinding_1.0.1.232 version on both desktop and server

0 Kudos
FrancescoTonini2
Occasional Contributor II

Did you follow the normal ArcMap installation procedure for the rbridge (using their instructions to install rbridge from the ArcToolbox)? I did not even go into R to install any library manually...I just installed R and then followed ESRI's procedures from within ArcMap to install the whole R-bridge components. I am not sure about that requirement, but I do not think you need to have ArcGIS Pro for Rbridge to work...maybe the others here (Shaun) can help better on why this is happening...Keep in mind that R-ArcGIS is an external ESRI project and I was told more than once that normal ESRI technical tickets do not cover any issues related to external products, which is a bummer. I think you should keep trying getting in touch with Shaun, Marjean or any other ESRI project staff on GeoNet and/or on Rbridge Github to have a faster answer...

0 Kudos
SimonSuo1
Esri Contributor

That behavior is expected because there is no ArcMap or Pro on the server machine. However, if you go ahead and publish a web tool with an R script in it, it shouldn't affect the web tool running.

0 Kudos