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.
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:
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
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
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
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.
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.