Visualizing STAC Data Layers using stac_ipyleaflet (beta)

This project - stac_ipyleafet - leverages the ipyleaflet mapping library and is intended to reduce the code needed to visualize data from the MAAP STAC. The beta version supports Cloud-Optimized GeoTIFFs (COGs).

Currently, this package works within this Algorithm Development Environment.

Package Import

  1. Open a new PANGEO workspace

ade workspace

  1. Create a Notebook
  2. Within the first cell, Import the package and create a map instance - m
import stac_ipyleaflet
m = stac_ipyleaflet.StacIpyleaflet()
m

stac_ipyleaflet mapview

The stac ipyleaflet notebook’s user interface consists of a map and a custom set of tools to aid in the discovery and visualization of STAC datasets, along with Biomass Layers and pre-determined Basemaps.


Map Navigation

To move the map

  • press and hold a mouse-click, then drag the map

To adjust the map’s scale (zoom extent) - use 1 of 4 methods:

  • click the Zoom In / Out buttons in the top left-corner (this will maintain the center)
  • use your mouse’s scroll-wheel - hovering over an area of interest
  • double-click within the map on an area of interest
  • while pressing the shift key on your keyboard, press and hold a mouse-click, then drag to draw a rectangle around the area of interest

Layers Tool

Pressing the Layers button at the top opens the Layers widget that consists of 2 tabs. This tool currently allows users to: - View one or more Biomass Layers at the same time to see different combinations. - Choose between common Basemap Layers that are known favorites. - Have full control over the opacity of any layer or basemap for fine-tuning how the map looks.

The Layers Tab

  • Toggle each layer’s visibility by using its checkbox
  • Adjust each layer’s opacity by moving its slider

stac_ipyleaflet layers widget

The Basemaps Tab

  • Select a basemap from the dropdown
  • Adjust the basemap’s opacity by moving its slider

stac_ipyleaflet basemap widget


STAC Discovery Tool

Pressing the STAC Data button at the top opens the STAC widget that consists of 2 tabs. This tool currently allows users to: - Connect to the MAAP STAC to access collections of mission data. - Discover items per the selected collection, including description, available dates, & direct URL. - Identify valid COG datasets. - Add COG tiles dynamically to the map. - Customize the tiles by changing the selected color palette for the selected item.

The Catalog Data Discovery Tab

  • Select a Collection within the default STAC library.

stac_ipyleaflet stac widget

  • Browse through the Collection’s details.

stac_ipyleaflet details

  • Select an item from the collection to check if it is a valid COG. If it is, the Display button will become active (available) to add the selected item to the map. The displayed STAC layer’s opacity can be adjusted by moving its slider.

stac_ipyleaflet items

The Visualization Tab

  • Select a category from the dropdown.
  • Select an item from the corresponding color palettes.
  • Press the Display button to update the data on the map.

stac_ipyleaflet color palettes


Draw an Area of Interest & Get Coordinates

  1. Activate the Draw Tools (click on the top Draw button).
  2. Use your mouse to click, hold and draw a polygon over the map - releasing to finish.
  • stac_ipyleaflet aoi draw
  1. Note the AOI’s Coordinates & BBox within the open window.
  2. Print the AOI’s bbox from within a cell:
    • stac_ipyleaflet aoi bbox
  3. Clear the AOI polygon graphic & coordinates by clicking the Clear AOI Polygon Button.

Package Install (outside of a Pangeo)

NOTE: This has only been tested in the MAAP Basic Stable environment.

To install the stac_ipyleaflet package:

  1. Open a new Terminal new Terminal
  2. Copy, paste and RUN the following statement:

pip install git+https://github.com/MAAP-Project/stac_ipyleaflet.git#egg-info=stac_ipyleaflet

A successful installation will end in the following:

Successfully built stac-ipyleaflet
Installing collected packages: stac-ipyleaflet
Successfully installed stac-ipyleaflet-0.2.0