Skip to content

fix: update Raster api tilejson url for additional datasets #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 37 additions & 33 deletions user-guide/notebooks/datasets/air-quality-covid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"## Approach\n",
"\n",
" 1. Identify available dates and temporal frequency of observations for a given collection - NO₂\n",
" 2. Pass the STAC item into raster API `/stac/tilejson.json` endpoint\n",
" 2. Pass the STAC item into raster API `collections` endpoint\n",
" 3. We'll visualize two tiles (side-by-side) allowing for comparison of each of the time points using `folium.plugins.DualMap`\n",
" "
]
Expand Down Expand Up @@ -114,7 +114,11 @@
" 'href': 'https://openveda.cloud/api/stac/'},\n",
" {'rel': 'self',\n",
" 'type': 'application/json',\n",
" 'href': 'https://openveda.cloud/api/stac/collections/no2-monthly'}],\n",
" 'href': 'https://openveda.cloud/api/stac/collections/no2-monthly'},\n",
" {'rel': 'http://www.opengis.net/def/rel/ogc/1.0/queryables',\n",
" 'type': 'application/schema+json',\n",
" 'title': 'Queryables',\n",
" 'href': 'https://openveda.cloud/api/stac/collections/no2-monthly/queryables'}],\n",
" 'title': 'NO₂',\n",
" 'assets': {'thumbnail': {'href': 'https://thumbnails.openveda.cloud/no2--dataset-cover.jpg',\n",
" 'type': 'image/jpeg',\n",
Expand Down Expand Up @@ -167,7 +171,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Examining the contents of our `collection` under `summaries` we see that the data is available from January 2015 to December 2022. By looking at the `dashboard:time density` we observe that the periodic frequency of these observations is monthly. "
"Examining the contents of our `collection` under `summaries` we see that the data is available from January 2015 to September 2023. By looking at the `dashboard:time density` we observe that the periodic frequency of these observations is monthly. "
]
},
{
Expand All @@ -194,7 +198,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This makes sense as there are 7 years between 2016 - 2022, with 12 months per year, meaning 84 records in total. \n",
"This makes sense as there are 8 years between 2016 - 2023, with 12 months per year, meaning 96 possible records. Since our dataset ends in September, we subtract 3 months to give us a total of 93 items.\n",
"\n",
"Below, we'll provide the max range of values to apply to visualizations of all items in the collection (`rescale_values`). "
]
Expand Down Expand Up @@ -250,7 +254,7 @@
"{'tilejson': '2.2.0',\n",
" 'version': '1.0.0',\n",
" 'scheme': 'xyz',\n",
" 'tiles': ['https://openveda.cloud/api/raster/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=no2-monthly&item=OMI_trno2_0.10x0.10_202002_Col3_V4.nc&assets=cog_default&color_formula=gamma+r+1.05&colormap_name=cool&rescale=-1018382487283302%2C50064805976866816'],\n",
" 'tiles': ['https://openveda.cloud/api/raster/collections/no2-monthly/items/OMI_trno2_0.10x0.10_202002_Col3_V4.nc/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default&color_formula=gamma+r+1.05&colormap_name=cool&rescale=-1018382487283302%2C50064805976866816'],\n",
" 'minzoom': 0,\n",
" 'maxzoom': 24,\n",
" 'bounds': [-180.0, -90.0, 180.0, 90.0],\n",
Expand All @@ -264,7 +268,7 @@
],
"source": [
"february_2020_tile = requests.get(\n",
" f\"{RASTER_API_URL}/stac/tilejson.json?collection={items['2020-02']['collection']}&item={items['2020-02']['id']}\"\n",
" f\"{RASTER_API_URL}/collections/{items['2020-02']['collection']}/items/{items['2020-02']['id']}/WebMercatorQuad/tilejson.json?\"\n",
" \"&assets=cog_default\"\n",
" \"&color_formula=gamma+r+1.05&colormap_name=cool\"\n",
" f\"&rescale={rescale_values['min']},{rescale_values['max']}\", \n",
Expand All @@ -283,7 +287,7 @@
"{'tilejson': '2.2.0',\n",
" 'version': '1.0.0',\n",
" 'scheme': 'xyz',\n",
" 'tiles': ['https://openveda.cloud/api/raster/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=no2-monthly&item=OMI_trno2_0.10x0.10_202202_Col3_V4.nc&assets=cog_default&color_formula=gamma+r+1.05&colormap_name=cool&rescale=-1018382487283302%2C50064805976866816'],\n",
" 'tiles': ['https://openveda.cloud/api/raster/collections/no2-monthly/items/OMI_trno2_0.10x0.10_202202_Col3_V4.nc/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default&color_formula=gamma+r+1.05&colormap_name=cool&rescale=-1018382487283302%2C50064805976866816'],\n",
" 'minzoom': 0,\n",
" 'maxzoom': 24,\n",
" 'bounds': [-180.0, -90.0, 180.0, 90.0],\n",
Expand All @@ -297,7 +301,7 @@
],
"source": [
"february_2022_tile = requests.get(\n",
" f\"{RASTER_API_URL}/stac/tilejson.json?collection={items['2022-02']['collection']}&item={items['2022-02']['id']}\"\n",
" f\"{RASTER_API_URL}/collections/{items['2022-02']['collection']}/items/{items['2022-02']['id']}/WebMercatorQuad/tilejson.json?\"\n",
" \"&assets=cog_default\"\n",
" \"&color_formula=gamma+r+1.05&colormap_name=cool\"\n",
" f\"&rescale={rescale_values['min']},{rescale_values['max']}\", \n",
Expand Down Expand Up @@ -344,15 +348,15 @@
" <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n",
" <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css"/>\n",
" <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"/>\n",
" <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"/>\n",
" <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css"/>\n",
" <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css"/>\n",
" <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n",
" <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n",
" \n",
" <meta name="viewport" content="width=device-width,\n",
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n",
" <style>\n",
" #map_e32927666b28d271958699eb75c9b3de {\n",
" #map_5c580dfb463638fd141c9f35e26e764a {\n",
" position: absolute;\n",
" width: 50.0%;\n",
" height: 100.0%;\n",
Expand All @@ -366,7 +370,7 @@
" <meta name="viewport" content="width=device-width,\n",
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n",
" <style>\n",
" #map_bbaf0c0bd1a55e590749e405c5e26755 {\n",
" #map_182773b58f4c85e85d56761b3fdd307b {\n",
" position: absolute;\n",
" width: 50.0%;\n",
" height: 100.0%;\n",
Expand All @@ -381,17 +385,17 @@
"<body>\n",
" \n",
" \n",
" <div class="folium-map" id="map_e32927666b28d271958699eb75c9b3de" ></div>\n",
" <div class="folium-map" id="map_5c580dfb463638fd141c9f35e26e764a" ></div>\n",
" \n",
" \n",
" <div class="folium-map" id="map_bbaf0c0bd1a55e590749e405c5e26755" ></div>\n",
" <div class="folium-map" id="map_182773b58f4c85e85d56761b3fdd307b" ></div>\n",
" \n",
"</body>\n",
"<script>\n",
" \n",
" \n",
" var map_e32927666b28d271958699eb75c9b3de = L.map(\n",
" "map_e32927666b28d271958699eb75c9b3de",\n",
" var map_5c580dfb463638fd141c9f35e26e764a = L.map(\n",
" "map_5c580dfb463638fd141c9f35e26e764a",\n",
" {\n",
" center: [33.6901, 118.9325],\n",
" crs: L.CRS.EPSG3857,\n",
Expand All @@ -405,26 +409,26 @@
"\n",
" \n",
" \n",
" var tile_layer_43eced198f351a1c0d707a9014da2382 = L.tileLayer(\n",
" var tile_layer_d7403ada74d0a75486a18ee0b5f43416 = L.tileLayer(\n",
" "https://tile.openstreetmap.org/{z}/{x}/{y}.png",\n",
" {"attribution": "\\u0026copy; \\u003ca href=\\"https://www.openstreetmap.org/copyright\\"\\u003eOpenStreetMap\\u003c/a\\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n",
" );\n",
" \n",
" \n",
" tile_layer_43eced198f351a1c0d707a9014da2382.addTo(map_e32927666b28d271958699eb75c9b3de);\n",
" tile_layer_d7403ada74d0a75486a18ee0b5f43416.addTo(map_5c580dfb463638fd141c9f35e26e764a);\n",
" \n",
" \n",
" var tile_layer_88bc1f63e04a991c779b5da7850e12cb = L.tileLayer(\n",
" "https://openveda.cloud/api/raster/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=no2-monthly\\u0026item=OMI_trno2_0.10x0.10_202002_Col3_V4.nc\\u0026assets=cog_default\\u0026color_formula=gamma+r+1.05\\u0026colormap_name=cool\\u0026rescale=-1018382487283302%2C50064805976866816",\n",
" {"attribution": "VEDA", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 0.8, "subdomains": "abc", "tms": false}\n",
" var tile_layer_5785cc3f5a418b0e27c8bd61af058158 = L.tileLayer(\n",
" "https://openveda.cloud/api/raster/collections/no2-monthly/items/OMI_trno2_0.10x0.10_202002_Col3_V4.nc/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default\\u0026color_formula=gamma+r+1.05\\u0026colormap_name=cool\\u0026rescale=-1018382487283302%2C50064805976866816",\n",
" {"attribution": "VEDA", "detectRetina": false, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 0.8, "subdomains": "abc", "tms": false}\n",
" );\n",
" \n",
" \n",
" tile_layer_88bc1f63e04a991c779b5da7850e12cb.addTo(map_e32927666b28d271958699eb75c9b3de);\n",
" tile_layer_5785cc3f5a418b0e27c8bd61af058158.addTo(map_5c580dfb463638fd141c9f35e26e764a);\n",
" \n",
" \n",
" var map_bbaf0c0bd1a55e590749e405c5e26755 = L.map(\n",
" "map_bbaf0c0bd1a55e590749e405c5e26755",\n",
" var map_182773b58f4c85e85d56761b3fdd307b = L.map(\n",
" "map_182773b58f4c85e85d56761b3fdd307b",\n",
" {\n",
" center: [33.6901, 118.9325],\n",
" crs: L.CRS.EPSG3857,\n",
Expand All @@ -438,32 +442,32 @@
"\n",
" \n",
" \n",
" var tile_layer_60683b9265ccf303db1f8fcbff7b5bdb = L.tileLayer(\n",
" var tile_layer_223fcae3834456c7abbdbc4f06b72f0c = L.tileLayer(\n",
" "https://tile.openstreetmap.org/{z}/{x}/{y}.png",\n",
" {"attribution": "\\u0026copy; \\u003ca href=\\"https://www.openstreetmap.org/copyright\\"\\u003eOpenStreetMap\\u003c/a\\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n",
" );\n",
" \n",
" \n",
" tile_layer_60683b9265ccf303db1f8fcbff7b5bdb.addTo(map_bbaf0c0bd1a55e590749e405c5e26755);\n",
" tile_layer_223fcae3834456c7abbdbc4f06b72f0c.addTo(map_182773b58f4c85e85d56761b3fdd307b);\n",
" \n",
" \n",
" var tile_layer_ca6be6d014cdfc7a72ce05073ade86d6 = L.tileLayer(\n",
" "https://openveda.cloud/api/raster/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=no2-monthly\\u0026item=OMI_trno2_0.10x0.10_202202_Col3_V4.nc\\u0026assets=cog_default\\u0026color_formula=gamma+r+1.05\\u0026colormap_name=cool\\u0026rescale=-1018382487283302%2C50064805976866816",\n",
" {"attribution": "VEDA", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 0.8, "subdomains": "abc", "tms": false}\n",
" var tile_layer_20b594d3b02cb64d2f08f778883e20a4 = L.tileLayer(\n",
" "https://openveda.cloud/api/raster/collections/no2-monthly/items/OMI_trno2_0.10x0.10_202202_Col3_V4.nc/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default\\u0026color_formula=gamma+r+1.05\\u0026colormap_name=cool\\u0026rescale=-1018382487283302%2C50064805976866816",\n",
" {"attribution": "VEDA", "detectRetina": false, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 0.8, "subdomains": "abc", "tms": false}\n",
" );\n",
" \n",
" \n",
" tile_layer_ca6be6d014cdfc7a72ce05073ade86d6.addTo(map_bbaf0c0bd1a55e590749e405c5e26755);\n",
" tile_layer_20b594d3b02cb64d2f08f778883e20a4.addTo(map_182773b58f4c85e85d56761b3fdd307b);\n",
" \n",
" \n",
" map_e32927666b28d271958699eb75c9b3de.sync(map_bbaf0c0bd1a55e590749e405c5e26755);\n",
" map_bbaf0c0bd1a55e590749e405c5e26755.sync(map_e32927666b28d271958699eb75c9b3de);\n",
" map_5c580dfb463638fd141c9f35e26e764a.sync(map_182773b58f4c85e85d56761b3fdd307b);\n",
" map_182773b58f4c85e85d56761b3fdd307b.sync(map_5c580dfb463638fd141c9f35e26e764a);\n",
" \n",
"</script>\n",
"&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
"<folium.plugins.dual_map.DualMap at 0x7ff8ceff3bd0>"
"<folium.plugins.dual_map.DualMap at 0x7f8058b99c40>"
]
},
"execution_count": 9,
Expand Down Expand Up @@ -526,7 +530,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
Loading
Loading