91 planetary computer
Uncomment the following line to install geemap if needed.
In [ ]:
Copied!
# !pip install geemap
# !pip install geemap
In [ ]:
Copied!
import geemap
import geemap
If you are using a recently implemented geemap feature that has not yet been released to PyPI or conda-forge, you can uncomment the following line to install the development version from GitHub.
In [ ]:
Copied!
# geemap.update_package()
# geemap.update_package()
Add a STAC item via an HTTP URL
In [ ]:
Copied!
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"
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"
In [ ]:
Copied!
geemap.stac_assets(url)
geemap.stac_assets(url)
In [ ]:
Copied!
geemap.stac_bounds(url)
geemap.stac_bounds(url)
In [ ]:
Copied!
geemap.stac_center(url)
geemap.stac_center(url)
In [ ]:
Copied!
# geemap.stac_info(url)
# geemap.stac_info(url)
In [ ]:
Copied!
# geemap.stac_stats(url)
# geemap.stac_stats(url)
In [ ]:
Copied!
m = geemap.Map()
m.add_stac_layer(url, bands=["B3", "B2", "B1"])
m
m = geemap.Map()
m.add_stac_layer(url, bands=["B3", "B2", "B1"])
m
Add a Microsoft Planetry Computer STAC item. The titiler endpoint can set in one of the ways below:
os.environ["TITILER_ENDPOINT"] = "planetary-computer"
titiler_endpoint="pc"
titiler_endpoint="planetary-computer"
In [ ]:
Copied!
# import os
# os.environ["TITILER_ENDPOINT"] = "planetary-computer"
# import os
# os.environ["TITILER_ENDPOINT"] = "planetary-computer"
In [ ]:
Copied!
collection = "landsat-8-c2-l2"
collection = "landsat-8-c2-l2"
In [ ]:
Copied!
items = "LC08_L2SP_047027_20201204_02_T1"
items = "LC08_L2SP_047027_20201204_02_T1"
In [ ]:
Copied!
geemap.stac_assets(collection=collection, items=items, titiler_endpoint="pc")
geemap.stac_assets(collection=collection, items=items, titiler_endpoint="pc")
In [ ]:
Copied!
geemap.stac_bounds(collection=collection, items=items)
geemap.stac_bounds(collection=collection, items=items)
In [ ]:
Copied!
geemap.stac_info(collection=collection, items=items, assets="SR_B7")
geemap.stac_info(collection=collection, items=items, assets="SR_B7")
In [ ]:
Copied!
geemap.stac_stats(collection=collection, items=items, assets="SR_B7")
geemap.stac_stats(collection=collection, items=items, assets="SR_B7")
Color infrared composite.
In [ ]:
Copied!
m = geemap.Map()
m.add_stac_layer(
collection=collection,
items=items,
assets="SR_B5,SR_B4,SR_B3",
name="Color infrared",
)
m
m = geemap.Map()
m.add_stac_layer(
collection=collection,
items=items,
assets="SR_B5,SR_B4,SR_B3",
name="Color infrared",
)
m
False color composite.
In [ ]:
Copied!
m = geemap.Map()
m.add_stac_layer(
collection=collection, items=items, assets="SR_B7,SR_B5,SR_B4", name="False color"
)
m
m = geemap.Map()
m.add_stac_layer(
collection=collection, items=items, assets="SR_B7,SR_B5,SR_B4", name="False color"
)
m
Calculate NDVI.
In [ ]:
Copied!
geemap.stac_stats(
collection=collection,
items=items,
expression="(SR_B5-SR_B4)/(SR_B5+SR_B4)",
)
geemap.stac_stats(
collection=collection,
items=items,
expression="(SR_B5-SR_B4)/(SR_B5+SR_B4)",
)
In [ ]:
Copied!
m = geemap.Map()
m.add_stac_layer(
collection=collection,
items=items,
expression="(SR_B5-SR_B4)/(SR_B5+SR_B4)",
name="NDVI",
)
m
m = geemap.Map()
m.add_stac_layer(
collection=collection,
items=items,
expression="(SR_B5-SR_B4)/(SR_B5+SR_B4)",
name="NDVI",
)
m
Calculate NDVI and add a colormap. See available colormaps at https://planetarycomputer.microsoft.com/docs/reference/data/
In [ ]:
Copied!
m = geemap.Map()
m.add_stac_layer(
collection=collection,
items=items,
assets="SR_B5,SR_B4,SR_B3",
name="Color infrared",
)
m.add_stac_layer(
collection=collection,
items=items,
expression="(SR_B5-SR_B4)/(SR_B5+SR_B4)",
colormap_name="greens",
name="NDVI Green",
)
m
m = geemap.Map()
m.add_stac_layer(
collection=collection,
items=items,
assets="SR_B5,SR_B4,SR_B3",
name="Color infrared",
)
m.add_stac_layer(
collection=collection,
items=items,
expression="(SR_B5-SR_B4)/(SR_B5+SR_B4)",
colormap_name="greens",
name="NDVI Green",
)
m