Because we use R to run our financial and statistical algorithms but enriching the point data would be the first step.
I think I might have 3 options here:
1- I already have a geoprocessing service that does what I need. It runs against a mapservice and enriches a point feature layer with the fields I want from the raster datasets, so I could use this service and create a separate R geoprocessing tool for the financial calculations and combine the two in a new geoprocessing tool using the model builder
2- I could do the whole thing in Python as you suggested but this would be the least preferred option because of duplication of work and would be a step away from the current process
3- Do the whole thing directly in R maybe using the rGDAL library and publish it using r-bridge
I don't know much about r and I'm very new to r-bridge so I need to figure out what's the best way to go.
Any suggestion is appreciated.
Option 1 sounds like the best option since your financial and statistical calculations are already in R and you already have a gp service created.
I suspect I will let the the R-bridge people weigh in to suggest best ways to combine what you have already
Based on your description, I think option 1 would be the easiest way to go since you already have a geoprocessing service that does what you need. Otherwise, you would probably need to recreate all of the geoprocessing service functionality in R, which would require time and effort that wouldn't necessarily get you any added benefits (assuming you are looking to exactly replicate functionality). ModelBuilder will allow you to easily pass the results from the geoprocessing service into your R script tool to perform your financial calculations before ultimately returning the final results for you in your map to either further analyze or visually examine.
For reference though, there is an R package known as reticulate which allows you to call Python from within R. This might be of interest for you down the road. We have done some limited testing of it and found it to work well.
In general, I am a fan of not duplicated work that already exists and does what you need but, hopefully this helps to give you some ideas of options.
Thank you all for your help.
I decided to go for option 1, create a model where the input comes from a python script however I got stuck.
When I try to pass the input parameter of the R script from the output parameter of the Python script I get an error 000735. It looks like it's not recognizing the input.
In my R code i call and read the input parameter in this way:
data <- arc.open(InputData)
data_df <- arc.select(data, fields = c("*"))
Any idea of what I am doing wrong?