m = Map(location=(46.7653, -91.0321), zoom_start=minzoom + 1)
base_parameters = (
("concept_id", "C2021957295-LPCLOUD"),
# Datetime in form of `start_date/end_date`
("datetime", "2024-08-13T00:00:00Z/2024-08-13T23:59:59Z"), # leaf-on
# ("datetime", "2025-03-16T00:00:00Z/2025-03-16T23:59:59Z"), # leaf-off
# We know that the HLS collection dataset is stored as File per Band
# so we need to pass a `band_regex` option to assign `bands` to each URL
("bands_regex", "B[0-9][0-9A-Za-z]"),
# titiler-cmr can work with both Zarr and COG dataset
# but we need to tell the endpoints in advance which backend
# to use
("backend", "rasterio"),
# We need to set min/max zoom because we don't want to use lowerzoom level (e.g 0)
# which will results in useless large scale query
("minzoom", 7),
("maxzoom", 13),
)
sentinel_true_color_tilejson = httpx.get(
f"{titiler_endpoint}/WebMercatorQuad/tilejson.json",
params=(
*base_parameters,
# True Color Image B04,B03,B02
("bands", "B04"),
("bands", "B03"),
("bands", "B02"),
# The data is in type of Uint16 so we need to apply some
# rescaling/color_formula in order to create PNGs
("color_formula", "Gamma RGB 3.5 Saturation 1.2 Sigmoidal RGB 15 0.35"),
),
timeout=None,
).json()
sentinel_true_color_tile_url = sentinel_true_color_tilejson["tiles"][0]
TileLayer(
tiles=sentinel_true_color_tile_url,
opacity=1,
name="HLSS30 true color",
overlay=True,
show=True,
control=True,
attr="NASA",
).add_to(m)
sentinel_false_color_tilejson = httpx.get(
f"{titiler_endpoint}/WebMercatorQuad/tilejson.json",
params=(
*base_parameters,
# False Color Image B8A, B03, B02
("bands", "B8A"),
("bands", "B03"),
("bands", "B02"),
# The data is in type of Uint16 so we need to apply some
# rescaling/color_formula in order to create PNGs
("color_formula", "Gamma RGB 2.5 Saturation 1.2 Sigmoidal RGB 10 0.35"),
),
timeout=None,
).json()
sentinel_false_color_tile_url = sentinel_false_color_tilejson["tiles"][0]
TileLayer(
tiles=sentinel_false_color_tile_url,
opacity=1,
name="HLSS30 false color",
overlay=True,
show=False,
control=True,
attr="NASA",
).add_to(m)
sentinel_ndvi_tilejson = httpx.get(
f"{titiler_endpoint}/WebMercatorQuad/tilejson.json",
params=(
*base_parameters,
# NDVI: B8A (NIR), B04 (Red)
("bands", "B8A"),
("bands", "B04"),
# Calculate NDVI from the NIR and Red bands
("expression", "(B8A-B04)/(B8A+B04)"),
# Rescale to -1,1
("rescale", "-0.5,1"),
# Choose a colormap
("colormap_name", "summer_r"),
),
timeout=None,
).json()
sentinel_ndvi_tile_url = sentinel_ndvi_tilejson["tiles"][0]
TileLayer(
tiles=sentinel_ndvi_tile_url,
opacity=1,
name="HLSS30 NDVI",
overlay=True,
show=False,
control=True,
attr="NASA",
).add_to(m)
LayerControl(position="topright", collapsed=False).add_to(m)
m
m = Map(location=(46.7653, -91.0321), zoom_start=minzoom + 1)
base_parameters = (
("concept_id", "C2021957295-LPCLOUD"),
# Datetime in form of `start_date/end_date`
("datetime", "2024-08-13T00:00:00Z/2024-08-13T23:59:59Z"), # leaf-on
# ("datetime", "2025-03-16T00:00:00Z/2025-03-16T23:59:59Z"), # leaf-off
# We know that the HLS collection dataset is stored as File per Band
# so we need to pass a `band_regex` option to assign `bands` to each URL
("bands_regex", "B[0-9][0-9A-Za-z]"),
# titiler-cmr can work with both Zarr and COG dataset
# but we need to tell the endpoints in advance which backend
# to use
("backend", "rasterio"),
# We need to set min/max zoom because we don't want to use lowerzoom level (e.g 0)
# which will results in useless large scale query
("minzoom", 7),
("maxzoom", 13),
)
sentinel_true_color_tilejson = httpx.get(
f"{titiler_endpoint}/WebMercatorQuad/tilejson.json",
params=(
*base_parameters,
# True Color Image B04,B03,B02
("bands", "B04"),
("bands", "B03"),
("bands", "B02"),
# The data is in type of Uint16 so we need to apply some
# rescaling/color_formula in order to create PNGs
("color_formula", "Gamma RGB 3.5 Saturation 1.2 Sigmoidal RGB 15 0.35"),
),
timeout=None,
).json()
sentinel_true_color_tile_url = sentinel_true_color_tilejson["tiles"][0]
TileLayer(
tiles=sentinel_true_color_tile_url,
opacity=1,
name="HLSS30 true color",
overlay=True,
show=True,
control=True,
attr="NASA",
).add_to(m)
sentinel_false_color_tilejson = httpx.get(
f"{titiler_endpoint}/WebMercatorQuad/tilejson.json",
params=(
*base_parameters,
# False Color Image B8A, B03, B02
("bands", "B8A"),
("bands", "B03"),
("bands", "B02"),
# The data is in type of Uint16 so we need to apply some
# rescaling/color_formula in order to create PNGs
("color_formula", "Gamma RGB 2.5 Saturation 1.2 Sigmoidal RGB 10 0.35"),
),
timeout=None,
).json()
sentinel_false_color_tile_url = sentinel_false_color_tilejson["tiles"][0]
TileLayer(
tiles=sentinel_false_color_tile_url,
opacity=1,
name="HLSS30 false color",
overlay=True,
show=False,
control=True,
attr="NASA",
).add_to(m)
sentinel_ndvi_tilejson = httpx.get(
f"{titiler_endpoint}/WebMercatorQuad/tilejson.json",
params=(
*base_parameters,
# NDVI: B8A (NIR), B04 (Red)
("bands", "B8A"),
("bands", "B04"),
# Calculate NDVI from the NIR and Red bands
("expression", "(B8A-B04)/(B8A+B04)"),
# Rescale to -1,1
("rescale", "-0.5,1"),
# Choose a colormap
("colormap_name", "summer_r"),
),
timeout=None,
).json()
sentinel_ndvi_tile_url = sentinel_ndvi_tilejson["tiles"][0]
TileLayer(
tiles=sentinel_ndvi_tile_url,
opacity=1,
name="HLSS30 NDVI",
overlay=True,
show=False,
control=True,
attr="NASA",
).add_to(m)
LayerControl(position="topright", collapsed=False).add_to(m)
m