I wanted to create an easy way for government agencies to analyze impacts on their climate action plans after natural disasters. For this use case I analyzed the impact of the Camp Fire in Paradise, CA and some of its climate-related consequences. My hope is that any government agency can use this to make data-driven decisions on impacts to their climate action plans.
What it does
There are two parts to the application. First, is the Python script that utilizes GDAL (Geospatial Data Abstraction Library) that converts near-infrared and infrared satellite TIFs (imagery) into an NDVI (Normalized Differentiation Vegetation Index). The NDVI visually displays the health of vegetation: darker green areas are healthier while lighter green areas are less healthy. In this application, the NDVI of April 2018 and April 2019 are compared to show what areas had the highest change in healthy vegetation (i.e. burn areas).
Second, is the web layer that utilizes the Open Layers library to display geographic data and web maps. Open Street Map is used as the base map and static images (PNG files) are geo-located into the correct location (Paradise, CA). Use the buttons at the bottom of the map (NDVI 2018, NDVI 2019, etc.) to toggle the different layers.
How I built it
I utilized Python to create the images displayed in the web map (linked below); GDAL to load the satellite data, calculate the NDVI, and write a new data file in TIF format; Pillow (an image processing library) to open the newly created TIF in the proper data type; and Matplotlib's Plotly to write the TIF to PNG.
Open Layers is used to display the PNG showing the NDVI in correct geographic location in Paradise, CA. I utilized MongoDB Charts and Atlas to display the statistics on the left side of the application which allowed me to focus on the geoprocessing part of the application.
Challenges I ran into
- My original goal was to deploy this as a serverless app on AWS using all the above libraries but I ran into trouble reading and writing TIF files from S3. As of now the correct bands of Landsat imagery have to be downloaded, clipped to a smaller size, processed in the Python script, and relative paths of the PNG files updated in the HTML file.
- Getting the NDVI to display correctly in the exported PNG files. I discovered going from data type Float32 to Int8 can ruin the display of NDVI!
- MongoDB Atlas and Charts are not updated dynamically.
- PNG files for NDVI are a slow to load.
Accomplishments that I'm proud of
- I was able to use all open source libraries on this project! This application is free for anyone to use.
- Using GDAL and getting the correct output for NDVI.
- Creating useful data that can help improve decision making regarding climate change.
What I learned
- How MongoDB can speed the development process.
- How to use Open Layers and static images to display raster data.
What's next for Analyzing the Camp Fire in Paradise, CA
- Creating a web-based application that can process data using public URLs to Landsat data.
- Dynamically updating MongoDB Charts and Atlas on the fly.