Using raster analysis

Raster Analysis can be used to create and execute spatial analysis models and image processing chains which leverage distributed storage and analysis. This powerful capability is available with ArcGIS Enterprise, and enables scalable raster analysis including terrain analysis, suitability analysis, vegetation analysis as well as persistent imagery product generation.

The arcgis.raster.analytics module provides the raster analysis functionality. This module contains functions that enable you to call raster analysis tools in your GIS.

About the raster analysis tools

There are many tools available to perform raster analysis such as:

  • Calculate Density creates a density layer from point features by spreading known quantities of some phenomenon (represented as attributes of the points) across the raster. The result is a layer of areas classified from least dense to most dense.
  • Classify categorizes your raster layer into logical categories.
  • Convert Feature To Raster is used to convert a vector feature class into a raster layer.
  • Convert Raster To Feature is used to convert a raster layer into a feature class.
  • Copy Raster is used to create a copy of a raster layer. The new raster layer can be clipped, resampled, or reprojected.
  • Create Viewshed determines the raster surface locations visible to a set of observer features.
  • Generate Raster can employ any of the raster functions as raster analytic tools. You can use these to create processed raster datasets from functions and function chains.
  • Interpolate Points is used to convert irregularly gridded point datasets or multidimensional datasets into raster surfaces.
  • Summarize Raster Within summarizes a raster based on areas (zones) you define with another layer.
  • Segment identifies features or segments in your imagery by grouping adjacent pixels together that have similar spectral characteristics.
  • Train Classifier sets up your classification based on your classification algorithm and parameters.

To get an exhaustive list of raster functions, please refer to arcgis.raster.analytics module.

Verifying if GIS supports raster analysis

Raster Analysis is available in GIS if raster analytics server is configured and enabled. ArcGIS Online does not yet support raster analysis. To verify if your GIS has raster analysis capability, use the arcgis.raster.analytics.is_supported(gis) method. This function returns True if the GIS supports raster analysis. If a gis isn’t specified, it checks if arcgis.env.active_gis supports raster analysis:

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

arcgis_online = GIS()
In [45]:
arcgis.raster.analytics.is_supported(arcgis_online)
Out[45]:
False

Please replace the credentials below with that of your org. To learn more about profiles, see here.

In [70]:
portal = GIS(profile='your_enterprise_profile')
In [71]:
arcgis.raster.analytics.is_supported(portal)
Out[71]:
True

Creating persistent imagery product using raster analysis

This part of the notebook shows how Raster Analysis can be used to generate a raster information product, by applying the same raster function across the extent of an image service on the portal.

An imagery layer containing landsat scenes covering the burned areas from the Montana fires is used as an input for producing the imagery product:

In [48]:
montana_landsat = portal.content.search("ImgSrv_Landast_Montana2015")[0].layers[0]
montana_landsat
Out[48]:

Using save() to create imagery product

In the code below, we use extact_bands raster function to extract the [7, 5, 2] band combination and improve the contrast using stretch(). This improves visibility of fire and burn scars by pushing further into the SWIR range of the electromagnetic spectrum, as there is less susceptibility to smoke and haze generated by a burning fire.

The raster function is applied at source resolution and creates an information product when you save() the image.

In [49]:
from arcgis.raster.functions import stretch, extract_band
montana_fires = stretch(extract_band(montana_landsat, [7, 5, 2]), 
                        stretch_type='percentclip', 
                        min_percent=0.1, 
                        max_percent=0.1, 
                        gamma=[1, 1, 1], 
                        dra=True)
In [50]:
montana_fires
Out[50]: