Stac
Visualize SpatioTemporal Asset Catalog (STAC)
This notebook demonstrates how to visualize SpatioTemporal Asset Catalog (STAC) items using the TiTiler demo endpoint (titiler.opengeos.org). Please be gentle with the demo endpoint.
Uncomment the following line to install leafmap if needed.
In [ ]:
Copied!
# %pip install "leafmap[maplibre]"
# %pip install "leafmap[maplibre]"
In [ ]:
Copied!
import leafmap.maplibregl as leafmap
import leafmap.maplibregl as leafmap
In [ ]:
Copied!
# import os
# os.environ["MAPTILER_KEY"] = "YOUR_API_KEY"
# import os
# os.environ["MAPTILER_KEY"] = "YOUR_API_KEY"
In [ ]:
Copied!
m = leafmap.Map(style="streets")
url = "https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json"
m.add_stac_layer(url, bands=["pan"], name="Panchromatic", vmin=0, vmax=150)
m.add_stac_layer(url, bands=["B4", "B3", "B2"], name="RGB", vmin=0, vmax=150)
m
m = leafmap.Map(style="streets")
url = "https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json"
m.add_stac_layer(url, bands=["pan"], name="Panchromatic", vmin=0, vmax=150)
m.add_stac_layer(url, bands=["B4", "B3", "B2"], name="RGB", vmin=0, vmax=150)
m
In [ ]:
Copied!
m.layer_interact()
m.layer_interact()

In [ ]:
Copied!
collection = "landsat-8-c2-l2"
item = "LC08_L2SP_047027_20201204_02_T1"
collection = "landsat-8-c2-l2"
item = "LC08_L2SP_047027_20201204_02_T1"
In [ ]:
Copied!
leafmap.stac_assets(collection=collection, item=item, titiler_endpoint="pc")
leafmap.stac_assets(collection=collection, item=item, titiler_endpoint="pc")
In [ ]:
Copied!
m = leafmap.Map(style="streets")
m.add_stac_layer(
collection=collection,
item=item,
assets=["SR_B5", "SR_B4", "SR_B3"],
name="Color infrared",
)
m
m = leafmap.Map(style="streets")
m.add_stac_layer(
collection=collection,
item=item,
assets=["SR_B5", "SR_B4", "SR_B3"],
name="Color infrared",
)
m