Visualizing orbital swath data¶
Visualizing L2 and L3 data products that are generated from sensors that follow orbital tracks around the earth requires some special care to ensure that the underlying data are combined in reasonable ways. The TiTiler-CMR API surfaces several query parameters from the CMR API that make it possible to filter granules down by attributes such as TRACK_NUMBER or other properties that define logical groups of granules.
This notebook contains visualization examples that use granule filters to render coherent views of L2 collections like NISAR Provisional Geocoded Polarimetric Covariance (GCOV) and Harmonize Landsat Sentinel (HLS), and L3 collections like OPERA Surface Displacement from Sentinel-1.
import json
import os
from datetime import datetime, timedelta, UTC
import httpx2 as httpx
import shapely
from folium import GeoJson, GeoJsonPopup, GeoJsonTooltip, LayerControl, Map, TileLayer
from shapely.geometry import box, mapping
titiler_endpoint = os.getenv(
"TITILER_CMR_ENDPOINT", "https://openveda.cloud/api/titiler-cmr"
)
NISAR GCOV in India¶
The NISAR Provisional GCOV collection contains partially validated data intended for data exploration and process studies. TiTiler-CMR can be used to visualize a mosaic of its granules.
The /bbox/.../granules endpoint can be used to retrieve the granule metadata that matches a TiTiler-CMR query as a GeoJSON feature collection. This is useful because it allows you to look directly at the metadata from the granules that TiTiler-CMR will use for a set of CMR search terms.
india_bbox = (66.191, 6.930, 91.297, 34.657)
nisar_assets_req = httpx.get(
f"{titiler_endpoint}/bbox/{','.join(str(b) for b in india_bbox)}/granules",
params={
"collection_concept_id": "C2854338529-ASF",
"temporal": "2026-06-01T00:00:00Z/2026-07-01T00:00:00Z", # June 2026
"f": "geojson", # return granules as a GeoJSON FeatureCollection
"sort_key": ["-start_date"], # sort granules in descending order by time
"skipcovered": True, # do not return multiple granules with identical geometries
"items_limit": 200, # global granule query limit
},
timeout=None,
)
nisar_assets_req.raise_for_status()
nisar_assets_geojson = nisar_assets_req.json()
print("found", len(nisar_assets_geojson["features"]), "granules")
found 200 granules
for feature in nisar_assets_geojson["features"]:
# move additional_attributes into properties so we can use
# them more easily in maps
feature["properties"].update(
{
attribute["name"]: (
attribute["values"][0]
if len(attribute["values"]) == 1
else attribute["values"]
)
for attribute in feature["properties"]["additional_attributes"]
}
)
# drop additional_attributes after moving values out
feature["properties"].pop("additional_attributes")
feature["properties"]["datetime"] = datetime.fromisoformat(
feature["properties"]["temporal_extent"]["range_date_time"][
"beginning_date_time"
]
).isoformat()
m = Map(
location=((india_bbox[1] + india_bbox[3]) / 2, (india_bbox[0] + india_bbox[2]) / 2),
zoom_start=5,
)
GeoJson(
nisar_assets_geojson,
name="granule footprints",
tooltip=GeoJsonTooltip(fields=["granule_ur"], localize=True),
popup=GeoJsonPopup(fields=["datetime", "ASCENDING_DESCENDING", "TRACK_NUMBER"]),
style_function=lambda x: {
"color": "magenta"
if x["properties"]["ASCENDING_DESCENDING"] == "ASCENDING"
else "blue",
"weight": 1,
"fillOpacity": 0,
},
).add_to(m)
LayerControl().add_to(m)
m