Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions _posts/2019-03-11-RPyGeo-1_0_0.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
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](https://raw.githubusercontent.com//r-spatial/r-spatial.org/gh-pages/_rmd/2019-03-11-RPyGeo-1_0_0.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](https://www.esri.com/en-us/arcgis/about-arcgis/overview) 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](https://cran.r-project.org/web/packages/reticulate/index.html)
R package into the R session

``` r
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.

``` 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.

``` r
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.](/images/rpygeo1.png)

``` 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.

``` r
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](https://cran.r-project.org/web/packages/RPyGeo/RPyGeo.pdf).
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](https://github.com/r-spatial/RPyGeo) or help us fix
them via a pull request.
92 changes: 92 additions & 0 deletions _rmd/2019-06-03-RPyGeo-1_0_0.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
layout: post
title: "RPyGeo 1.0.0"
date: "`r format(Sys.time(), '%d %B, %Y')`"
comments: true
author: Marc Becker
categories: r
---

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>

[DOWNLOADHERE]

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](https://www.esri.com/en-us/arcgis/about-arcgis/overview) is one of the leading commercial GIS applications and is being developed by Esri since 1999.

ArcGIS offers access to its geoprocessing tools via a Python site-package called _ArcPy_.
The new version of _RPyGeo_ reads the site-package via the [reticulate](https://cran.r-project.org/web/packages/reticulate/index.html) package into the R session.

If you want to run the following examples you need a working _ArcMap_ or _ArcGIS Pro_ installation.

```{r, eval=FALSE}
library("RPyGeo")
library("sf")
library("raster")
library("magrittr")

data(dem, package = "RQGIS")
writeRaster(dem, file.path(tempdir(), "dem.tif"), format = "GTiff")
```

After the environment has been set using `rpygeo_build_env()`, all geoprocessing tools of _ArcGIS_ are available in R.

```{r, eval=FALSE}
arcpy <- rpygeo_build_env(workspace = tempdir(),
overwrite = TRUE)
```

The ArcPy functions can be accessed via the `$` operator.
Autocompletion of all available functions is supported.

```{r, eval=FALSE}
arcpy$Slope_3d(in_raster = "dem.tif", out_raster = "slope.tif")
```

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

```{r, eval=FALSE}
slope <- rpygeo_load("slope.tif")

plot(slope)
```

<img src="../images/rpygeo1.jpg", width="100%" style="display: block; margin: auto;" />
*Figure 1: Slope computed with Slope_3d() and plotted in R.*

The pipe operator can be used to chain ArcGIS geoprocessing tools and _RPyGeo_ functions.

```{r, eval=FALSE}
arcpy$Slope_3d(in_raster = "dem.tif", out_raster = "slope.tif") %>%
rpygeo_load()
```

Map algebra expressions can be used in _RPyGeo_ with special operators to modify _ArcPy_ raster objects.
The resulting temporary files can be saved to the hard disk using the function `rpygeo_save()`.

```{r, eval=FALSE}
ras <- arcpy$sa$Raster("dem.tif")

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

With the new version many other utility functions are added.
Help files for all _ArcPy_ functions can be viewed directly inside R using `rpygeo_help()`.
`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](https://r-arcgis.github.io), 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 are integrated into geoprocessing scripts, which can be run as geoprocessing tools from within _ArcGIS_.
The user can add a user interface to the geoprocessing tool or use it as a part of a ModelBuilder workflow in _ArcGIS_.
However, no extra functionality is added for the R user.
The _R-ArcGIS_ Bridge cannot run geoprocessing tools from within R, whereas _RPyGeo_ offers almost all geoprocessing tools of _ArcGIS_ directly from the R session.
The _R-ArcGIS_ Bridge is developed for users, who want to process their whole workflow from within _ArcGIS_, whereas _RPyGeo_ is developed for R users who want to integrate a geoprocessing tool into their R workflow.

For detailed instructions on how to use _RPyGeo_ we would like to refer to its [vignette](https://cran.r-project.org/web/packages/RPyGeo/RPyGeo.pdf).
It includes a tutorial with all essential _RPyGeo_ functions and the necessary data to run the above examples.

The source code of _RPyGeo_ is now hosted on [Github](https://github.com/r-spatial/RPyGeo) within the [r-spatial](https://github.com/r-spatial/) organization.
Binary file added images/rpygeo1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.