Visualize monthly changes in Hirakund reservoir using video¶
Introduction¶
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("https://www.arcgis.com", "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¶
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
from arcgis.raster.functions import apply
Connect to your GIS¶
gis = GIS('home')
Get the data for analysis¶
Search for Multispectral Landsat layer in ArcGIS Online.
def exact_search(my_gis, title, owner_value, item_type_value):
final_match = None
search_result = my_gis.content.search(query= title + ' AND owner:' + owner_value,
item_type=item_type_value,
outside_org=True)
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
break
return final_match
landsat_item = exact_search(gis, 'Multispectral Landsat', 'esri', 'Imagery Layer')
landsat = landsat_item.layers[0]
landsat_item
Applying Natural color to the filtered Landsat collection using predefined apply
function
rgb_collection = apply(landsat, 'Natural Color with DRA')
m = gis.map('Hirakund reservoir, Odisha', 10)
m.basemap = 'imagery'
m