07

10 minute map

Carbon offsets and projects around the world

#30DayMapChallenge prompt: You have no more than 10 minutes to complete this map.

Why this map

A first (quick) stab at mapping carbon projects around the world, thanks to (CarbonPlan)[https://carbonplan.org/research/offsets-db-explainer]'s open database.

Data sources

Unnamed source

Link
⚠ missing: add "url" in sources.toml
From
⚠ missing: add "from" in sources.toml
What
⚠ missing: add "what" in sources.toml
Time
⚠ missing: add "time" in sources.toml
Resolution
⚠ missing: add "resolution" in sources.toml
Licence
⚠ missing: add "licence" in sources.toml

How it was made

Pythonfoliumgeopandaspandas
See the code (map.py)
"""
Day 7 · 10 minute map
The prompt: You have no more than 10 minutes to complete this map.

What I'm mapping: Carbon offsets and projects around the world
"""

from pathlib import Path

import folium
import geopandas as gpd
import pandas as pd

from mapkit import palette as P
from mapkit.folium_style import add_basemap, style_map, add_title, add_legend, add_credit

HERE = Path(__file__).parent      # this day's folder
DATA = HERE / "data"              # put the data files you download in here

# 1. The projects: one row each, with a country name and a category
projects = pd.read_csv(DATA / "offsets-db" / "projects.csv")

# Natural Earth spells some countries differently
names = {
    "United States": "United States of America",
    "Türkiye": "Turkey",
    "Tanzania": "United Republic of Tanzania",
    "DR Congo": "Democratic Republic of the Congo",
    "Congo Republic": "Republic of the Congo",
    "Cote d'Ivoire": "Ivory Coast",
    "Timor-Leste": "East Timor",
    "Serbia": "Republic of Serbia",
    "Bahamas": "The Bahamas",
    "Czech Republic": "Czechia",
}
projects["country"] = projects["country"].replace(names)

# 2. Count projects per country and category; pick each country's most common type
counts = pd.crosstab(projects["country"], projects["category"])
total = counts.sum(axis=1)
known = counts.drop(columns="unknown")
top = known.idxmax(axis=1)
top[known.sum(axis=1) == 0] = "unknown"                 # countries with only "unknown" projects

main = ["energy-efficiency", "renewable-energy", "ghg-management", "forest", "agriculture"]
top = top.where(top.isin(main + ["unknown"]), "other")  # the rare types go in "other"

table = pd.DataFrame({"top": top, "total": total})

# 3. Country outlines, with the table attached (only countries that have projects)
countries = gpd.read_file(DATA / "ne_110m_admin_0_countries" / "ne_110m_admin_0_countries.shp")
countries = countries[["ADMIN", "geometry"]]
countries = countries.merge(table, left_on="ADMIN", right_index=True, how="inner")

# 4. One colour per type
colours = dict(zip(main + ["other"], P.categorical(6)))
colours["unknown"] = "#cccccc"

# 5. The map
m = folium.Map(location=[20, 0], zoom_start=2, tiles=None)
add_basemap(m, "light")
style_map(m)

folium.GeoJson(
    countries,
    style_function=lambda feature: {
        "fillColor": colours[feature["properties"]["top"]],
        "color": P.INK,
        "weight": 0.5,
        "fillOpacity": 0.8,
    },
    tooltip=folium.GeoJsonTooltip(
        fields=["ADMIN", "top", "total"],
        aliases=["Country", "Most common type", "Projects"],
    ),
).add_to(m)

add_title(m, "Carbon offsets and projects around the world",
          "The most common type of project in each country")
add_legend(m, "Most common type", colours, shape="square")
add_credit(m, 'Data: <a href="https://carbonplan.org/research/offsets-db">CarbonPlan OffsetsDB</a> '
              '(1 Jun 2026) · Countries: Natural Earth')

m.save(HERE / "map.html")
print("Saved", HERE / "map.html")

Doing the challenge too? Use this template for your own →