geotrellis / geotrellis-landsat-tutorial

A tutorial project that processes a LandSat image into an NDVI on a web map.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GeoTrellis landsat tutorial project

Checkout branch with an experimental VLM support: feature/raster-source

This tutorial goes over how to process a single landsat image on a single machine, using GeoTrellis and spark. We will create a server that will serve out tiles onto a web map that represent NDVI and NDWI calculations on our image. The calculations of the NDVI/NDWI and the rendering of the PNG tile will be dynamic and happen per tile request.

Sample NDVI thumbail

Download a Landsat image bands

Run the data/landsat/download-data.sh script to download the landsat image we will be working with:

cd data/landsat
./download-data.sh

Here is a thumbnail of the image:

Landsat image thumbail

Creating a 3 band geotiff from the red, green and NIR bands masked with the QA band

The code in src/main/scala/tutorial/MaskBandsRandGandNIR.scala will do this.

> ./sbt run

Select the tutorial.MaskBandsRandGandNIR to run.

This will produce data/r-g-nir.tif

Create a PNG of an NDVI of of our image.

The code in src/main/scala/tutorial/CreateNDVIPng.scala will do this.

> ./sbt run

Select the tutorial.CreateNDVIPng to run.

This will produce data/ndvi.png

Create a PNG of an NDWI of of our image.

The code in src/main/scala/tutorial/CreateNDWIPng.scala will do this.

> ./sbt run

Select the tutorial.CreateNDWIPng to run.

This will produce data/ndwi.png

Ingest the multiband geotiff into a GeoTrellis catalog.

This step will ingest the multiband image we made a previous step into a indexed tile set that GeoTrellis can quickly read data out of. We'll ingest it as WebMercator tiles, where the tiles are cut according to the Slippy Map tile coordinate representation, at multiple zoom levels.

The code is in the src/main/scala/tutorial/IngestImage.scala file.

> ./sbt run

Select the tutorial.IngestImage to run.

Tiles will be generated in the data/catalog directory.

Serve out dynamically created NDVI/NDWI images using Spray

This step will start a server that will serve out NDVI/NDWI images onto a web map, allowing users to toggle between layers.

The code is located in the src/main/scala/tutorial/Serve.scala file.

> ./sbt run

Select the tutorial.Serve to run.

You can now open static/index.html and see our NDVI/NDWI tiles on a web map.

About

A tutorial project that processes a LandSat image into an NDVI on a web map.

License:Apache License 2.0


Languages

Language:JavaScript 82.1%Language:Shell 7.1%Language:Scala 5.8%Language:CSS 4.1%Language:HTML 0.9%