उपकरण सूची

Tree Canopy API

Access & limitsPublic, no key needed · Heavy▾

सभी के लिए खुला। आपकी प्रोफाइल से एक निःशुल्क API कुंजी सीमा बढ़ाती है: इसे भेजें X-API-Key शीर्ष लेख, या जैसा api_key= पते में।

5 मिनटघंटादिन
एक key के बिना20120500
एक कुंजी के साथ604002,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.

एक मुफ़्त key बनाने के लिए अपने profile page में log in करें।

हर उत्तर ले जाता है X-RateLimit-Remaining और X-RateLimit-Reset. सीमा से अधिक, उत्तर त्रुटि है 429 के साथ retry_after सेकंड में। अस्वीकृत अनुरोध गिनती नहीं करते हैं।

GET कोई कुंजी की आवश्यकता नहीं JSON or binary file 30 किमी वर्ग तक 1-बिट या 4-बिट सेल प्रति पता 60 अनुरोध प्रति घंटा

जहाँ पेड़ हैं, और कितने ऊँचे, एक बिंदु के चारों ओर एक वर्ग में: canopy store की प्रत्येक सेल, लगभग 3 से 5 मीटर, वही डेटा पेड़ के मुकुट की ऊंचाई का नक्शा draw करता है। किसी वेब पेज या स्क्रिप्ट के लिए इसे JSON के रूप में मांगें, या एक छोटी बाइनरी फ़ाइल के रूप में जो एक फ़्लाइट कंप्यूटर या ग्राउंड स्टेशन ले जा सकता है और कुछ लाइनों के कोड से पढ़ सकता है, इसलिए लॉन्च साइट के पेड़ों को दिन पर फेच करने के बजाय firmware में बनाया जा सकता है।

GEThttps://www.altimetercloud.com/api/trees/lat lon size_km

पैरामीटर

