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='https://pythonapi.playground.esri.com/portal', username='arcgis_python', password='amazing_arcgis_123')
In [9]:
items = gis.content.search("title: Multispectral Landsat", item_type="Imagery Layer", outside_org=True)
items[0]
Out[9]:
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]),
stretch_type='PercentClip',
min_percent=2,
max_percent=2,
dra=True,
gamma=[1, 1, 1])
In [45]:
landmap = gis.map('Redlands, CA')
landmap