ArcGIS Developer

ArcGIS API for Python

Perform Analysis - Concepts

In this guide, we will first demonstrate how to chain multiple raster functions together, view the workflow as a graph, as well as persist the result. And then show you how to make use of these capabilities in a change detection use case.

Getting Prepared

Let's first import the packages and make a connection to our GIS.

In [1]:
import arcgis
from arcgis.gis import GIS
from arcgis.raster.functions import *
from IPython.display import display

gis = GIS(url='', username='arcgis_python', password='amazing_arcgis_123')
In [9]:
items ="title: Multispectral Landsat", item_type="Imagery Layer",  outside_org=True)
Multispectral Landsat
Landsat 8 OLI, 30m multispectral and multitemporal 8-band imagery, with on-the-fly renderings and indices. This imagery layer is sourced from the Landsat on AWS collections and is updated daily with new imagery.Imagery Layer by esri_livingatlas
Last Modified: April 23, 2019
0 comments, 2 views
In [13]:
l8_lyr = items[0].layers[0]

Chain raster functions

There are cases where one raster function is not enough and we need to chain multiple raster functions together.

For example, if we would like to highlight the difference between land and water, we can first extract Red, NIR, Green [4,5,3] bands using ExtractBand, and then use Stretch function to enhance the contrast further.

In [20]:
land_water_lr = stretch(extract_band(l8_lyr, [4, 5, 3]),
                        gamma=[1, 1, 1])
In [45]:
landmap ='Redlands, CA')