ArcGIS Developer

ArcGIS API for Python

Classify land cover to measure shrinking lakes

Compare imagery to calculate area change in Lake Aculeo Lagoon, Chili.


One of the important freshwater waterbodies of central Chili, Lake Aculeo Lagoon shrank over time due to climatic drought, drying of surface tributaries and streams that provided a continuous flow of water and high existing demand of ground water [1]. The lagoon dried completely in May of 2018. Those whose livelihoods depend on the lake are alarmed, as the shrinking lake changes the land cover of the area and impacts the economy. In order to help them identify and save their waterbodies, we'll generate land cover and compare imagery between 2016 and 2017 to quantify the surface area of the lake and show changes over time.

Manually extracting features from raw data, such as generating land cover maps, is time consuming. Deep learning automates the process and minimizes the manual interaction necessary to complete these tasks. To quantify the change in lake surface area from 2016 to 2017, we'll classify the land cover in both images, identifying the areas covered with water and distinguishing them from other land cover, such as vegetation or urban areas.

This sample aims to demonstrate how ArcGIS pretrained models can be used to generate landcover from imageries of different time periods for further analysis. Once the land covers are created, we will use arcgis.raster submodule of ArcGIS API for Python for calculating surface area reduced from 2016 to 2017.

Note: This sample is supported with ArcGIS Image for ArcGIS Online. For more details read here.

Necessary imports

In [1]:
import arcgis
from arcgis.gis import GIS
from arcgis.learn import classify_pixels
from arcgis.raster.functions import equal_to
from arcgis.raster.functions import extract_band

import pandas as pd
from datetime import datetime as dt
from ipywidgets import HBox, VBox, Label, Layout
In [2]:
gis = GIS("home")

Get data and model for classification

Search for Multispectral Sentinel-2 Level 1-C imagery for year 2016 and 2017 on the Copernicus Open Access Hub. Download imagey of the desired time period and publish them in ArcGIS Online. The code below uses the get method to get items.

In [3]:
sentinel2016 = gis.content.get("a264d1eaa8bd4ff2a0a1e27b59daa7d3")
sentinel2017 = gis.content.get("ea192d03d1324c62a2cb91e26e3a0ece")

Search for the Land Cover Classification (Sentinel-2) deep learning package in ArcGIS Online. We can search for content shared by users outside our organization by setting outside_org to True.

In [4]:
model =
    "Land Cover Classification (Sentinel-2) owner: esri_analytics",
    "Deep Learning Package",
Land Cover Classification (Sentinel-2)
Deep learning model to perform land cover classification on Sentinel-2 imagery.Deep Learning Package by esri_analytics
Last Modified: October 26, 2021
13 comments, 5,021 views

This model is trained on Corine Land Cover (CLC) 2018 data that contains 16 classes. The screenshot below shows the color code for each land cover class.

Visually compare Lake Aculeo Lagoon over time

As all the bands cannot be depicted at the same time, we usually pick a combination of three bands that we display through the color channels red, green, and blue, which can be seen by the human eye.

In [5]:
sentinel2016_rgb = extract_band(sentinel2016.layers[0], [4, 3, 2])
sentinel2017_rgb = extract_band(sentinel2017.layers[0], [4, 3, 2])

Let's compare the imagery visually to get a sense of how the shape of the lake has evolved over time.

In [6]:
map1 =
map2 =
In [7]:
In [8]:
hbox_layout = Layout()
hbox_layout.justify_content = "space-around"
hb1 = HBox([Label("Sentinel-2016"), Label("Sentinel-2017")])
hb1.layout = hbox_layout
VBox([hb1, HBox([map1, map2])])