Skip to content

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

License

Notifications You must be signed in to change notification settings

geotrellis/geotrellis-landsat-tutorial

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published