Skip to content

Latest commit

 

History

History
103 lines (83 loc) · 3.68 KB

File metadata and controls

103 lines (83 loc) · 3.68 KB
author Marc Becker
categories r
comments true
date 11 March, 2019
layout post
title RPyGeo 1.0.0
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>

[view raw Rmd]

RPyGeo 1.0.0 has been released on 14.11.2018 on CRAN. The RPyGeo package establishes an interface to the geoprocessing tools of ArcGIS from within R. ArcGIS is the leading commercial geographic information system platform, which is developed by Esri since 1999.

ArcGIS offers access to it’s geoprocessing tools via a Python site-package called ArcPy. The new version of RPyGeo reads the site-package via the reticulate R package into the R session

arcpy <- rpygeo_build_env(workspace = tempdir(),
                          overwrite = TRUE,
                          extensions = "Spatial")

After a quick initialization, which usually finds the ArcGIS installation automatically, all geoprocessing tools of ArcGIS are available in R.

arcpy$Slope_3d(in_raster = "dem.tif", out_raster = "slope.tif")

The ArcPy functions can be accessed via the $ operator. All functions are listed after typing the $ operator in RStudio.

slope <- rpygeo_load("slope.tif")

plot(slope)

RPyGeo can load spatial objects stored in Esri’s proprietary geodatabases as well as files from the hard disk with the rpygeo_load() function.

Slope computed with Slope_3d() and plotted in R.

arcpy$Slope_3d(in_raster = "dem.tif", out_raster = "slope.tif") %>%
  rpygeo_load()

Both functions can be chained using the pipe operator. It is also possible to use the pipe operator to chain multiple geoprocessing tools togheter.

ras <- arcpy$sa$Raster("dem.tif") 

ras %rpygeo_+% 2 %>%
  rpygeo_save("dem_2.tif")

Map algebra expression can be used in RPyGeo with special operators to modify ArcPy raster objects. The resulting temporary files can be saved to the hard disk with the helper funtion rpygeo_save().

With the new version many other utility functions are added. Help files for all AcrPy functions can be viewed directly inside Rstudio with the rpygeo_help() function. rpygeo_search() returns all available geoprocessing functions that contain a specified search term. The new functions try to provide a seamless workflow between ArcGIS and R.

In 2015 Esri released the R-ArcGIS Bridge, a software that also connects ArcGIS and R. Essentially, the R-ArcGIS Bridge offers read, write and conversion functions to transfer data from ArcGIS to R and vice versa. The idea is to use the large number of R packages to solve spatial problems, which cannot be solved with ArcGIS alone. R scripts can be run as geospatial scripts with an interactive user inferface from within ArcGIS. However, no functionality is added for the R user. The R-ArcGIS Bridge cannot run geoprocessing tools from within R, whereas RPyGeo offers allmost all geoprocessing tools of ArcGIS directly from the R session.

For a detailed instruction on how to use RPyGeo we would like to refer to the vignette. It includes a tutorial with all essential RPyGeo functions and the necessary data to run the above examples.

The devolepment of RPyGeo is now integrated into the r-spatial.org community. If you find any bugs please report them at our new development repository r-spatial/RPyGeo or help us fix them via a pull request.