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.
Let's first import the packages and make a connection to our GIS.
import arcgis from arcgis.gis import GIS from arcgis.raster.functions import * from IPython.display import display gis = GIS(profile="your_enterprise_profile")
items = gis.content.search("title: Multispectral Landsat", item_type="Imagery Layer", outside_org=True) items
l8_lyr = items.layers
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.
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])
landmap = gis.map('Redlands, CA') landmap