How green are South Africa's three largest city-regions, when you compare like with like?
Day 20's theme is Hexagons, and it's the day hexagons earn their keep. Johannesburg, Cape Town and Durban sit in completely different natural landscapes: Highveld grassland, Cape fynbos and subtropical KwaZulu-Natal bush. Their municipal boundaries are different shapes and sizes, and they take in very different amounts of farmland, mountain and plantation. A grid of identical cells is the fairest way I know to lay three such different places side by side.
So the report, Three City-Regions, Three Forests, asks what tree cover means in each one. In Johannesburg, trees are largely planted. In Cape Town, the natural vegetation is fynbos, a shrubland, so low tree cover is often the healthy state rather than a deficit. Around Durban, green valleys and ravines run through suburbs that were cut out of subtropical forest.
It's a land-cover map, not a canopy survey or a heat-risk model, and I've tried to keep it honest about that throughout.
Explore the interactive report
The map shows every hexagon of about 0.74 km² across the selected city-region, extruded by its tree cover and coloured by its class.
- Pick a city-region: Cape Town, Durban & Pietermaritzburg, or Johannesburg & Pretoria. The map flies there and the story card changes to that region's story.
- Pan or zoom: the three figures (urban tree cover, urban built-up and the number of urban hexagons) and the bar chart describe only the urban hexagons in view. Zoom into a suburb and you see its numbers.
- Tilt the map: right-drag to see the forests stand up. Tall dark green columns are the most tree-covered hexagons.
- Click a hexagon class: the coloured buttons above the City Region slicer show only that class on the map, so you can see, for example, where Cape Town's few tree-dominated urban hexagons are. The figures and chart don't change: the buttons only filter the map.
- The comparison table: stays put. It shows all three city-regions, urban hexagons only, with the selected one highlighted.
Interactive report: Day 20, Hexagons
What the map doesn't show: which trees are planted, indigenous or invasive, how healthy the canopy is, or how much shade anyone actually gets.
Starting with ESA WorldCover
The land cover comes from ESA WorldCover 2021 v200, a global 10 m land-cover map built from Sentinel-1 and Sentinel-2 imagery. Every 10 m pixel is one of eleven classes; the ones that matter here are tree cover, shrubland, grassland, cropland, built-up, bare ground, wetland and water.
The three city-regions needed four 3 × 3 degree tiles, downloaded through ESA's Terrascope tile picker as three zips (about 330 MB). The fourth tile is easy to miss: eThekwini's south coast, around Amanzimtoti, crosses 30°S into the next tile down. Unzipped, the four map tiles are about 290 MB of GeoTIFF.
WorldCover's global accuracy is 76.7%. That isn't a South African figure, and the classes vary: tree cover is among the more reliable, while shrubland is among the weaker. That matters in Cape Town, where fynbos is often classed as grassland, which is one reason the report groups shrubland and grassland together.
Drawing the three city-regions
The city-regions are groups of municipalities:
| City-region | Municipalities |
|---|---|
| Johannesburg & Pretoria | City of Johannesburg, City of Tshwane, City of Ekurhuleni |
| Cape Town | City of Cape Town, Stellenbosch |
| Durban & Pietermaritzburg | eThekwini, Msunduzi |
I reused the OpenStreetMap municipal outlines I built for Day 11 and used again on Day 16.
One check was worth making. The OpenStreetMap outline of eThekwini covers 2,292 km², but Census 2022 and the Demarcation Board give about 2,556 km². Comparing the two shapes showed a rural block of about 265 km² in the south-west that OpenStreetMap still places in neighbouring municipalities: eThekwini's pre-2016 boundary. Even the live OpenStreetMap relation is the old shape. I kept it, because the missing area is rural and doesn't change the Durban story, and the methodology says so.
From 542 million pixels to 20,442 hexagons
The hexagons are H3 resolution 8, Uber's hierarchical hexagon grid, at about 0.74 km² each.
Pixel by pixel, no shortcuts
My first plan was to aggregate the 10 m pixels to 100 m blocks and then to hexagons. I dropped that: it adds a second approximation for no real gain. Instead, every pixel goes straight to its hexagon. A Python script reads each tile in windows over each city-region with rasterio, and DuckDB's H3 extension assigns each pixel centre to its resolution-8 cell and counts pixels by class. With about 7,400 pixels per hexagon, counting pixels is effectively area-weighting.
Whole hexagons, not clipped ones
A hexagon belongs to a city-region if its centre falls inside the outline. I didn't clip hexagons at the boundary, because a clipped edge cell would then be drawn as a full hexagon but describe only part of it. Two checks confirmed the approach: every hexagon has between 99.7% and 100.1% of the pixels its area implies, and the hexagons in each municipality add up to within 1% of its outline area.
Shares of land, not water
Coastal and dam hexagons can be half water, which would dilute every other share. So all percentages are of land, with water left out of the denominator, and the 34 hexagons less than 25% land were dropped.
The result is 20,442 hexagons covering about 16,000 km² of land: 12,031 in Johannesburg & Pretoria, 4,692 in Cape Town and 3,719 in Durban & Pietermaritzburg.
Five classes
Each hexagon gets one class from its mix of land cover:
| Class | Rule |
|---|---|
| Tree-dominated | tree cover ≥ 40% (and built-up < 40%) |
| Green built-up | built-up ≥ 40% and tree cover ≥ 20% |
| Built-up, little tree cover | built-up ≥ 40% and tree cover < 20% |
| Natural low vegetation | shrub + grass ≥ 50% |
| Mixed | no single land cover dominates |
I tested the thresholds against places I know: Houghton, Saxonwold, Constantia, Kloof and Westville come out tree-dominated; Soweto, Tembisa, Diepsloot, Khayelitsha and Mitchells Plain built-up with little tree cover; Randburg, Chatsworth and Umlazi green built-up; Table Mountain natural low vegetation.
Comparing like with like
This was the most important design decision in the report, and it took a few attempts to get right.
The three regions aren't the same kind of place
Johannesburg & Pretoria has three times as many hexagons as Durban & Pietermaritzburg, and most of the difference is rural: Tshwane's large north and east, Cape Town's mountains and wine farms, Durban's plantations and the Valley of a Thousand Hills. On all land, Cape Town has more tree cover than Johannesburg & Pretoria (14.3% against 9.7%), but that says more about Tshwane's farmland than about either city.
Urban hexagons
So every figure in the report, apart from the map itself, uses urban hexagons: those at least 25% built-up. That keeps the leafy suburbs (Houghton is about 25% built-up and 60% trees) and leaves out most of the rural fringe.
A threshold is a choice, so I tested 20%, 25%, 30% and 40%:
| Built-up threshold | Urban tree cover: Jhb & Pta | Cape Town | Durban & Pmb |
|---|---|---|---|
| 20% | 13.9% | 12.2% | 35.9% |
| 25% | 13.6% | 11.2% | 34.3% |
| 30% | 13.3% | 10.5% | 32.2% |
| 40% | 12.0% | 8.6% | 27.8% |
The ranking never changes. What does change is revealing: as the threshold rises, Durban loses its urban hexagons fastest (47% of them between 20% and 40%, against 22% for Cape Town), because so many of its suburbs are built in among trees. A strict threshold would quietly remove Durban's green suburbs and understate its greenness. I chose 25%, and the threshold isn't a report option: it's a robustness check, not something readers need to adjust.
Building the map in Icon Map Slicer
Hexagons from pre-computed indexes
Icon Map Slicer can bin points into H3 cells itself, but with 20,442 cells already computed there's no need. Each row carries its H3 index in the category field, and the cells layer reads the index directly: no latitude, longitude or point rows, and nothing to aggregate at render time.
Height and colour from different fields
The cell weight is the hexagon's tree cover percentage, and the cells are extruded by it, so the tallest columns are the most tree-covered hexagons. The colour is separate: with Use Power BI Formatting switched on, the cells' fill colour takes a hex code per row, so each hexagon is coloured by its class while its height shows tree cover. Tilted at 50°, Johannesburg's northern suburbs and Durban's valleys rise out of the map as dark green ridges.
I capped the tilt at 60°. At steeper angles the visible area runs to the horizon, and the map-view filter (below) then reports far more land than you think you're looking at.
The map view filters the report
As on Day 19, the Slicer's view filter does most of the work. I bound its slice latitude and longitude to each hexagon's centre, so panning or zooming narrows the hexagons table, and the figures and chart describe only what's on screen.
Keeping the comparison table whole
The comparison table needs all three regions, but it also highlights the selected one. Its rows come from a separate, unrelated list of regions, so the slicer can't remove them, and a small measure gives the selected row a light blue background.
Design: fewer measures, one colour scheme
One set of colours. The five class colours are used in the map, on the class buttons and on the chart's bars. Dark green for tree-dominated, light green for green built-up, warm grey for built-up with little tree cover, sand for natural low vegetation, pale stone for mixed. You never have to learn a second colour scheme.
A chart that counts hexagons. The chart shows the share of urban hexagons in each class, in the same colours as the buttons. Its subtitle says share of urban hexagons (not land area), because the figures above it are land shares: in Cape Town, 73% of urban hexagons are built-up with little tree cover, while 11.2% of urban land is trees.
Three figures that don't repeat the chart. I replaced a "low-tree urban hexagons" KPI with the number of urban hexagons in view, because the low-tree share is the chart's grey bar. The three figures are now tree cover, built-up and how many hexagons they describe. Zoomed into forest, they say "none in view" rather than (Blank).
What the map reveals
Durban is by far the greenest city. Its urban hexagons have 34.3% tree cover, about two and a half times Johannesburg & Pretoria (13.6%) and three times Cape Town (11.2%). Two-thirds of its urban hexagons are green built-up (41%) or tree-dominated (25%). Its trees aren't confined to parks: they form whole leafy neighbourhoods.
| Urban hexagons (≥ 25% built-up) | Hexagons | Tree cover | Built-up | Built-up, little tree cover |
|---|---|---|---|---|
| Cape Town | 1,127 | 11.2% | 63.6% | 73% |
| Durban & Pietermaritzburg | 1,054 | 34.3% | 47.9% | 20% |
| Johannesburg & Pretoria | 3,641 | 13.6% | 58.5% | 59% |
Johannesburg's forest is real, but concentrated. On all land, the City of Johannesburg has 15.9% tree cover, about twice Tshwane (8.8%) and Ekurhuleni (7.1%). Tilt the map and the northern suburbs stand out clearly, while Soweto, the mining belt and the East Rand are far less green. Across the whole city-region, though, only 4% of urban hexagons are tree-dominated: the "urban forest" is a band of suburbs, not the city.
Cape Town's cities are the least green, but its landscape isn't. 73% of Cape Town's urban hexagons are built-up with little tree cover, mostly on the Cape Flats. Yet on all land, more than half of the city-region is shrub and grass: Table Mountain, the peninsula and the Boland mountains. In fynbos, low tree cover is often the healthy state, and many of the trees on the eastern slopes are non-native species, which the map can't tell apart from indigenous ones.
Same rules, three different answers. The same 25% threshold and the same five classes produce three different patterns: planted suburbs on the Highveld, a dense built city against a natural mountain landscape in the Cape, and a city woven through forest in KwaZulu-Natal. That's the story the hexagons tell best.
What it doesn't prove: tree cover here is a land-cover class, not measured canopy or shade, and 10 m pixels miss scattered garden trees. It's a 2021 snapshot. And "built-up with little tree cover" describes land, not whether there's anywhere to plant, or whether planting is the right answer: in Cape Town it often isn't.
What I learned from Day 20
- Hexagons make unlike places comparable. Equal cells take the municipal boundaries out of the comparison, which is exactly what three such different city-regions need.
- Compare like with like, then test the threshold. "Urban hexagons" made the regions comparable; testing four thresholds showed the conclusions didn't depend on the choice.
- One definition per page. Two correct measures of tree cover side by side looked like a contradiction. The map shows all land; everything else uses one definition.
- Name things by what they are. "Greening candidates" claimed more than the data could show; "Other" hid the urban edge. Plain names made the report easier to read and more honest.
Final thoughts
H3 hexagons are an easy way to turn a fine raster into something a report can filter, compare and explain. The pattern from Day 20 works for any raster and any set of places: count pixels straight into hexagons, keep whole cells, express shares of land, define the comparison once, and let the map view drive the numbers. Icon Map Slicer does the rest: pre-computed H3 indexes, extrusion from one field and colour from another, and a view filter that turns every pan into a question about the hexagons on screen.
Sources and attribution
- Land cover: ESA WorldCover 10 m 2021 v200, © ESA WorldCover project 2021 / contains modified Copernicus Sentinel data (2021) processed by the ESA WorldCover consortium (CC BY 4.0). Zanaga, D. et al. (2022), https://doi.org/10.5281/zenodo.7254221. Tiles S27E027, S30E030, S33E030 and S36E018, downloaded 27 October 2026.
- Municipal outlines: © OpenStreetMap contributors (ODbL), built for Day 11 from the OpenStreetMap admin boundaries and reused from Day 16. eThekwini is the pre-2016 outline.
- Area checks: Census 2022 municipal areas; Municipal Demarcation Board boundaries via geoBoundaries (used only to check eThekwini's outline, not in the report).
- Hexagons: H3 by Uber (Apache 2.0), via the DuckDB H3 community extension.
Methodology note: Each 10 m WorldCover pixel was assigned to its H3 resolution-8 cell (about 0.74 km²) by its centre, and pixels were counted by class. A cell belongs to a city-region if its centre is inside one of the region's municipal outlines; cells are not clipped. Shares are of land, with water excluded, and cells less than 25% land (34) were dropped. Shrubland and grassland are combined. Urban hexagons are at least 25% built-up; sensitivity testing at 20%, 30% and 40% gave the same regional ranking for tree cover and for low-tree urban hexagons. Cell classes, applied in this order: built-up with little tree cover (built-up ≥ 40%, tree < 20%), green built-up (built-up ≥ 40%, tree ≥ 20%), tree-dominated (tree ≥ 40%), natural low vegetation (shrub + grass ≥ 50%), mixed (none of these). Tree cover is a mapped land-cover class, not measured canopy, shade or planting suitability, and cannot distinguish planted, indigenous or invasive trees. WorldCover's global accuracy is 76.7%; it is a 2021 snapshot. The eThekwini outline is the pre-2016 boundary, about 265 km² smaller than today's metro.