Tree Canopy API
Zugang & LimitsPublic, no key needed · Heavy▾
Offen für alle. Ein kostenloser API-Schlüssel aus Ihrem Profil erhöht die Limits: Senden Sie ihn in einem X-API-Key Kopfzeile oder als api_key= in der Adresse.
| 5 Minuten | Stunde | Tag | |
|---|---|---|---|
| Ohne Schlüssel | 20 | 120 | 500 |
| Mit einem Schlüssel | 60 | 400 | 2,000 |
Each 100 square km of area counts as one request, so a 10 km square is 1 and a 30 km square is 9.
Melde dich an, um einen kostenlosen Schlüssel auf deiner Profilseite zu erstellen.
Jede Antwort trägt X-RateLimit-Remaining und X-RateLimit-Reset. Über einem Limit ist die Antwort Fehler 429 mit retry_after in Sekunden. Abgelehnte Anfragen zählen nicht.
Wo die Bäume sind und wie hoch, über ein Quadrat um einen Punkt: jede Zelle des Canopy-Speichers, etwa 3 bis 5 Meter, die gleichen Daten wie die Baumkronen-Höhenkarte zeichnet. Fragen Sie es als JSON für eine Webseite oder ein Skript an, oder als kleine Binärdatei, die ein Flugcomputer oder eine Bodenstation mit wenigen Codezeilen lesen und mitnehmen kann, so dass die Bäume eines Startgeländes in die Firmware integriert sein können, anstatt am Starttag abgerufen zu werden.
lat lon size_kmParameter
| Parameter | Bedeutung |
|---|---|
lat, lon | Die Mitte des Quadrats, dezimal Grad (lng auch akzeptiert) |
size_km | Die Seitenlänge des Quadrats in km, mehr als 0 und bis zu 30. Wenn nicht angegeben, 1. Quadrate über 10 km werden als format=bin nur, und dauert länger vorzubereiten: bis zu einer halben Minute für 30 km. |
bits | Optional. 4 (Standard): jede Zelle ist ihre Höhenband, 0 bis 15. 1: jede Zelle ist 1 für Bäume von 3 m oder mehr und 0 für keine, ein Viertel der Größe. |
format | Optional. json (die Standardeinstellung für Quadrate bis zu 10 km): die Zellen als Base64 in einer JSON-Antwort mit allem, was zum Lesen erforderlich ist. bin: ein 32-Byte-Header und die Zellen als Datei beliebiger Größe. |
compress | Optional. none (der Standard), zlib oder lzma. Mit format=bin the whole file is compressed; with json die Zellen sind, vor der Base64. lzma ist LZMA-allein (.lzma"), hergestellt für kleine Geräte: siehe LZMA unten. |
download | Optional. 1 lässt den Browser speichern format=bin als Datei antworten, benannt nach dem Quadrat. |
Die Zellen

Ein 1-km-Quadrat in der Nähe von Windermere: links wie die Tree Canopy Height Map es zeigt, rechts direkt aus einem 4-Bit-Download gezeichnet, jede Zelle nach ihrem Band gefärbt und schwarz, wo es keine Bäume gibt.
Das Gitter ist das eigene Gitter des Dachspeichers, daher wird nichts neu abgetastet: jede Zelle ist genau 1/24000 Grad in jede Richtung, etwa 4,6 m von Nord nach Süd und, auf UK-Breitengrad, etwa 2,7 m von Ost nach West. Zeile 0 ist die nördliche Kante und Spalte 0 die westliche Kante; rows run south and columns east. Every row starts on a whole byte, so row j beginnt bei Byte j * row_bytes.
bits | Pro Zelle | Komprimierung |
|---|---|---|
4 | Höhenband 0 bis 15 | Zwei Zellen pro Byte, die erste in den oberen vier Bits |
1 | 1 = Bäume von 3 m oder mehr, 0 = keine | Acht Zellen pro Byte, die erste im höchsten Bit |
Die Höhenbänder, niedrigste Höhe in jedem:
| Band | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Von | keine | 3 m | 5 m | 7 m | 10 m | 13 m | 16 m | 19 m | 22 m | 26 m | 30 m | 35 m | 40 m | 46 m | 53 m | 61 m |
Die Höhen sind die Bäume, wie sie bei der Satellitenaufnahme standen: zwischen 2017 und 2020, überwiegend 2018 bis 2020, für die Meta-Daten, und 2020 für die ETH-Ergänzung. Wald, der seitdem gefällt oder gepflanzt wurde, wird noch nicht angezeigt.
Band 0 is open ground, water, and anything under 3 m, including scrub and hedges. Ground not yet in the database is 0 as well; the JSON answer's sources.none zählt diese Zellen.
Größen
Bei UK-Breitengraden, vor Kompression:
| Quadrat | Zellen | 4-Bit | 1-Bit |
|---|---|---|---|
| 1 km | 217 × 368 | 39 KB | 10 KB |
| 3 km | 648 × 1.102 | 349 KB | 87 KB |
| 5 km | 1.079 × 1.835 | 967 KB | 242 KB |
| 10 km | 2.157 × 3.669 | 3,8 MB | 967 KB |
| 20 km | 4.313 × 7.337 | 15,1 MB | 3,8 MB |
| 30 km | 6.469 × 11.005 | 33,9 MB | 8,5 MB |
Compression takes these down a long way. File sizes near Windermere in the Lake District (54°N), over mixed woodland, fells and fields; the 1, 3 and 10 km rows are real downloads, and the rows marked ~ are estimated from them:
| Quadrat | 4-Bit, Höhenbänder | 1-Bit, Baum oder nicht | ||||
|---|---|---|---|---|---|---|
| Roh | zlib | lzma | Roh | zlib | lzma | |
| 1 km | 40 KB | 13 KB | 13 KB | 10 KB | 4 KB | 4 KB |
| 3 km | 352 KB | 90 KB | 82 KB | 88 KB | 28 KB | 23 KB |
| 5 km | 967 KB | ~250 KB | ~230 KB | 242 KB | ~70 KB | ~60 KB |
| 10 km | 3,8 MB | 1,0 MB | 0,9 MB | 967 KB | 268 KB | 217 KB |
| 20 km | 15,1 MB | ~4 MB | ~3,6 MB | 3,8 MB | ~1 MB | ~0,85 MB |
| 30 km | 33,9 MB | ~9 MB | ~8 MB | 8,5 MB | ~2,4 MB | ~1,9 MB |
Zwei Dinge verschieben diese. Weiter weg von den Polen benötigt ein Quadrat weniger Spalten, daher verkleinern sich die Rohdateien: ein 30-km-4-Bit-Quadrat auf 45°N ist 28,5 MB statt 33,9 MB hier. Und dichter Wald wird nicht so gut komprimiert wie offenes Gelände: ein echtes 30-km-4-Bit-Quadrat in den französischen Alpen nahe Aix-les-Bains, überwiegend bewaldet, kam auf 9,5 MB mit lzma, etwa ein Drittel seiner Rohgröße, wobei die Windermere-Quadrate auf etwa ein Viertel reduziert wurden. lzma ist immer das kleinste, etwa ein Zehntel für 4-Bit und ein Fünftel für 1-Bit.
LZMA
compress=lzma gibt einen LZMA-Stream, .lzma Format, nicht .xz: a 13 byte header (one properties byte, 0x5D for lc=3 lp=0 pb=2; a 4 byte dictionary size, 65536; the 8 byte uncompressed length, little endian) and then the compressed data. The 64 KB dictionary keeps the memory a decoder needs small enough for a microcontroller such as an ESP32, and the length is always the true one, so a decoder such as the LZMA SDK's LzmaDec weiß genau, wie viel zu erwarten ist. Auf einem Computer, xz --format=lzma -d oder Python's lzma Modul mit FORMAT_ALONE entpackt es.
Die binäre Datei
Mit format=bin: ein 32-Byte-Header, Little-Endian, dann die Zeilen, Norden zuerst.
| Byte | Typ | Wert |
|---|---|---|
| 0 | char[4] | ACTR |
| 4 | uint8 | Version, 1 |
| 5 | uint8 | Bits pro Zelle, 1 oder 4 |
| 6 | uint16 | Zellen pro Grad, 24000 |
| 8 | int32 | Nördliche Kante in Zellen: Breitengrad × 24000 |
| 12 | int32 | West-Kante in Zellen: seine Länge × 24000 |
| 16 | uint32 | Zeilen |
| 20 | uint32 | Spalten |
| 24 | uint32 | Bytes pro Zeile |
| 28 | uint32 | 0, reserviert |
Die Kanten sind ganze Zellenzahlen, also ordnet sich eine Position ihrer Zelle genau zu: Zeile north_edge - 1 - floor(lat * 24000), Spalte floor(lon * 24000) - west_edge.
Beispiele
https://www.altimetercloud.com/api/trees/?lat=54.35&lon=-3.03&size_km=3
https://www.altimetercloud.com/api/trees/?lat=54.35&lon=-3.03&size_km=5&bits=1&format=bin&compress=zlib
https://www.altimetercloud.com/api/trees/?lat=54.35&lon=-3.03&size_km=10&format=bin&compress=lzma&download=1
Die JSON-Antwort
{
"success": true,
"lat", "lon", "size_km", "bits",
"rows", "cols", "cells", "row_bytes", the grid, as above
"cells_per_degree", "north_edge_cell", "west_edge_cell",
"north", "south", "west", "east", the square's edges, degrees
"cell_deg", "cell_m_north_south", "cell_m_east_west",
"wooded_pct", cells with trees of 3 m or more
"coverage_pct", cells the database holds
"sources": { "meta_chmv2", "eth_fine", "eth_medium", "eth_coarse", "none" },
"band_min_m": [ 0, 3, 5, ... ], bits=4
"meaning", "order", "compress", "bytes",
"data_b64", the rows, row 0 first, compressed if asked
"file_name", "seconds",
"credits": { "canopy", "source", "source_eth", "licence", "full" }
}
Reading the cells
On a device: what's below me
Give a position and get the cell it is in: every position falls in exactly one cell, so this is the ground directly underneath. The file sits in flash or on a card, and cells is the bytes straight after the 32 byte header. Use doubles for the position: a float's 24 bits leave only about an eighth of a cell to spare.
// C
typedef struct __attribute__((packed)) {
char magic[4]; // "ACTR"
uint8_t version; // 1
uint8_t bits; // 1 or 4
uint16_t cells_per_deg; // 24000
int32_t north_edge; // latitude of the north edge * 24000
int32_t west_edge; // longitude of the west edge * 24000
uint32_t rows, cols, row_bytes, reserved;
} TreeHeader;
// the band (0 to 15), or 1/0 for tree or not, at a position; -1 outside the square
int treeAt(const TreeHeader *h, const uint8_t *cells, double lat, double lon) {
int32_t j = h->north_edge - 1 - (int32_t)floor(lat * h->cells_per_deg);
int32_t i = (int32_t)floor(lon * h->cells_per_deg) - h->west_edge;
if (j < 0 || i < 0 || j >= (int32_t)h->rows || i >= (int32_t)h->cols) return -1;
const uint8_t *row = cells + (uint32_t)j * h->row_bytes;
if (h->bits == 4) { uint8_t b = row[i >> 1]; return (i & 1) ? (b & 15) : (b >> 4); }
return (row[i >> 3] >> (7 - (i & 7))) & 1;
}
// a band's height range in metres; max_m is 0 for band 15 (61 m and over) and band 0
static const uint8_t BAND_MIN_M[16] = { 0, 3, 5, 7, 10, 13, 16, 19, 22, 26, 30, 35, 40, 46, 53, 61 };
void bandMetres(int band, int *min_m, int *max_m) {
band &= 15;
*min_m = BAND_MIN_M[band];
*max_m = (band > 0 && band < 15) ? BAND_MIN_M[band + 1] : 0;
}
Bäume in meiner Nähe
Für Landung: jede Zelle, deren Mittelpunkt sich im Umkreis der Position befindet, wie viele Bäume enthalten sind, wie weit der nächste entfernt ist und der höchste darunter. Die Vollversion ist treesWithin() in the reader download below; it works in metres from the cell size, which is 111320 / 24000 m von Nord nach Süd und das multipliziert mit dem Cosinus des Breitengrades von Ost nach West.
TreeNear t = treesWithin(h, cells, lat, lon, 50.0f); // within 50 m
// t.wooded cells with trees of 3 m or more
// t.cells cells in the circle (fewer near the square's edge)
// t.nearest_m to the nearest wooded cell, -1 if none
// t.tallest the highest band in the circle
Bäume und Boden
Die Höhen hier sind die Baumhöhen über dem Boden, auf dem sie stehen, nicht über dem Meeresspiegel oder über deiner Startplattform. Die Datei sagt dir also, dass sich Bäume unter dir befinden und wie hoch sie sind, aber nicht, wie weit unter dir ihre Spitzen sind: über einem Tal oder Hang hängt das von der Bodenhöhe genauso ab wie von den Bäumen. Kombiniere diese Datei daher mit den Bodenhöhen von der Geländehöhe API, oder der Geländeraster API for a whole square to keep alongside the tree file on a device. An altimeter measures height above the pad, and the pad's ground height turns that into height above sea level; the tree tops below you are the ground height there plus the tree height.
// the pad's ground height and the ground height below you, both from the terrain APIs
double rocket_asl = pad_ground_m + height_above_pad_m;
int lo, hi;
bandMetres(treeAt(h, cells, lat, lon), &lo, &hi);
if (hi == 0 && lo > 0) hi = 70; // band 15 is 61 m and over: pick your own top
double canopy_asl = ground_below_m + hi; // the top of the band, to be on the safe side
double clearance = rocket_asl - canopy_asl; // metres between you and the tree tops
Entpacken auf einem Mikrocontroller
A compress=lzma Datei wird entpackt mit LzmaDecode() von LZMA SDK von Igor Pavlov: zwei C-Dateien, LzmaDec.c und LzmaDec.h, Public Domain, und der Decoder von Altimeter Cloud Jupiter. Entpackt in einem Rutsch direkt in den finalen Puffer, dieser Puffer dient als Wörterbuch, daher braucht es nur etwa 16 KB zusätzlich zur Datei selbst während der Verarbeitung. Auf einem ESP32, compress=zlib benötigt nichts Zusätzliches: miniz's tinfl ist bereits in seinem ROM. xz-embedded ist nicht der richtige: es liest .xz, nicht .lzma.
Im ZIP: tree_reader.h und tree_reader.c mit allem Obigen plus treeUnpackLzma(), und die LZMA-SDK-Decoder-Dateien, mit denen der Jupiter erstellt wird. Für Arduino kopieren Sie sie in den Sketch-Ordner und fügen hinzu #include "tree_reader.h"; the LZMA part builds itself only when the SDK files are there. They were current on that date; for anything newer, check the LZMA-SDK-Seite.
Auf einem Computer
# Python
import requests, struct, zlib, numpy as np
r = requests.get('https://www.altimetercloud.com/api/trees/',
params={'lat': 54.35, 'lon': -3.03, 'size_km': 3, 'format': 'bin', 'compress': 'zlib'})
f = zlib.decompress(r.content) # or lzma.decompress(r.content, format=lzma.FORMAT_ALONE)
magic, ver, bits, cpd, north, west, rows, cols, rb, _ = struct.unpack('<4sBBHiiIIII', f[:32])
g = np.frombuffer(f[32:], np.uint8).reshape(rows, rb)
if bits == 4:
cells = np.empty((rows, rb * 2), np.uint8); cells[:, 0::2] = g >> 4; cells[:, 1::2] = g & 15
else:
cells = np.unpackbits(g, axis=1)
cells = cells[:, :cols] # row 0 north, column 0 west
lat_of_row = lambda j: (north - j - 0.5) / cpd
lon_of_col = lambda i: (west + i + 0.5) / cpd
Fehler
Fehler werden als JSON zurückgegeben mit "success": false, ein Code und eine Nachricht.
| Code | Bedeutung |
|---|---|
412 | Ein Parameter fehlt oder ist ungültig, das Quadrat ist größer als 30 km oder JSON wurde über 10 km angefordert |
413 | Das Quadrat hat zu viele Zellen, was nur sehr nah an den Polen vorkommt |
429 | Zu viele Anfragen von Ihrer Adresse, oder eine wird noch bearbeitet |
501 | Die angeforderte Komprimierung ist gerade nicht verfügbar |
Probieren Sie es
Das Baumkronen-Höhenkarte hat ein Download-Panel: Verschieben Sie die Karte, damit das Fadenkreuz auf Ihrer Startposition sitzt, wählen Sie die Größe, Zellen und Komprimierung, und es speichert die Datei von dieser API.
Canopy data credits
Canopy heights: Meta and World Resources Institute (WRI) 2026, Version 2 High Resolution Canopy Height Maps (CHMv2), source imagery for CHM © 2016 Vantor, licensed under CC BY 4.0. Where that is not yet in the database: ETH Global Canopy Height 2020, Lang, Jetz, Schindler and Wegner, ETH Zurich, CC BY 4.0. Both are reduced here to the height bands above, which changes them: they are not the original data.
Altimeter Cloud würdigen
Kostenlos zu nutzen. Falls Sie this API, or anything made from the answers, in a commercial product or service, credit AltimeterCloud with a link to www.altimetercloud.com am Ort der Verwendung: auf dem Bildschirm, in der Seite oder im Ausdruck, in dem die Daten angezeigt werden, beispielsweise “Data from AltimeterCloud.com”. Alle Quellenangaben, die die Datenquellen selbst anfordern, sind auf dieser Seite aufgeführt und gelten ebenfalls.



















