Skip To Content ArcGIS for Developers Sign In Dashboard
Download the samples Try it live

Creating Raster Information Product using Raster Analytics

Raster Analytics

ArcGIS Enterprise at 10.5 provides you with the ability to perform large raster analysis using distributed computing. This capability is provided in the arcgis.raster.analytics module and includes functionality to summarize data, analyze patterns, images, terrain and manage data. This sample show the capabilities of imagery layers and raster analytics.

Imagery layers

In [ ]:
import arcgis
from arcgis.gis import GIS
from IPython.display import display

gis = GIS()

Here we're searching for multispectral landsat imagery layer:

In [ ]:
items = gis.content.search("Landsat 8 Views", "Imagery Layer", max_items=8)
In [3]:
for item in items:
    display(item)
Pansharpened Landsat
Landsat 8 OLI, 15m multitemporal PanSharpened Natural Color images. This imagery layer is sourced from the Landsat on AWS collections and is updated daily with new imagery.Imagery Layer by esri
Last Modified: May 03, 2018
0 comments, 17,113 views
Panchromatic Landsat
Landsat 8 OLI, 15m multitemporal Panchromatic images. This imagery layer is sourced from the Landsat on AWS collections and is updated daily with new imagery.Imagery Layer by esri
Last Modified: May 03, 2018
0 comments, 17,655 views
Landsat 8 Pansharpened
Landsat 8 OLI, 15m multitemporal PanSharpened Natural Color images. This imagery layer is sourced from the Landsat on AWS collections and is updated daily with new imagery.Imagery Layer by esri
Last Modified: May 03, 2018
1 comments, 107,023 views
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
Last Modified: May 03, 2018
0 comments, 72,242 views
Landsat 8 Views
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
Last Modified: May 03, 2018
0 comments, 146,851 views
MDA NaturalVue Satellite Imagery
This image service presents NaturalVue 15m satellite imagery of the world created by MDA Information Systems Inc.Imagery Layer by esri
Last Modified: August 24, 2017
0 comments, 28,281 views
Landsat 8 Panchromatic
Landsat 8 OLI, 15m multitemporal Panchromatic images. This imagery layer is sourced from the Landsat on AWS collections and is updated daily with new imagery.Imagery Layer by esri
Last Modified: May 03, 2018
0 comments, 43,486 views
Landsat Antarctic Views
Landsat 8 OLI, 30m Multispectral 8 imagery in the Antarctic, with visual renderings and indices. Based on the Landsat on AWS collections, this layer is in beta.Imagery Layer by esri
Last Modified: December 08, 2016
0 comments, 138 views

NOTE: The index position in the items list for Landsat 8 Views may be different than the value below:

In [ ]:
landsat_item = items[4]
In [ ]:
imglyr = landsat_item.layers[0]

The code below cycles through and lists the Raster Functions published with the imglyr:

In [6]:
for fn in imglyr.properties['rasterFunctionInfos']:
    print (fn['name'])
Agriculture with DRA
Bathymetric with DRA
Color Infrared with DRA
Natural Color with DRA
Short-wave Infrared with DRA
Geology with DRA
Agriculture
Bathymetric
Color Infrared
Geology
Natural Color
Short-wave Infrared
NDVI Colorized
Normalized Difference Moisture Index Colorized
NDVI Raw
NBR Raw
None

Let us create a map widget and load this layer

In [ ]:
marthasbasin = arcgis.geocoding.geocode("Marthas Basin, Montana")[0]
In [ ]:
map1 = gis.map(marthasbasin, zoomlevel=12)
In [1]:
map1
Out[1]:
In [ ]:
map1.add_layer(imglyr)

The utility of raster functions is better seen when we interactively cycle through these raster functions and apply them to the map. The code below cycles through the first 6 raster functions stored with the Imagery Layer and a small time delay to illustrate. The image processing occurs on-the-fly at display resolution to show how the layer can be visualized using these different raster functions published with the layer.

In [11]:
import time
from arcgis.raster.functions import apply

for fn in imglyr.properties['rasterFunctionInfos'][:6]:
    print(fn['name'])
    map1.remove_layers()
    map1.add_layer(apply(imglyr, fn['name']))
    time.sleep(4)  
Agriculture with DRA
Bathymetric with DRA
Color Infrared with DRA
Natural Color with DRA
Short-wave Infrared with DRA
Geology with DRA

Raster functions

Developers can create their own raster functions, by chaining different raster functions. For instance, the code below is doing an Extract Band and extracting out the [4,5,3] band combination, and applying a Stretch to get the land-water boundary visualization that makes it easy to see where land is and where water is. Its worth noting that the raster function is applied at display resolution and only for the visible extent using on the fly image processing.

In [ ]:
from arcgis.raster.functions import stretch, extract_band

def process_bands(layer, bands):
    return stretch(extract_band(layer, bands), 
                    stretch_type='percentclip', min_percent=0.1, max_percent=0.1, gamma=[1, 1, 1], dra=True)

Let us apply this raster function to the image layer to visualize the results.

In [3]:
map2 = gis.map(marthasbasin, zoomlevel=12)
map2
Out[3]: