R-ArcGIS Bridge
Conda for managing packages and environments
CRAN
: 6400 packages for solving problemsData types you’re used to seeing…
Numeric
- Integer
- Character
- Logical
- timestamp
… but others you probably aren’t:
vector
- matrix
- data.frame
- factor
# Create a data frame out of an existing source
df.from.csv <- read.csv(
"data/growth.csv",
header=TRUE)
# Create a data frame from scratch
quarter <- c(2, 3, 1)
person <- c("Goodchild",
"Tobler",
"Krige")
met.quota <- c(TRUE, FALSE, TRUE)
df <- data.frame(person,
met.quota,
quarter)
R> df
person met.quota quarter
1 Goodchild TRUE 2
2 Tobler FALSE 3
3 Krige TRUE 1
sp
TypesSpatialPoints
SpatialLines
SpatialPolygons
Entity + Attribute model
fit.results <- lm(pollution ~ elevation + rainfall + ppm.nox + urban.density)
caret
for model specification consistencyStore your data in ArcGIS, access it quickly in R, return R objects back to ArcGIS native data types (e.g. geodatabase feature classes).
Knows how to convert spatial data to sp
objects.
Start by loading the library, and initializing connection to ArcGIS:
# load the ArcGIS-R bridge library
library(arcgisbinding)
# initialize the connection to ArcGIS. Only needed when running directly from R.
arc.check_product()
First, select a data source (can be a feature class, a layer, or a table):
input.fc <- arc.open('data.gdb/features')
Then, filter the data to the set you want to work with (creates in-memory data frame):
filtered.df <- arc.select(input.fc,
fields=c('fid', 'mean'),
where_clause="mean < 100")
This creates an ArcGIS data frame – looks like a data frame, but retains references back to the geometry data.
Finished with our work in R, want to get the data back to ArcGIS. Write our results back to a new feature class, with arc.write
:
arc.write('data.gdb/new_features', results.df)
Scientific Python community identified that there was a gap not being addressed by the core Python infrastructure, limiting their ability to get packages into the hands of users
Industry standard built by people who care about this space — Continuum Analytics
It solves the hard problem:
What can it install? Not just scientific packages, can install everything from interactive environments like Spyder to Jupyter Notebooks.
Conda packages can come from a variety of locations:
conda --help
conda info
Conda info is the starting point — it tells you the state of the environment.
conda list
# packages in environment at C:\ArcGIS\bin\Python\envs\arcgispro-py3:
#
colorama 0.3.7 py35_0 defaults
cycler 0.10.0 py35_0 defaults
future 0.15.2 py35_0 defaults
matplotlib 1.5.3 np111py35_0e [arcgispro] esri
mpmath 0.19 py35_1 defaults
netcdf4 1.2.4 py35_0e [arcgispro] esri
nose 1.3.7 py35_1 defaults
numexpr 2.6.1 np111py35_0e [arcgispro] esri
numpy 1.11.2 py35_0e [arcgispro] esri
pandas 0.19.0 np111py35_0 defaults
pip 8.1.2 py35_0 defaults
py 1.4.31 py35_0 defaults
pyparsing 2.1.4 py35_0 defaults
pypdf2 1.26.0 py_0 esri
pytest 2.9.2 py35_0 defaults
python 3.5.2 0 defaults
python-dateutil 2.5.3 py35_0 defaults
pytz 2016.6.1 py35_0 defaults
requests 2.11.1 py35_0 defaults
scipy 0.18.1 np111py35_0e [arcgispro] esri
setuptools 27.2.0 py35_1 defaults
sympy 1.0 py35_0 defaults
wheel 0.29.0 py35_0 defaults
xlrd 1.0.0 py35_0 defaults
xlwt 1.1.2 py35_0 defaults
Activating environments, a couple ways:
cd C:\ArcGIS\bin\Python\Scripts
activate arcgispro-py3
Name | Means | Included? |
---|---|---|
Conda | The command itself | ✓ |
Miniconda | A minimum set of Python packages to build and run Conda. | ✓ |
Anaconda | A distribution 200+ packages built with Conda | |
Anaconda Server | Host the full infrastructure internally |
requests
), environment with Pro