import requests as re
import folium
= "https://staging-stac.delta-backend.com"
STAC_ENDPOINT_URL = "https://staging-raster.delta-backend.com" RASTER_ENDPOINT_URL
Single Item Viz
= re.get(f"{STAC_ENDPOINT_URL}/collections/no2-monthly").json()
no2_collection_summary no2_collection_summary
{'id': 'no2-monthly',
'type': 'Collection',
'links': [{'rel': 'items',
'type': 'application/geo+json',
'href': 'https://staging-stac.delta-backend.com/collections/no2-monthly/items'},
{'rel': 'parent',
'type': 'application/json',
'href': 'https://staging-stac.delta-backend.com/'},
{'rel': 'root',
'type': 'application/json',
'href': 'https://staging-stac.delta-backend.com/'},
{'rel': 'self',
'type': 'application/json',
'href': 'https://staging-stac.delta-backend.com/collections/no2-monthly'}],
'title': 'NO₂',
'extent': {'spatial': {'bbox': [[-180, -90, 180, 90]]},
'temporal': {'interval': [['2016-01-01T00:00:00Z',
'2022-01-01T00:00:00Z']]}},
'license': 'MIT',
'summaries': {'datetime': ['2016-01-01T00:00:00Z', '2022-05-01T00:00:00Z'],
'cog_default': {'max': 50064805976866816, 'min': -6618294421291008}},
'description': 'Darker colors indicate higher nitrogen dioxide (NO₂) levels and more activity. Lighter colors indicate lower levels of NO₂ and less activity. Missing pixels indicate areas of no data most likely associated with cloud cover or snow.',
'item_assets': {'cog_default': {'type': 'image/tiff; application=geotiff; profile=cloud-optimized',
'roles': ['data', 'layer'],
'title': 'Default COG Layer',
'description': 'Cloud optimized default layer to display on map'}},
'stac_version': '1.0.0',
'stac_extensions': ['https://stac-extensions.github.io/item-assets/v1.0.0/schema.json'],
'dashboard:is_periodic': True,
'dashboard:time_density': 'month'}
= no2_collection_summary["summaries"]["cog_default"]
rescale_values rescale_values
{'max': 50064805976866816, 'min': -6618294421291008}
= re.post(
response f"{STAC_ENDPOINT_URL}/search",
={
json"collections": ["no2-monthly"],
"query": {"datetime": {"eq":"2021-01-01T00:00:00"}},
"limit": 100
}
).json()= response["features"][0]
item item
{'id': 'OMI_trno2_monthly_0.10x0.10_202101_Col3_V4.nc',
'bbox': [-180.0, -90.0, 180.0, 90.0],
'type': 'Feature',
'links': [{'rel': 'collection',
'type': 'application/json',
'href': 'https://staging-stac.delta-backend.com/collections/no2-monthly'},
{'rel': 'parent',
'type': 'application/json',
'href': 'https://staging-stac.delta-backend.com/collections/no2-monthly'},
{'rel': 'root',
'type': 'application/json',
'href': 'https://staging-stac.delta-backend.com/'},
{'rel': 'self',
'type': 'application/geo+json',
'href': 'https://staging-stac.delta-backend.com/collections/no2-monthly/items/OMI_trno2_monthly_0.10x0.10_202101_Col3_V4.nc'}],
'assets': {'cog_default': {'href': 's3://veda-data-store-staging/no2-monthly/OMI_trno2_monthly_0.10x0.10_202101_Col3_V4.nc.tif',
'type': 'image/tiff; application=geotiff; profile=cloud-optimized',
'roles': ['data', 'layer'],
'raster:bands': [{'scale': 1.0,
'nodata': -1.2676506002282294e+30,
'offset': 0.0,
'sampling': 'area',
'data_type': 'float32',
'histogram': {'max': 35781585143857150,
'min': -4107596126486528.0,
'count': 11,
'buckets': [7437, 432387, 2866, 699, 356, 207, 76, 27, 7, 1]},
'statistics': {'mean': 367152773066762.6,
'stddev': 961254458662885.4,
'maximum': 35781585143857150,
'minimum': -4107596126486528.0,
'valid_percent': 84.69829559326172}}]}},
'geometry': {'type': 'Polygon',
'coordinates': [[[-180.0, -90.0],
[180.0, -90.0],
[180.0, 90.0],
[-180.0, 90.0],
[-180.0, -90.0]]]},
'collection': 'no2-monthly',
'properties': {'datetime': None,
'proj:bbox': [-180.0, -90.0, 180.0, 90.0],
'proj:epsg': 4326,
'proj:shape': [1800, 3600],
'end_datetime': '2021-01-31T00:00:00Z',
'proj:geometry': {'type': 'Polygon',
'coordinates': [[[-180.0, -90.0],
[180.0, -90.0],
[180.0, 90.0],
[-180.0, 90.0],
[-180.0, -90.0]]]},
'proj:transform': [0.1, 0.0, -180.0, 0.0, -0.1, 90.0, 0.0, 0.0, 1.0],
'start_datetime': '2021-01-01T00:00:00Z'},
'stac_version': '1.0.0',
'stac_extensions': ['https://stac-extensions.github.io/projection/v1.0.0/schema.json',
'https://stac-extensions.github.io/raster/v1.1.0/schema.json']}
= re.get(
tiles f"{RASTER_ENDPOINT_URL}/stac/tilejson.json?collection={item['collection']}&item={item['id']}&assets=cog_default&color_formula=gamma+r+1.05&colormap_name=rdbu_r&rescale=0%2C15000000000000000",
).json() tiles
{'tilejson': '2.2.0',
'version': '1.0.0',
'scheme': 'xyz',
'tiles': ['https://staging-raster.delta-backend.com/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=no2-monthly&item=OMI_trno2_monthly_0.10x0.10_202101_Col3_V4.nc&assets=cog_default&color_formula=gamma+r+1.05&colormap_name=rdbu_r&rescale=0%2C15000000000000000'],
'minzoom': 0,
'maxzoom': 24,
'bounds': [-180.0, -90.0, 180.0, 90.0],
'center': [0.0, 0.0, 0]}
= folium.Map(
m =2,
zoom_start=True,
scroll_wheel_zoom=tiles["tiles"][0],
tiles="VEDA",
attr=18,
minzoom=0,
maxzoom
)
m
Make this Notebook Trusted to load map: File -> Trust Notebook