Skip to content

Commit

Permalink
update per sugestions
Browse files Browse the repository at this point in the history
  • Loading branch information
JosiahParry committed Jan 8, 2024
1 parent f3e65f1 commit d11d5bb
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 46 deletions.
58 changes: 45 additions & 13 deletions arcgisbinding/installing-arcgisbinding.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,27 @@ title: "Installing `{arcgisbinding}`"
and R. In order to use it, you must have a installation of ArcGIS Pro with a valid
licenses as well as a supported version of R.

<!--
Nick says:
While we recommend that you download and install the latest version of R for Windows (link here - https://cran.r-project.org/bin/windows/), the R-ArcGIS Bridge supports all previous versions or R (link here - https://cran.r-project.org/bin/windows/base/old/) back to version 3.2.2.
Josiah: Dima wants to drop support for old versions of R i think going only back to 3.6.3
-->

:::{.callout-note}
If you do not currently have access to ArcGIS Pro, you can [sign up for a free 21-day trial version](https://www.esri.com/en-us/arcgis/products/arcgis-pro/trial).
:::

## Install within ArcGIS Pro (recommended) {#from-pro}

If you are working in Pro 2.0 or beyond you have access to the built-in ArcGIS bridge installer which streamlines the process of installing **arcgisbinding**. It allows you to select your desired installation of R, and makes checking the bridge for updates easy. To install the bridge in this scenario, you will do the following:
If you are working in ArcGIS Pro 2.0 or beyond you have access to the built-in installer <!-- Nick prefers R-ArcGIS Bridge installer, i think that is too broad and continues to conflate remove--> which streamlines the process of installing **arcgisbinding**. It also allows you to select your desired installation of R, and makes checking the bridge for updates easy. To install the bridge in this scenario, you will do the following:

- Open ArcGIS Pro and click on the 'Project' tab in your project.
- Select `Options` on the blue, left-hand side panel and in the pop-up window, under Application, select 'Geoprocessing'.
- Under the R-ArcGIS Support options, select your desired R home directory.

<!-- TODO Nick wants screen shot here -->

:::{.callout-warning collapse="false"}

Note: All versions of R installed on your computer will appear in the drop-down menu. Make sure the version you select is R 3.2.2 or later. However, if you have installed R to a location other than the default, you might need to navigate to that location using the browse button.
Expand All @@ -26,9 +39,11 @@ Note: All versions of R installed on your computer will appear in the drop-down

- A progress bar will appear to inform you of the status of the installation before showing an Output Message to report the final status. If you scroll down, you should see that the package **arcgisbinding** was successfully installed.

## Install from R
<!-- TODO Nick wants a screen shot -->

## Install from R {#from-r}

Alternatively, you can install the binding directly from R if you so wish! Open RStudio, VS Code, or your favorite text editor and run the following from the console.
Alternatively, you can install **arcgisbinding** directly from R. Open RStudio, VS Code, or your favorite text editor and run the following from the console.

```r
install.packages(
Expand All @@ -37,33 +52,50 @@ Alternatively, you can install the binding directly from R if you so wish! Open
type = "win.binary"
)
```
This will install the package binary directly from our GitHub repository which stores the builds of the package. Note that installing this way still has the same requirements. The package is a Windows binary and must be installed on a Windows computer.
This will install the package binary directly from the [R-ArcGIS GitHub repository](https://github.com/R-ArcGIS/r-arcgis.github.io/tree/master/bin/windows/contrib) which stores the builds of the package. Note that installing this way still has the same requirements. The package is a Windows binary and must be installed on a Windows computer.

## Offline Installation
## Offline Installation {#offline}

Many users of the R-ArcGIS Pro bridge (**arcgisbinding**) work in a completely air-gapped environment where downloading external packages from the internet is not possible.
Many users of **arcgisbinding** work in a completely air-gapped environment where downloading external packages from the internet is not possible.

In order to install **arcgisbinding** in an air-gapped environment you must first download the package on an internet enabled machine and ["sneakernet"](https://www.techopedia.com/definition/1880/sneakernet) it into your
offline environment.
In order to install **arcgisbinding** in an air-gapped environment you must first download the package on a machine with internet access and ["sneakernet"](https://www.techopedia.com/definition/1880/sneakernet) it into your offline environment.

To download the package go to https://r.esri.com/bin/ and choose the version of **arcgisbridge** that matches your version of R.
<!--
Nick: "However, I'm not sure if we need to be more formal/literal here."
Josiah: This is quite literate! If we try to be more specific we get ourselves in the business of telling customers how to migrate data from offline environments which are not. Some people temporarily open internet access. Sometimes they move to a thumbdrive, or even a cd.
-->

Once you've moved the zip file onto your air-gapped machine you can install it using the `install.packages()` command.
To download the package go to https://r.esri.com/bin/ and choose the version of **arcgisbinding** that matches your version of R.

Once you have downloaded and moved the zip file onto your air-gapped machine you can install it using the `install.packages()` command.

```r
install.packages("path/to/arcgisbinding_1.0.1.306.zip", repos = NULL)
```

:::{.callout-warning}
Note that depending on the version of the package you download, the file name will be different. Be sure the file path and name are accurate.
:::

## Verify your installation

Once you have the **arcgisbinding** installed, you can check if your installation was successful by loading the package.

```r
library(arcgisbinding)
arc.check_product()
```

This will print a message informing you of the version of ArcGIS Pro you are using. You do not need to install **arcgisbinding** again until you download a new version of R or wish to upgrade the package.

## Upgrading `{arcgisbinding}`

### Using ArcGIS Pro

If you have installed **arcgisbinding** from within ArcGIS Pro, follow the instructions for [installing within ArcGIS Pro](#from-pro).
If you have installed **arcgisbinding** from within ArcGIS Pro, follow the instructions for accessing ArcGIS Pro's R-ArcGIS Support options in the [installing within ArcGIS Pro section](#from-pro).

If you have previously installed **arcgisbinding**, you will see an installed message that lets you know the version of your **arcgisbinding** package and allows you to check for updates, download the latest version, or update from a file. Check for updates and ensure you have the latest version of the **arcgisbinding** package. If prompted to update, click `"Yes"` and the latest version will automatically be installed.


### Using R or offline

To upgrade your package using R or in an offline environment, repeat the steps above.
To upgrade your package using R or in an offline environment, repeat the steps above for either [installing from R](#from-r) or [offline installation](#offline).
32 changes: 16 additions & 16 deletions geoprocessing-tools.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ title: "Geoprocessing Tools"

## Overview

Much like a python geoprocessing (GP) script tool, R based script tools can be created
allowing you to create GP tools and toolboxes that utilize the power of R.
Much like a python geoprocessing (GP) [script tool](https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/basics/create-a-python-script-tool.htm), you can also create R-based GP script tools and toolboxes that utilize the power of R.

The basic anatomy of an R script GP tool is like so:

```{.r filename="my-geoprocessing-tool.R"}
Expand All @@ -15,17 +15,17 @@ tool_exec <- function(in_params, out_params) { # <1>
}
```
1. Two arguments capture input and output parameters
2. Output parameters are returned to be captured by Pro
2. Output parameters are returned to be captured by ArcGIS Pro

GP R script tools are defined in a standalone R script. The GP tool is defined
by a function called `tool_exec()`. `tool_exec()` take two and only two
R-base GP script tools are defined in a standalone R script. The GP tool is defined
by a function called `tool_exec()`. `tool_exec()` takes exactly two
arguments capturing input and output parameters. `tool_exec()` should always
return the output parameter argument.

## Input and Output Parameters

Additionally, there must be two arguments that correspond to input
parameters and output parameters. The conventional name of
There must be two arguments that correspond to input
parameters and output parameters. The conventional names of
these arguments are `in_params` and `out_params`. The first argument will
_always_ refer to the input parameters and the second to the outputs.

Expand Down Expand Up @@ -69,7 +69,7 @@ tool_exec <- function(in_params, out_params) {

You may have noticed that at the end of the `tool_exec()` function we are
returning the `out_params` object. If we do not return the output parameters
back to Pro—by returning `out_params`—the outputs cannot be captured and used
back to ArcGIS Pro—by returning `out_params`—the outputs cannot be captured and used
by Pro.

Notably, the output parameters are useful in linking one tool to another, for
Expand All @@ -79,9 +79,9 @@ See [Using R script tools with **`arcpy`**](#arcpy-integration)

### Parameter types

There are number of different type of parameters that can be provided to a
There are number of different parameter types that can be provided to a
geoprocessing (GP) tool. The type of parameter that is chosen determines how
that parameter will appear in the GP pane's UI. Each parameter type can be
that parameter will appear in the Geoprocessing pane. Each ArcGIS Pro parameter type can be
represented by a basic scalar R type: `integer`, `double`, `character`, `logical`, or
`NULL`.

Expand All @@ -90,9 +90,9 @@ A scalar value is a vector with only a single element.
:::


It is incumbent upon you to take these parameter inputs and use them appropriately in R. Not every type of parameter can be processed correctly by `arcgisbinding`. Below are some of the most common parameter types and how they are handled by `arcgisbinding`. This is not a complete enumeration by any means!
It is incumbent upon you to take these parameter inputs and use them appropriately in R. Not every type of parameter can be processed correctly by `arcgisbinding`. Below are some of the most common parameter types and how they are handled by `arcgisbinding`. This is not a complete enumeration by any means.

| Parameter Data Type | R type |
| ArcGIS Pro Parameter Type | R Data Type |
| --------- | ------ |
| String | `character` |
| Boolean | `logical` |
Expand All @@ -107,22 +107,22 @@ It is incumbent upon you to take these parameter inputs and use them appropriate

### Multiple Values

When selecting the `Multiple values` check box in the parameter data type UI, users
When selecting the `Multiple values` check box in the parameter data type dialog box, users
can then provide multiple inputs of that type.

![](images/gp-parameter-type.png)

When this is done, each of the input values will be contained inside of a list. If you have multiple values ticked for the `String` type, you will get a list of scalar character vectors.

**This is important** so it bears repeating! When users provide multiple values they will
be captured in R as a list of scalars. Meaning that if you have multiple `String` values
**This is important** so it bears repeating! When you provide multiple values they will
be captured in R as a list of scalars. This means that if you have multiple `String` values
you will not get a character vector with a length greater than one.

Take the below input for example

![](images/gp-multiple-strings.png)

In R we would get the `list("string 1", "string 2")` and **not** `c("string 1", "string 2")`.
In R we would get `list("string 1", "string 2")` and **not** `c("string 1", "string 2")`.

:::{.callout-tip}
To turn a list of scalars of the same type—e.g. double, integer, logical, or character—into a vector you can use `unlist()`. For example `unlist(list("string 1", "string 2"))` will give us `c("string 1", "string 2")`.
Expand Down
21 changes: 15 additions & 6 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,38 @@ _Building bridges between
:::
<hr>

The R-ArcGIS Bridge enables ArcGIS users to enrich their workflows by accessing thousands of open-source data science and statistical packages in R.
It also helps R users extend their analyses by accessing the authoritative datasets, mapping and visualization capabilities, and advanced spatial analytics of ArcGIS.

# Use ArcGIS Location Services

The **`arcgis`** package for location services meets developers where they are at. At it's core, **`arcgis`** is a collection of R packages designed to interact with [ArcGIS Location Services](https://developers.arcgis.com/documentation/mapping-apis-and-services/) all from the comfort of R and your text editor.
The **`arcgis`** meta-package for location services brings ArcGIS to data scientists, analysts, and developers where they work. At it's core, **`arcgis`** is a collection of R packages designed to interact with [ArcGIS Location Services](https://developers.arcgis.com/documentation/mapping-apis-and-services/) all from the comfort of R and your text editor.

ArcGIS Location Services are provided as REST API endpoints and **`arcgis`** makes interacting with the services using R native objects seamless.

# Interact with ArcGIS Pro
<!--
Nick: Below this, suggest a bulleted list of a few of the location services, using the language of the developers doc:
- Data hosting
- Geocoding
- Routing
Josiah: we only support data hosting so we cannot mention any of these other options
`{arcgisbinding}`, the first package created for the R-ArcGIS Bridge, is designed to bind the powers of R and ArcGIS. Using `{arcgisbinding}` you can read and write local data sources and take advantage of ArcGIS Pro's [projection engine](https://github.com/Esri/projection-engine-db-doc).
-->
# Interact with ArcGIS Pro

Read and write local data sources with [`arc.write()`](https://r.esri.com/assets/arcgisbinding.pdf) and [`arc.open()`](https://r.esri.com/assets/arcgisbinding.pdf). Convert to `{sf}` and `{raster}` objects with [`arc.data2sf()`](https://r.esri.com/assets/arcgisbinding.pdf) and [`arc.raster()`](https://r.esri.com/assets/arcgisbinding.pdf). Or, create [geoprocessing script tools that use R](geoprocessing-tools.qmd).
`{arcgisbinding}`, the first package created for the R-ArcGIS Bridge, is designed to bind the powers of R and ArcGIS Pro. Using `{arcgisbinding}` you can read and write local data sources and take advantage of ArcGIS Pro's [projection engine](https://github.com/Esri/projection-engine-db-doc) or create [geoprocessing script tools that use R](geoprocessing-tools.qmd).

_Get started by [installing `{arcgisbinding}`.](arcgisbinding/installing-arcgisbinding.qmd)_

## Our R-packages
## Our Packages

::: {layout-ncol=2}

::: {.card}
[`{arcgisbinding}`](https://github.com/R-ArcGIS/r-bridge)

Harness the power of ArcGIS Pro from R.
Move data between R and ArcGIS Pro. Build R-driven geoprocessing tools.
:::

::: {.card}
Expand Down
Loading

0 comments on commit d11d5bb

Please sign in to comment.