Using the R-ArcGIS Bridge in Jupyter

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 ‘1.0.1.208’. 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

Switching Environments

Next, I switched to the cloned environment by deactivating the arcgispro-py3 environment and activating the arcgispro-r environment.

deactivate
activate arcgispro-r

Installing R-Essentials

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

After I installed r-essentials, when I launched my Jupyter Notebook, I had the option to create a Python or an R notebook.

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 ‘1.0.1.208’, 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

Get an email summary of my blog posts (four per year):

Join email newsletter

... or follow the blog here:

See Also