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¶
- Open a new PANGEO workspace
- Create a Notebook
- Within the first cell, Import the package and create a map instance -
m
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, along with Biomass Layers and pre-determined Basemaps.
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
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 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.
- 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.
Draw an Area of Interest & Get Coordinates¶
- Activate the Draw Tools (click on the top Draw button).
- Use your mouse to click, hold and draw a polygon over the map - releasing to finish.
- Note the AOI’s Coordinates & BBox within the open window.
- Print the AOI’s bbox from within a cell:
- 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:¶
- Open a new Terminal
- 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