Skip to content

Commit 39ddc37

Browse files
committed
fix: update Raster api tilejson url for additional datasets
1 parent 282d802 commit 39ddc37

File tree

2 files changed

+45
-701
lines changed

2 files changed

+45
-701
lines changed

user-guide/notebooks/datasets/air-quality-covid.ipynb

+20-271
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"## Approach\n",
3737
"\n",
3838
" 1. Identify available dates and temporal frequency of observations for a given collection - NO₂\n",
39-
" 2. Pass the STAC item into raster API `/stac/tilejson.json` endpoint\n",
39+
" 2. Pass the STAC item into raster API `collections` endpoint\n",
4040
" 3. We'll visualize two tiles (side-by-side) allowing for comparison of each of the time points using `folium.plugins.DualMap`\n",
4141
" "
4242
]
@@ -71,7 +71,7 @@
7171
},
7272
{
7373
"cell_type": "code",
74-
"execution_count": 1,
74+
"execution_count": null,
7575
"metadata": {},
7676
"outputs": [],
7777
"source": [
@@ -81,7 +81,7 @@
8181
},
8282
{
8383
"cell_type": "code",
84-
"execution_count": 2,
84+
"execution_count": null,
8585
"metadata": {},
8686
"outputs": [],
8787
"source": [
@@ -95,67 +95,9 @@
9595
},
9696
{
9797
"cell_type": "code",
98-
"execution_count": 3,
98+
"execution_count": null,
9999
"metadata": {},
100-
"outputs": [
101-
{
102-
"data": {
103-
"text/plain": [
104-
"{'id': 'no2-monthly',\n",
105-
" 'type': 'Collection',\n",
106-
" 'links': [{'rel': 'items',\n",
107-
" 'type': 'application/geo+json',\n",
108-
" 'href': 'https://openveda.cloud/api/stac/collections/no2-monthly/items'},\n",
109-
" {'rel': 'parent',\n",
110-
" 'type': 'application/json',\n",
111-
" 'href': 'https://openveda.cloud/api/stac/'},\n",
112-
" {'rel': 'root',\n",
113-
" 'type': 'application/json',\n",
114-
" 'href': 'https://openveda.cloud/api/stac/'},\n",
115-
" {'rel': 'self',\n",
116-
" 'type': 'application/json',\n",
117-
" 'href': 'https://openveda.cloud/api/stac/collections/no2-monthly'}],\n",
118-
" 'title': 'NO₂',\n",
119-
" 'assets': {'thumbnail': {'href': 'https://thumbnails.openveda.cloud/no2--dataset-cover.jpg',\n",
120-
" 'type': 'image/jpeg',\n",
121-
" 'roles': ['thumbnail'],\n",
122-
" 'title': 'Thumbnail',\n",
123-
" 'description': 'Photo by [Mick Truyts](https://unsplash.com/photos/x6WQeNYJC1w) (Power plant shooting steam at the sky)'}},\n",
124-
" 'extent': {'spatial': {'bbox': [[-180.0, -90.0, 180.0, 90.0]]},\n",
125-
" 'temporal': {'interval': [['2016-01-01T00:00:00+00:00',\n",
126-
" '2022-12-31T00:00:00+00:00']]}},\n",
127-
" 'license': 'MIT',\n",
128-
" 'renders': {'dashboard': {'bidx': [1],\n",
129-
" 'title': 'VEDA Dashboard Render Parameters',\n",
130-
" 'assets': ['cog_default'],\n",
131-
" 'rescale': [[0, 15000000000000000]],\n",
132-
" 'resampling': 'bilinear',\n",
133-
" 'color_formula': 'gamma r 1.05',\n",
134-
" 'colormap_name': 'rdbu_r'}},\n",
135-
" 'providers': [{'url': 'https://disc.gsfc.nasa.gov/',\n",
136-
" 'name': 'NASA Goddard Earth Sciences Data and Information Services Center',\n",
137-
" 'roles': ['producer', 'processor']},\n",
138-
" {'url': 'https://www.earthdata.nasa.gov/dashboard/',\n",
139-
" 'name': 'NASA VEDA',\n",
140-
" 'roles': ['host']}],\n",
141-
" 'summaries': {'datetime': ['2016-01-01T00:00:00Z', '2023-09-30T00:00:00Z']},\n",
142-
" '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.',\n",
143-
" 'item_assets': {'cog_default': {'type': 'image/tiff; application=geotiff; profile=cloud-optimized',\n",
144-
" 'roles': ['data', 'layer'],\n",
145-
" 'title': 'Default COG Layer',\n",
146-
" 'description': 'Cloud optimized default layer to display on map'}},\n",
147-
" 'stac_version': '1.0.0',\n",
148-
" 'stac_extensions': ['https://stac-extensions.github.io/item-assets/v1.0.0/schema.json',\n",
149-
" 'https://stac-extensions.github.io/render/v1.0.0/schema.json'],\n",
150-
" 'dashboard:is_periodic': True,\n",
151-
" 'dashboard:time_density': 'month'}"
152-
]
153-
},
154-
"execution_count": 3,
155-
"metadata": {},
156-
"output_type": "execute_result"
157-
}
158-
],
100+
"outputs": [],
159101
"source": [
160102
"#Fetch STAC collection\n",
161103
"collection = requests.get(f\"{STAC_API_URL}/collections/{collection_name}\").json()\n",
@@ -167,22 +109,14 @@
167109
"cell_type": "markdown",
168110
"metadata": {},
169111
"source": [
170-
"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. "
112+
"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. "
171113
]
172114
},
173115
{
174116
"cell_type": "code",
175-
"execution_count": 4,
117+
"execution_count": null,
176118
"metadata": {},
177-
"outputs": [
178-
{
179-
"name": "stdout",
180-
"output_type": "stream",
181-
"text": [
182-
"Found 93 items\n"
183-
]
184-
}
185-
],
119+
"outputs": [],
186120
"source": [
187121
"# Check total number of items available\n",
188122
"items = requests.get(f\"{STAC_API_URL}/collections/{collection_name}/items?limit=100\").json()[\"features\"]\n",
@@ -194,14 +128,14 @@
194128
"cell_type": "markdown",
195129
"metadata": {},
196130
"source": [
197-
"This makes sense as there are 7 years between 2016 - 2022, with 12 months per year, meaning 84 records in total. \n",
131+
"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",
198132
"\n",
199133
"Below, we'll provide the max range of values to apply to visualizations of all items in the collection (`rescale_values`). "
200134
]
201135
},
202136
{
203137
"cell_type": "code",
204-
"execution_count": 5,
138+
"execution_count": null,
205139
"metadata": {},
206140
"outputs": [],
207141
"source": [
@@ -223,7 +157,7 @@
223157
},
224158
{
225159
"cell_type": "code",
226-
"execution_count": 6,
160+
"execution_count": null,
227161
"metadata": {},
228162
"outputs": [],
229163
"source": [
@@ -241,30 +175,12 @@
241175
},
242176
{
243177
"cell_type": "code",
244-
"execution_count": 7,
178+
"execution_count": null,
245179
"metadata": {},
246-
"outputs": [
247-
{
248-
"data": {
249-
"text/plain": [
250-
"{'tilejson': '2.2.0',\n",
251-
" 'version': '1.0.0',\n",
252-
" 'scheme': 'xyz',\n",
253-
" '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",
254-
" 'minzoom': 0,\n",
255-
" 'maxzoom': 24,\n",
256-
" 'bounds': [-180.0, -90.0, 180.0, 90.0],\n",
257-
" 'center': [0.0, 0.0, 0]}"
258-
]
259-
},
260-
"execution_count": 7,
261-
"metadata": {},
262-
"output_type": "execute_result"
263-
}
264-
],
180+
"outputs": [],
265181
"source": [
266182
"february_2020_tile = requests.get(\n",
267-
" f\"{RASTER_API_URL}/stac/tilejson.json?collection={items['2020-02']['collection']}&item={items['2020-02']['id']}\"\n",
183+
" f\"{RASTER_API_URL}/collections/{items['2020-02']['collection']}/items/{items['2020-02']['id']}/WebMercatorQuad/tilejson.json?\"\n",
268184
" \"&assets=cog_default\"\n",
269185
" \"&color_formula=gamma+r+1.05&colormap_name=cool\"\n",
270186
" f\"&rescale={rescale_values['min']},{rescale_values['max']}\", \n",
@@ -274,30 +190,12 @@
274190
},
275191
{
276192
"cell_type": "code",
277-
"execution_count": 8,
193+
"execution_count": null,
278194
"metadata": {},
279-
"outputs": [
280-
{
281-
"data": {
282-
"text/plain": [
283-
"{'tilejson': '2.2.0',\n",
284-
" 'version': '1.0.0',\n",
285-
" 'scheme': 'xyz',\n",
286-
" '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",
287-
" 'minzoom': 0,\n",
288-
" 'maxzoom': 24,\n",
289-
" 'bounds': [-180.0, -90.0, 180.0, 90.0],\n",
290-
" 'center': [0.0, 0.0, 0]}"
291-
]
292-
},
293-
"execution_count": 8,
294-
"metadata": {},
295-
"output_type": "execute_result"
296-
}
297-
],
195+
"outputs": [],
298196
"source": [
299197
"february_2022_tile = requests.get(\n",
300-
" f\"{RASTER_API_URL}/stac/tilejson.json?collection={items['2022-02']['collection']}&item={items['2022-02']['id']}\"\n",
198+
" f\"{RASTER_API_URL}/collections/{items['2022-02']['collection']}/items/{items['2022-02']['id']}/WebMercatorQuad/tilejson.json?\"\n",
301199
" \"&assets=cog_default\"\n",
302200
" \"&color_formula=gamma+r+1.05&colormap_name=cool\"\n",
303201
" f\"&rescale={rescale_values['min']},{rescale_values['max']}\", \n",
@@ -319,158 +217,9 @@
319217
},
320218
{
321219
"cell_type": "code",
322-
"execution_count": 9,
220+
"execution_count": null,
323221
"metadata": {},
324-
"outputs": [
325-
{
326-
"data": {
327-
"text/html": [
328-
"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"&lt;!DOCTYPE html&gt;\n",
329-
"&lt;html&gt;\n",
330-
"&lt;head&gt;\n",
331-
" \n",
332-
" &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;\n",
333-
" \n",
334-
" &lt;script&gt;\n",
335-
" L_NO_TOUCH = false;\n",
336-
" L_DISABLE_3D = false;\n",
337-
" &lt;/script&gt;\n",
338-
" \n",
339-
" &lt;style&gt;html, body {width: 100%;height: 100%;margin: 0;padding: 0;}&lt;/style&gt;\n",
340-
" &lt;style&gt;#map {position:absolute;top:0;bottom:0;right:0;left:0;}&lt;/style&gt;\n",
341-
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js&quot;&gt;&lt;/script&gt;\n",
342-
" &lt;script src=&quot;https://code.jquery.com/jquery-3.7.1.min.js&quot;&gt;&lt;/script&gt;\n",
343-
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;\n",
344-
" &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js&quot;&gt;&lt;/script&gt;\n",
345-
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css&quot;/&gt;\n",
346-
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css&quot;/&gt;\n",
347-
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css&quot;/&gt;\n",
348-
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css&quot;/&gt;\n",
349-
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css&quot;/&gt;\n",
350-
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css&quot;/&gt;\n",
351-
" \n",
352-
" &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
353-
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
354-
" &lt;style&gt;\n",
355-
" #map_e32927666b28d271958699eb75c9b3de {\n",
356-
" position: absolute;\n",
357-
" width: 50.0%;\n",
358-
" height: 100.0%;\n",
359-
" left: 0.0%;\n",
360-
" top: 0.0%;\n",
361-
" }\n",
362-
" .leaflet-container { font-size: 1rem; }\n",
363-
" &lt;/style&gt;\n",
364-
" \n",
365-
" \n",
366-
" &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
367-
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
368-
" &lt;style&gt;\n",
369-
" #map_bbaf0c0bd1a55e590749e405c5e26755 {\n",
370-
" position: absolute;\n",
371-
" width: 50.0%;\n",
372-
" height: 100.0%;\n",
373-
" left: 50.0%;\n",
374-
" top: 0.0%;\n",
375-
" }\n",
376-
" .leaflet-container { font-size: 1rem; }\n",
377-
" &lt;/style&gt;\n",
378-
" \n",
379-
" &lt;script src=&quot;https://cdn.jsdelivr.net/gh/jieter/Leaflet.Sync/L.Map.Sync.min.js&quot;&gt;&lt;/script&gt;\n",
380-
"&lt;/head&gt;\n",
381-
"&lt;body&gt;\n",
382-
" \n",
383-
" \n",
384-
" &lt;div class=&quot;folium-map&quot; id=&quot;map_e32927666b28d271958699eb75c9b3de&quot; &gt;&lt;/div&gt;\n",
385-
" \n",
386-
" \n",
387-
" &lt;div class=&quot;folium-map&quot; id=&quot;map_bbaf0c0bd1a55e590749e405c5e26755&quot; &gt;&lt;/div&gt;\n",
388-
" \n",
389-
"&lt;/body&gt;\n",
390-
"&lt;script&gt;\n",
391-
" \n",
392-
" \n",
393-
" var map_e32927666b28d271958699eb75c9b3de = L.map(\n",
394-
" &quot;map_e32927666b28d271958699eb75c9b3de&quot;,\n",
395-
" {\n",
396-
" center: [33.6901, 118.9325],\n",
397-
" crs: L.CRS.EPSG3857,\n",
398-
" zoom: 5,\n",
399-
" zoomControl: true,\n",
400-
" preferCanvas: false,\n",
401-
" }\n",
402-
" );\n",
403-
"\n",
404-
" \n",
405-
"\n",
406-
" \n",
407-
" \n",
408-
" var tile_layer_43eced198f351a1c0d707a9014da2382 = L.tileLayer(\n",
409-
" &quot;https://tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
410-
" {&quot;attribution&quot;: &quot;\\u0026copy; \\u003ca href=\\&quot;https://www.openstreetmap.org/copyright\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e contributors&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 19, &quot;maxZoom&quot;: 19, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
411-
" );\n",
412-
" \n",
413-
" \n",
414-
" tile_layer_43eced198f351a1c0d707a9014da2382.addTo(map_e32927666b28d271958699eb75c9b3de);\n",
415-
" \n",
416-
" \n",
417-
" var tile_layer_88bc1f63e04a991c779b5da7850e12cb = L.tileLayer(\n",
418-
" &quot;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&quot;,\n",
419-
" {&quot;attribution&quot;: &quot;VEDA&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 18, &quot;maxZoom&quot;: 18, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 0.8, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
420-
" );\n",
421-
" \n",
422-
" \n",
423-
" tile_layer_88bc1f63e04a991c779b5da7850e12cb.addTo(map_e32927666b28d271958699eb75c9b3de);\n",
424-
" \n",
425-
" \n",
426-
" var map_bbaf0c0bd1a55e590749e405c5e26755 = L.map(\n",
427-
" &quot;map_bbaf0c0bd1a55e590749e405c5e26755&quot;,\n",
428-
" {\n",
429-
" center: [33.6901, 118.9325],\n",
430-
" crs: L.CRS.EPSG3857,\n",
431-
" zoom: 5,\n",
432-
" zoomControl: true,\n",
433-
" preferCanvas: false,\n",
434-
" }\n",
435-
" );\n",
436-
"\n",
437-
" \n",
438-
"\n",
439-
" \n",
440-
" \n",
441-
" var tile_layer_60683b9265ccf303db1f8fcbff7b5bdb = L.tileLayer(\n",
442-
" &quot;https://tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
443-
" {&quot;attribution&quot;: &quot;\\u0026copy; \\u003ca href=\\&quot;https://www.openstreetmap.org/copyright\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e contributors&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 19, &quot;maxZoom&quot;: 19, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
444-
" );\n",
445-
" \n",
446-
" \n",
447-
" tile_layer_60683b9265ccf303db1f8fcbff7b5bdb.addTo(map_bbaf0c0bd1a55e590749e405c5e26755);\n",
448-
" \n",
449-
" \n",
450-
" var tile_layer_ca6be6d014cdfc7a72ce05073ade86d6 = L.tileLayer(\n",
451-
" &quot;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&quot;,\n",
452-
" {&quot;attribution&quot;: &quot;VEDA&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 18, &quot;maxZoom&quot;: 18, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 0.8, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
453-
" );\n",
454-
" \n",
455-
" \n",
456-
" tile_layer_ca6be6d014cdfc7a72ce05073ade86d6.addTo(map_bbaf0c0bd1a55e590749e405c5e26755);\n",
457-
" \n",
458-
" \n",
459-
" map_e32927666b28d271958699eb75c9b3de.sync(map_bbaf0c0bd1a55e590749e405c5e26755);\n",
460-
" map_bbaf0c0bd1a55e590749e405c5e26755.sync(map_e32927666b28d271958699eb75c9b3de);\n",
461-
" \n",
462-
"&lt;/script&gt;\n",
463-
"&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
464-
],
465-
"text/plain": [
466-
"<folium.plugins.dual_map.DualMap at 0x7ff8ceff3bd0>"
467-
]
468-
},
469-
"execution_count": 9,
470-
"metadata": {},
471-
"output_type": "execute_result"
472-
}
473-
],
222+
"outputs": [],
474223
"source": [
475224
"# We'll import folium to map and folium.plugins to allow mapping side-by-side\n",
476225
"import folium\n",
@@ -526,7 +275,7 @@
526275
"name": "python",
527276
"nbconvert_exporter": "python",
528277
"pygments_lexer": "ipython3",
529-
"version": "3.11.9"
278+
"version": "3.12.7"
530279
}
531280
},
532281
"nbformat": 4,

0 commit comments

Comments
 (0)