ArcGIS Developers

ArcGIS API for Python

Visualize monthly changes in Hirakund reservoir using video


The World is changing daily. Major changes like shrinking of lakes, river path shifts, construction of megastructures can be seen directly from the satellite images. This notebook creates a movie to visualize monthly changes in Hirakund reservoir, Odisha.

First, let's import all the necessary libraries and connect to our GIS via an existing profile or creating a new connection by e.g. gis = GIS("", "arcgis_python", "P@ssword123").

Note: to run this sample, you need a few extra libraries in your conda environment. If you don't have the libraries, install them by running the following commands from cmd.exe or your shell

conda install -c anaconda pillow
conda install -c conda-forge imageio

Necessary Imports

In [ ]:
!conda install -c anaconda pillow -y
In [ ]:
!conda install -c conda-forge imageio -y
In [1]:
import os
import imageio
import pandas as pd
import datetime as dt
from platform import system
from PIL import Image, ImageFont, ImageDraw

import arcgis
from arcgis.gis import GIS
from arcgis import geometry, geocode
from arcgis.raster.functions import apply

Connect to your GIS

In [ ]:
gis = GIS('home')

Get the data for analysis

Search for Multispectral Landsat layer in ArcGIS Online.

In [7]:
def exact_search(my_gis, title, owner_value, item_type_value):
    final_match = None
    search_result = title + ' AND owner:' + owner_value,
    if "Imagery Layer" in item_type_value:
        item_type_value = item_type_value.replace("Imagery Layer", "Image Service")
    elif "Layer" in item_type_value:
        item_type_value = item_type_value.replace("Layer", "Service")
    for result in search_result:
        if result.title == title and result.type == item_type_value:
            final_match = result
    return final_match

landsat_item = exact_search(gis, 'Multispectral Landsat', 'esri', 'Imagery Layer')
landsat = landsat_item.layers[0]
Multispectral Landsat
Landsat multispectral and multitemporal imagery with on-the-fly renderings and indices for visualization and analysis. The Landsat 8 imagery in this layer is updated daily and is directly sourced from the Landsat on AWS collection.Imagery Layer by esri
Last Modified: December 19, 2019
0 comments, 378,680 views

Applying Natural color to the filtered Landsat collection using predefined apply function

In [6]:
rgb_collection = apply(landsat, 'Natural Color with DRA')
In [ ]:
g = geocode('Hirakund reservoir, Odisha', out_sr=3857)[0]
In [ ]:
extent = g.get('extent')
In [14]:
m =
m.basemap = 'satellite'
m.extent = extent