Using the stac_ipyleaflet mapping library

This project leverages the ipyleaflet mapping library and is intended to reduce the code needed to visualize data from the VEDA STAC. The beta version supports Cloud-Optimized GeoTIFFs (COGs). Currently, this package works within this JupyterHub Environment.
Author

Emma Paz

Published

September 11, 2023

Visualizing STAC Data using stac_ipyleaflet

Run This Notebook

It is recommended to run through this tutorial using VEDA’s Pangeo Notebook image, which already includes the stac_ipyleaflet library. When working within the notebook, be sure to select the nasa-veda-singleuser kernel.

To access VEDA’s JupyterHub Environment, please refer to the “Getting access…” section of our documentation.

For reference: stac_ipyleafet repository

Import the Library & Use the Map

import stac_ipyleaflet
m = stac_ipyleaflet.StacIpyleaflet()
m

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 and pre-determined Basemaps.


Map Navigation

Move the Map

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

Adjust the Map’s Scale (Zoom Extent) - 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 Pre-defined Layers at the same time to see different combinations (currently, there are none for VEDA). - 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

The Basemaps Tab

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

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 VEDA 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.
  • Browse through the Collection’s 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.

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.

Interact with the Map

  1. Activate the Interact Tools (click on the top Interact button)
  2. From within the Point tab: Use your mouse to activate the Point tool; then click on the map at a location of interest
    • Coordinates will be printed within the open tab
    • Raster cell values will be identified and printed, if raster layers are on
  3. From within the Area tab: Use your mouse to activate the Polygon tool; then click, hold and draw a polygon over the map - releasing to finish
    • The area of interest’s Coordinates & BBox within the open tab
    • Alternatively Print the area of interest’s bbox from within a cell:
  4. Clear the point or polygon graphics as needed