I was sitting in a presentation a few weeks ago on the R-ArcGIS bridge and I had a question: “Can I use the R-ArcGIS bridge in my Jupyter Notebook?” When I asked one of the presenters if this would be possible, he said, “Yes”. So, after the presentation, I set out to get the R-ArcGIS bridge running in Jupyter.
Installing the ArcGIS-R Bridge
The first thing I did was install the R-ArcGIS bridge. I installed it using ArcGIS Pro by following the installation instructions. I am currently using R-3.4.2 and arcgisbinding ‘22.214.171.124’. I can verify this by going to the Geoprocessing tab in the Options section in ArcGIS Pro.
Cloning My arcgispro-py3 Environment
I did not want to break my arcgispro-py3 conda environment (the default ArcGIS Pro Python environment) so the first thing I did was clone the environment. I named the cloned environment arcgispro-r. I did this from the command line using
conda create --name arcgispro-r --clone arcgispro-py3
Next, I switched to the cloned environment by deactivating the arcgispro-py3 environment and activating the arcgispro-r environment.
deactivate activate arcgispro-r
Then, I installed r-essentials, a bundle of over 80 of the most used R packages created by the Anaconda team.
conda install -c r r-essentials
Running arcgisbinding in Jupyter
I created an R notebook. To test whether the ArcGIS-R bridge is installed and accessible to my notebook, I loaded the arcgisbinding package and checked the product version number and there it was, package version ‘126.96.36.199’, the same one I see listed in ArcGIS Pro above!
But Does It Work?
Yes, I can use the arcgisbinding package to read spatial data into R! In order to test whether I could read in data, I used arc.open to read in a point feature class of seagrass data. I was also able to use arc.select to put that feature class into a dataframe.
I shared my sample notebook on GitHub at the repo arcgisbinding-in-jupyter. I am interested to know if there is anyone else out there who has tried this or is interested in using R, ArcGIS, and Jupyter. If you are, let me know!
~ A guest post by Gregory Brunner