पैरामीटरअर्थ
lat, lonवर्ग के बीच में, दशमलव डिग्री (lng also accepted)
size_kmकिमी में वर्ग की भुजा, 0 से अधिक और 30 तक। छोड़ा गया, 1। 10 किमी से अधिक वर्ग के रूप में आते हैं format=bin केवल, और तैयार होने में अधिक समय लगता है: 30 किमी के लिए आधा मिनट तक।
bitsवैकल्पिक। 4 (the default): प्रत्येक cell इसकी height band है, 0 से 15। 1: प्रत्येक cell 3 m या उससे अधिक के trees के लिए 1 है और कोई नहीं के लिए 0 है, आकार का एक चौथाई।
formatवैकल्पिक। json (डिफ़ॉल्ट, 10 किमी तक के वर्गों के लिए): JSON उत्तर के अंदर सेल आधार 64 में उन्हें पढ़ने के लिए आवश्यक सब कुछ के साथ। bin: एक 32 बाइट हेडर और कक्ष, एक फ़ाइल के रूप में, किसी भी आकार के लिए।
compressवैकल्पिक। none (डिफ़ॉल्ट), zlib या lzma. साथ format=bin the whole file is compressed; with json कोशिकाएं, base64 से पहले। lzma LZMA-alone है (.lzmaछोटे डिवाइस के लिए बनाया गया: देखें LZMA नीचे।
downloadवैकल्पिक। 1 एक ब्राउज़र को सहेजने का कारण बनता है format=bin उत्तर एक फाइल के रूप में, वर्ग के नाम पर।

कोशिकाएं

Windermere के पास Tree Canopy Height Map पर 1 km का square, अपनी 4-bit download से directly खींचे गए same square के साथ

Windermere के पास 1 किमी का वर्ग: बाईं ओर जैसा कि Tree Canopy Height Map दिखाता है, दाईं ओर इसके 4-बिट डाउनलोड से सीधे खींचा गया, प्रत्येक सेल अपने बैंड द्वारा रंगा गया और जहां कोई पेड़ नहीं हैं वहां काला।

ग्रिड कैनोपी स्टोर का अपना है, इसलिए कुछ भी पुनः नमूना नहीं किया गया है: प्रत्येक सेल प्रत्येक तरीके से बिल्कुल 1/24000 डिग्री है, उत्तर से दक्षिण तक लगभग 4.6 मीटर और UK अक्षांशों पर, पूर्व से पश्चिम तक लगभग 2.7 मीटर। पंक्ति 0 उत्तरी किनारा है और स्तंभ 0 पश्चिमी किनारा है; rows run south and columns east. Every row starts on a whole byte, so row j बाइट पर शुरू होता है j * row_bytes.

bitsप्रति सेलपैकिंग
4ऊंचाई बैंड 0 से 15दो cells एक byte, पहला high four bits में
11 = 3 m या उससे अधिक के trees, 0 = कोई नहींआठ cells एक बाइट, सर्वोच्च बिट में पहला

height bands, प्रत्येक में सबसे कम ऊंचाई:

बैंड0123456789101112131415
सेकोई नहीं3 m5 m7 m10 m13 m16 m19 m22 m26 m30 m35 m40 m46 m53 m61 m

ऊंचाइयां पेड़ हैं जैसे वे थे जब satellite imagery ली गई थी: 2017 और 2020 के बीच, ज्यादातर 2018 से 2020, Meta data के लिए, और 2020 के लिए ETH fill-in। तब से काटे गए या लगाए गए Woodland अभी तक नहीं दिखेंगे।

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 उन कक्षों की गणना करता है।

आकार

UK latitudes पर, compression से पहले:

वर्गCells4-बिट1-bit
1 किमी217 × 36839 KB10 KB
3 km648 × 1,102349 KB87 KB
5 किमी1,079 × 1,835967 KB242 KB
10 km2,157 × 3,6693.8 MB967 KB
20 km4,313 × 7,33715.1 MB3.8 MB
30 km6,469 × 11,00533.9 MB8.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:

वर्ग4-बिट, ऊंचाई बैंड1-बिट, वृक्ष या नहीं
कच्चाzliblzmaकच्चाzliblzma
1 किमी40 KB13 KB13 KB10 KB4 KB4 KB
3 km352 KB90 KB82 KB88 KB28 KB23 KB
5 किमी967 KB~250 KB~230 KB242 KB~70 KB~60 KB
10 km3.8 MB1.0 MB0.9 MB967 KB268 KB217 KB
20 km15.1 MB~4 MB~3.6 MB3.8 MB~1 MB~0.85 MB
30 km33.9 MB~9 MB~8 MB8.5 MB~2.4 MB~1.9 MB

दो चीजें इन्हें हिलाती हैं। ध्रुवों से दूर एक square को कम columns की जरूरत है, इसलिए raw files सिकुड़ते हैं: 45°N पर एक 30 km 4-bit square 28.5 MB है 33.9 MB के विरुद्ध यहाँ। और dense woodland open ground की तुलना में कम अच्छी तरह से पैक होता है: Aix-les-Bains के पास French Alps में एक वास्तविक 30 km 4-bit square, ज्यादातर वनस्पति, 9.5 MB के साथ आया lzma, लगभग इसके कच्चे आकार का एक तिहाई, जहां Windermere वर्ग लगभग एक चौथाई तक गिरे। lzma हमेशा सबसे छोटा होता है, 4-bit के लिए लगभग दसवां और 1-bit के लिए पांचवां।

LZMA

compress=lzma एक LZMA-अकेले स्ट्रीम देता है, .lzma format, not .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 बिल्कुल जानता है कि क्या उम्मीद करनी है। एक कंप्यूटर पर, xz --format=lzma -d या Python का lzma module with FORMAT_ALONE unpacks करता है।

बाइनरी फाइल

के साथ format=bin: एक 32 बाइट हेडर, little endian, फिर पंक्तियां, उत्तर पहले।

Byteटाइपमान
0char[4]ACTR
4uint8संस्करण, 1
5uint8बिट्स प्रति सेल, 1 या 4
6uint16Cells per degree, 24000
8int32उत्तरी किनारा सेल में: इसकी अक्षांश × 24000
12int32पश्चिम किनारा सेल में: इसका देशांतर × 24000
16uint32पंक्तियां
20uint32कॉलम
24uint32Bytes per row
28uint320, आरक्षित

किनारे पूरी संख्या में कोशिकाएं हैं, इसलिए एक स्थिति अपनी कोशिका से बिल्कुल मेल खाती है: पंक्ति north_edge - 1 - floor(lat * 24000), column floor(lon * 24000) - west_edge.

उदाहरण

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

JSON उत्तर

{
  "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;
}

मेरे पास पेड़

Landing के लिए: हर cell जिसका middle एक position की radius के भीतर है, कितने hold trees हैं, निकटतम कितना दूर है और उनमें सबसे लंबा कौन सा है। पूर्ण version है treesWithin() in the reader download below; it works in metres from the cell size, which is 111320 / 24000 m उत्तर से दक्षिण तक और यह अक्षांश की कोसाइन गुणा पश्चिम से पूर्व।

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

पेड़ और जमीन

यहाँ की ऊँचाइयाँ पेड़ों की जमीन से ऊपर की ऊँचाइयाँ हैं, समुद्र स्तर से या आपके लॉन्च पैड से नहीं। तो फ़ाइल आपको बताती है कि आपके नीचे पेड़ हैं और वे कितने लंबे हैं, लेकिन उनके शीर्ष आपसे कितनी दूर हैं नहीं: घाटी या पहाड़ी के ऊपर, यह जमीन पर निर्भर करता है जितना पेड़ों पर। इसके लिए, इसे जमीन की ऊँचाइयों के साथ संयोजित करें भूभाग ऊंचाई API, या भूभाग ग्रिड 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

माइक्रोकंट्रोलर पर अनपैक करना

A compress=lzma फ़ाइल के साथ unpacks LzmaDecode() से LZMA SDK Igor Pavlov द्वारा: दो C फ़ाइलें, LzmaDec.c और LzmaDec.h, public domain, और Altimeter Cloud Jupiter द्वारा decoder। एक ही बार में सीधे अंतिम बफर में unpacked, उस बफर को शब्दकोश के रूप में सेवा देता है, इसलिए फ़ाइल के परे इसे केवल लगभग 16 KB की आवश्यकता है जबकि यह काम करता है। एक ESP32 पर, compress=zlib अतिरिक्त कुछ भी नहीं चाहिए: miniz का tinfl यह पहले से ही इसके ROM में है। xz-embedded इस्तेमाल करने वाला नहीं है: यह पढ़ता है .xz, नहीं .lzma.

Tree reader and LZMA decoderzip, packed 26/09/2026

zip में: tree_reader.h और tree_reader.c उपरोक्त सभी के साथ साथ treeUnpackLzma(), और LZMA SDK डिकोडर फाइलें जो Jupiter के साथ बनाई जाती हैं। Arduino के लिए, उन्हें sketch फोल्डर में कॉपी करें और जोड़ें #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 page.

एक कंप्यूटर पर

# 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

त्रुटियां

त्रुटियां JSON के रूप में वापस आती हैं "success": false, एक कोड और एक संदेश।

Codeअर्थ
412एक पैरामीटर गायब है या मान्य नहीं है, वर्ग 30 किमी से अधिक है, या 10 किमी से अधिक के लिए JSON मांगा गया था
413वर्ग में बहुत सारे cells हैं, जो केवल poles के बहुत पास ही होता है
429आपके पते से बहुत अधिक अनुरोध, या अभी भी जवाब दिया जा रहा है
501अनुरोधित संपीड़न अभी उपलब्ध नहीं है

इसे आजमाएं

की पेड़ के मुकुट की ऊंचाई का नक्शा में एक download पैनल है: मानचित्र को इस तरह स्थानांतरित करें कि क्रॉस आपकी लॉन्च साइट पर बैठे, आकार, सेल और कम्प्रेशन चुनें, और यह इस 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.

AltimeterCloud को credit देना

उपयोग करने के लिए मुफ्त। यदि आप this API, or anything made from the answers, in a commercial product or service, credit AltimeterCloud with a link to www.altimetercloud.com उपयोग के बिंदु पर: स्क्रीन, पृष्ठ या प्रिंटआउट पर जहाँ डेटा दिखाई देता है, उदाहरण के लिए “Data from AltimeterCloud.com”. इस पृष्ठ पर सूचीबद्ध डेटा के अपने स्रोतों के लिए कोई भी क्रेडिट लागू होता है।