ArcGIS Developer

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("", "username", "Password").

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 [1]:
!conda install -c anaconda pillow -y
In [2]:
!conda install -c conda-forge imageio=2.7 -y
In [3]:
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 [4]:
ent_gis = GIS('', 'arcgis_python', 'amazing_arcgis_123')

Get the data for analysis

Search for Multispectral Landsat layer in ArcGIS Online.

In [5]:
landsat_item = ent_gis.content.get('d9b466d6a9e647ce8d1dd5fe12eb434b')
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_livingatlas
Last Modified: May 13, 2020
0 comments, 1 views

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

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