Skip to content

Commit df46432

Browse files
committed
adding Urban_green_space notebook
1 parent 3101ffb commit df46432

File tree

3 files changed

+102
-67
lines changed

3 files changed

+102
-67
lines changed

Datasets/Africapolis_urban_agglomerations.ipynb

Lines changed: 38 additions & 38 deletions
Large diffs are not rendered by default.

Real_world_examples/Urban_green_space.ipynb

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,27 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "b2a2a558-249e-4ad0-b3e1-397eeb5c0377",
5+
"id": "49fb9369-003a-4817-81e9-2cb3cc514b0e",
66
"metadata": {},
77
"source": [
88
"# OECD/SWAC Urban Green Space and tree cover estimation approach\n",
9-
"\n",
9+
"* **Products used:** \n",
10+
"[esa_worldcover_2020](https://explorer.digitalearth.africa/products/esa_worldcover_2020), [esa_worldcover_2021](https://explorer.digitalearth.africa/products/esa_worldcover_2021)"
11+
]
12+
},
13+
{
14+
"cell_type": "raw",
15+
"id": "4943777f-8599-4a2a-ad3d-b21cdc1bde18",
16+
"metadata": {},
17+
"source": [
18+
"**Keywords**: :index:`datasets; esa_worldcover_2020`, :index:`datasets; esa_worldcover_2021`"
19+
]
20+
},
21+
{
22+
"cell_type": "markdown",
23+
"id": "b2a2a558-249e-4ad0-b3e1-397eeb5c0377",
24+
"metadata": {},
25+
"source": [
1026
"### Background\n",
1127
"This notebook shows the [Sahel and West Africa Club's](https://www.oecd.org/swac/) (SWAC, OECD) approach to estimating urban green space and tree cover indicators within African urban agglomerations. Urban green spaces enhance a city's resilience to climate change and sustainability by mitigating extreme weather and gradual threats like drought and erosion. They reduce air pollution, sequester carbon, improve water quality, and support biodiversity and people's physical and mental health. A [SWAC analysis](https://www.oecd-ilibrary.org/development/boosting-african-cities-resilience-to-climate-change_3303cfb3-en) highlights these benefits for African cities and uncovers interesting continental trends.\n",
1228
"\n",
@@ -143,7 +159,7 @@
143159
" <meta name="viewport" content="width=device-width,\n",
144160
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n",
145161
" <style>\n",
146-
" #map_06894361789f5a3b0acf408c2289289f {\n",
162+
" #map_0a0016f958e13c993f026949793cb32e {\n",
147163
" position: relative;\n",
148164
" width: 100.0%;\n",
149165
" height: 100.0%;\n",
@@ -173,14 +189,14 @@
173189
"<body>\n",
174190
" \n",
175191
" \n",
176-
" <div class="folium-map" id="map_06894361789f5a3b0acf408c2289289f" ></div>\n",
192+
" <div class="folium-map" id="map_0a0016f958e13c993f026949793cb32e" ></div>\n",
177193
" \n",
178194
"</body>\n",
179195
"<script>\n",
180196
" \n",
181197
" \n",
182-
" var map_06894361789f5a3b0acf408c2289289f = L.map(\n",
183-
" "map_06894361789f5a3b0acf408c2289289f",\n",
198+
" var map_0a0016f958e13c993f026949793cb32e = L.map(\n",
199+
" "map_0a0016f958e13c993f026949793cb32e",\n",
184200
" {\n",
185201
" center: [6.6975, -1.6286],\n",
186202
" crs: L.CRS.EPSG3857,\n",
@@ -189,79 +205,79 @@
189205
" preferCanvas: false,\n",
190206
" }\n",
191207
" );\n",
192-
" L.control.scale().addTo(map_06894361789f5a3b0acf408c2289289f);\n",
208+
" L.control.scale().addTo(map_0a0016f958e13c993f026949793cb32e);\n",
193209
"\n",
194210
" \n",
195211
"\n",
196212
" \n",
197213
" \n",
198-
" var tile_layer_565e9d20e8c910cb79df3e789f4c3ea3 = L.tileLayer(\n",
214+
" var tile_layer_94aa53f8dea5a6d1d28f4e2e47a9f6f7 = L.tileLayer(\n",
199215
" "https://mt1.google.com/vt/lyrs=s\\u0026x={x}\\u0026y={y}\\u0026z={z}",\n",
200216
" {"attribution": "http://mt0.google.com/vt/lyrs=y\\u0026hl=en\\u0026x={x}\\u0026y={y}\\u0026z={z}", "detectRetina": false, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n",
201217
" );\n",
202218
" \n",
203219
" \n",
204-
" tile_layer_565e9d20e8c910cb79df3e789f4c3ea3.addTo(map_06894361789f5a3b0acf408c2289289f);\n",
220+
" tile_layer_94aa53f8dea5a6d1d28f4e2e47a9f6f7.addTo(map_0a0016f958e13c993f026949793cb32e);\n",
205221
" \n",
206222
" \n",
207-
" map_06894361789f5a3b0acf408c2289289f.fitBounds(\n",
223+
" map_0a0016f958e13c993f026949793cb32e.fitBounds(\n",
208224
" [[6.4975, -1.8286], [6.8975, -1.4286]],\n",
209225
" {}\n",
210226
" );\n",
211227
" \n",
212228
" \n",
213-
" function geo_json_ba27429b7f1551c76ecec4478c2e9ebe_styler(feature) {\n",
229+
" function geo_json_3133d596ddc276ad9109b9a6a622feee_styler(feature) {\n",
214230
" switch(feature.id) {\n",
215231
" default:\n",
216232
" return {"fillOpacity": 0.5, "weight": 2};\n",
217233
" }\n",
218234
" }\n",
219-
" function geo_json_ba27429b7f1551c76ecec4478c2e9ebe_highlighter(feature) {\n",
235+
" function geo_json_3133d596ddc276ad9109b9a6a622feee_highlighter(feature) {\n",
220236
" switch(feature.id) {\n",
221237
" default:\n",
222238
" return {"fillOpacity": 0.75};\n",
223239
" }\n",
224240
" }\n",
225-
" function geo_json_ba27429b7f1551c76ecec4478c2e9ebe_pointToLayer(feature, latlng) {\n",
241+
" function geo_json_3133d596ddc276ad9109b9a6a622feee_pointToLayer(feature, latlng) {\n",
226242
" var opts = {"bubblingMouseEvents": true, "color": "#3388ff", "dashArray": null, "dashOffset": null, "fill": true, "fillColor": "#3388ff", "fillOpacity": 0.2, "fillRule": "evenodd", "lineCap": "round", "lineJoin": "round", "opacity": 1.0, "radius": 2, "stroke": true, "weight": 3};\n",
227243
" \n",
228-
" let style = geo_json_ba27429b7f1551c76ecec4478c2e9ebe_styler(feature)\n",
244+
" let style = geo_json_3133d596ddc276ad9109b9a6a622feee_styler(feature)\n",
229245
" Object.assign(opts, style)\n",
230246
" \n",
231247
" return new L.CircleMarker(latlng, opts)\n",
232248
" }\n",
233249
"\n",
234-
" function geo_json_ba27429b7f1551c76ecec4478c2e9ebe_onEachFeature(feature, layer) {\n",
250+
" function geo_json_3133d596ddc276ad9109b9a6a622feee_onEachFeature(feature, layer) {\n",
235251
" layer.on({\n",
236252
" mouseout: function(e) {\n",
237253
" if(typeof e.target.setStyle === "function"){\n",
238-
" geo_json_ba27429b7f1551c76ecec4478c2e9ebe.resetStyle(e.target);\n",
254+
" geo_json_3133d596ddc276ad9109b9a6a622feee.resetStyle(e.target);\n",
239255
" }\n",
240256
" },\n",
241257
" mouseover: function(e) {\n",
242258
" if(typeof e.target.setStyle === "function"){\n",
243-
" const highlightStyle = geo_json_ba27429b7f1551c76ecec4478c2e9ebe_highlighter(e.target.feature)\n",
259+
" const highlightStyle = geo_json_3133d596ddc276ad9109b9a6a622feee_highlighter(e.target.feature)\n",
244260
" e.target.setStyle(highlightStyle);\n",
245261
" }\n",
246262
" },\n",
247263
" });\n",
248264
" };\n",
249-
" var geo_json_ba27429b7f1551c76ecec4478c2e9ebe = L.geoJson(null, {\n",
250-
" onEachFeature: geo_json_ba27429b7f1551c76ecec4478c2e9ebe_onEachFeature,\n",
265+
" var geo_json_3133d596ddc276ad9109b9a6a622feee = L.geoJson(null, {\n",
266+
" onEachFeature: geo_json_3133d596ddc276ad9109b9a6a622feee_onEachFeature,\n",
251267
" \n",
252-
" style: geo_json_ba27429b7f1551c76ecec4478c2e9ebe_styler,\n",
253-
" pointToLayer: geo_json_ba27429b7f1551c76ecec4478c2e9ebe_pointToLayer,\n",
268+
" style: geo_json_3133d596ddc276ad9109b9a6a622feee_styler,\n",
269+
" pointToLayer: geo_json_3133d596ddc276ad9109b9a6a622feee_pointToLayer,\n",
254270
" });\n",
255271
"\n",
256-
" function geo_json_ba27429b7f1551c76ecec4478c2e9ebe_add (data) {\n",
257-
" geo_json_ba27429b7f1551c76ecec4478c2e9ebe\n",
272+
" function geo_json_3133d596ddc276ad9109b9a6a622feee_add (data) {\n",
273+
" geo_json_3133d596ddc276ad9109b9a6a622feee\n",
258274
" .addData(data);\n",
259275
" }\n",
260-
" geo_json_ba27429b7f1551c76ecec4478c2e9ebe_add({"bbox": [-1.8286, 6.4975, -1.4286, 6.8975], "features": [{"bbox": [-1.8286, 6.4975, -1.4286, 6.8975], "geometry": {"coordinates": [[[-1.4286, 6.4975], [-1.4286, 6.8975], [-1.8286, 6.8975], [-1.8286, 6.4975], [-1.4286, 6.4975]]], "type": "Polygon"}, "id": "0", "properties": {"agglosID": 1}, "type": "Feature"}], "type": "FeatureCollection"});\n",
276+
" geo_json_3133d596ddc276ad9109b9a6a622feee_add({"bbox": [-1.8286, 6.4975, -1.4286, 6.8975], "features": [{"bbox": [-1.8286, 6.4975, -1.4286, 6.8975], "geometry": {"coordinates": [[[-1.4286, 6.4975], [-1.4286, 6.8975], [-1.8286, 6.8975], [-1.8286, 6.4975], [-1.4286, 6.4975]]], "type": "Polygon"}, "id": "0", "properties": {"agglosID": 1}, "type": "Feature"}], "type": "FeatureCollection"});\n",
261277
"\n",
262278
" \n",
263279
" \n",
264-
" geo_json_ba27429b7f1551c76ecec4478c2e9ebe.bindTooltip(\n",
280+
" geo_json_3133d596ddc276ad9109b9a6a622feee.bindTooltip(\n",
265281
" function(layer){\n",
266282
" let div = L.DomUtil.create('div');\n",
267283
" \n",
@@ -285,13 +301,13 @@
285301
" ,{"className": "foliumtooltip", "sticky": true});\n",
286302
" \n",
287303
" \n",
288-
" geo_json_ba27429b7f1551c76ecec4478c2e9ebe.addTo(map_06894361789f5a3b0acf408c2289289f);\n",
304+
" geo_json_3133d596ddc276ad9109b9a6a622feee.addTo(map_0a0016f958e13c993f026949793cb32e);\n",
289305
" \n",
290306
"</script>\n",
291307
"&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
292308
],
293309
"text/plain": [
294-
"<folium.folium.Map at 0x7fca172768f0>"
310+
"<folium.folium.Map at 0x7fd1f76f9ea0>"
295311
]
296312
},
297313
"execution_count": 3,
@@ -340,7 +356,7 @@
340356
{
341357
"data": {
342358
"application/vnd.jupyter.widget-view+json": {
343-
"model_id": "b8e075f07bea4ef5a331d02c1765b0b7",
359+
"model_id": "c8df1f17bfe943e28aa570bcfca09529",
344360
"version_major": 2,
345361
"version_minor": 0
346362
},
@@ -783,6 +799,7 @@
783799
" 'p_Urban_green_space_WC2020', 'p_Tree_cover_WC2020', \n",
784800
" 'p_Urban_green_space_WC2021', 'p_Tree_cover_WC2021', 'geometry']].copy()\n",
785801
"\n",
802+
"# Convert the resulting DataFrame into a GeoDataFrame to handle spatial data, setting the geometry column appropriately and defining the CRS as \"EPSG:4326\"\n",
786803
"green_space_indicators = gpd.GeoDataFrame(green_space_indicators, geometry='geometry', crs=\"EPSG:4326\")\n",
787804
"# Display final DataFrame\n",
788805
"green_space_indicators.head()\n"

Real_world_examples/Urban_tree_extent.ipynb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "08f33717-dc1d-4eb9-8943-27ba578b60b2",
6+
"metadata": {},
7+
"source": [
8+
"# Mapping urban tree extent\n",
9+
"* **Products used:** \n",
10+
"[gm_s2_annual](https://explorer.digitalearth.africa/gm_s2_annual)"
11+
]
12+
},
13+
{
14+
"cell_type": "raw",
15+
"id": "6183bcd4-5471-4ea1-b8d8-7cc4d53b93fc",
16+
"metadata": {},
17+
"source": [
18+
"**Keywords**: :index:`data used; sentinel-2 geomedian`"
19+
]
20+
},
321
{
422
"cell_type": "markdown",
523
"id": "b2a2a558-249e-4ad0-b3e1-397eeb5c0377",
624
"metadata": {
725
"tags": []
826
},
927
"source": [
10-
"# Mapping urban tree extent\n",
28+
"## Background\n",
1129
"Urban green spaces, particularly urban trees, play a vital role in enhancing the quality of life in cities by providing ecosystem services such as air purification, temperature regulation, and recreational spaces for residents. Accurate mapping and monitoring of urban tree extent are essential for urban planners and environmental managers to ensure sustainable urban development. Mapping urban tree cover enables the analysis of their potential as nature-based solutions to mitigate extreme heat, as [illustrated here](https://www.mapping-africa-transformations.org/green-spaces-nbs-heat-waves/).\n",
1230
"\n",
1331
"This work is part of a collaborative initiative between **Digital Earth Africa** and the **OECD Sahel and West Africa Club (SWAC)** to advance tools and methodologies for urban sustainability in Africa. By leveraging satellite imagery from Sentinel-2, this partnership aims to provide robust, data-driven insights for mapping and monitoring urban vegetation across African cities. Satellite imagery, particularly from high-resolution sensors like Sentinel-2, offers a valuable tool for mapping and monitoring vegetation in urban areas. Sentinel-2 provides multispectral data with a resolution that is suitable for detecting and analyzing urban trees at a city-wide scale. This data, combined with advanced classification techniques, can help in the accurate delineation of urban green spaces.\n",

0 commit comments

Comments
 (0)