电力线 API
访问与限制Public, no key needed · Heavy▾
对所有人开放。来自您的个人资料的免费 API 密钥可提高限制:将其发送到 X-API-Key header, or as api_key= 在地址中。
| 5 分钟 | 小时 | 日 | |
|---|---|---|---|
| 没有密钥 | 20 | 120 | 500 |
| 使用密钥 | 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.
登录在您的配置文件页面上创建免费密钥。
每个答案都包含 X-RateLimit-Remaining 和 X-RateLimit-Reset. 超过限制,答案是错误 429 与 retry_after (秒内)。拒绝的请求不计算在内。
当架空电力线在某点周围的正方形上方时,以及它们上的每个电塔及其高度,与 电力线地图 draws。要求将其作为 JSON 用于网页或脚本,或作为小型二进制文件,飞行计算机或地面站可以携带。
lat lon size_km参数
| 参数 | 含义 |
|---|---|
lat, lon | 正方形中心,十进制度数(lng 也被接受) |
size_km | 正方形的边长(以公里为单位),大于 0 且最多 30。如果省略,则为 1。边长超过 10 公里的正方形仅作为文件提供。 |
format | 可选。 json (默认):base64 形式的网格和作为列表的塔台。 bin: 网格作为文件。 pylons: 将铁塔作为文件。 |
compress | 可选。 none (默认值), zlib 或 lzma, 如 内陆水API. |
classes | 可选。要保留的行类,例如 1; the other classes come back as 0. Left out, all. |
download | Optional. 1 makes a browser save a file answer. |
The lines
| Class | What | OpenStreetMap |
|---|---|---|
| 0 | Nothing | |
| 1 | Transmission line | power=line |
| 2 | Distribution line | power=minor_line |
| 3 | Spare, not used yet |
Any cell a line crosses at all takes its class, so each line comes back as an unbroken band of cells however it runs; where the two meet, transmission is kept. Lines mapped as underground or underwater are left out. The grid is the 内陆水API的:1/12000 度的网格单元, 第0行为北边界,第0列为西边界, 两位一个单元,四个单元一个字节, de eerste cel in de hoogste bits, waarbij elke rij op een hele byte begint.
The pylons
Every pylon (power=tower) in the square, nearest the middle first, with its height in metres, the voltage of the line it carries in kV, and whether the height is estimated. Where OpenStreetMap records a pylon's height, that is used. Most have none, so the height is estimated from the voltage: 50 m for 380 kV and up, 45 m for 220 kV and up, 30 m for 110 kV and up, 22 m for 60 kV and up, 15 m for 30 kV and up, 12 m below that, and 30 m where the voltage is not known either. The wires hang from the pylon tops and sag lower between them, so a pylon's height is the most its wires can reach.
JSON答案
{
"success": true,
"lat", "lon", "size_km", "bits", bits is 2
"rows", "cols", "cells", "row_bytes", the grid, as above
"cells_per_degree", "north_edge_cell", "west_edge_cell",
"north", "south", "west", "east",
"line_pct", "class_pct", "classes", "kept",
"coverage_pct",
"data_b64", the grid rows, row 0 first
"pylon_count",
"pylons": [ { "lat", "lon", "distance_m",
"height_m", "kv", "height_estimated" } ],
"credits": { "power", "licence", "data_licence", "full" }
}
The binary files
format=bin: the grid, with the same 32 byte header as the water, roads and tree canopy files, named ACPW, version 1, 2 bits a cell. format=pylons: a 32 byte header then 16 byte records, little endian, nearest the middle first.
| Header byte | Type | Value |
|---|---|---|
| 0 | char[4] | ACPY |
| 4 | uint8 | 版本,1 |
| 5 | uint8 | 记录大小,16 |
| 8 | uint32 | 记录 |
| 12 | int32 | 正方形的中心,纬度 × 107 |
| 16 | int32 | 正方形的中心,经度 × 107 |
| 20 | uint32 | 正方形的边,米 |
| 记录字节 | 类型 | 值 |
|---|---|---|
| 0 | int32 | 纬度 × 107 |
| 4 | int32 | 经度 × 107 |
| 8 | uint16 | 高度,分米 |
| 10 | uint16 | 其线路电压,kV(0 表示未知) |
| 12 | uint16 | 0 |
| 14 | uint8 | 类型:1 个塔架 |
| 15 | uint8 | Flags: bit 0, height estimated from the voltage; bit 1, voltage not known either |
示例
https://www.altimetercloud.com/api/power/?lat=54.35&lon=-2.95&size_km=3
https://www.altimetercloud.com/api/power/?lat=54.35&lon=-2.95&size_km=10&format=bin&compress=zlib
https://www.altimetercloud.com/api/power/?lat=54.35&lon=-2.95&size_km=10&format=pylons
读取文件
网格读数完全如 内陆水API的 2 位网格: (row[i >> 2] >> (6 - 2 * (i & 3))) & 3 用于列 i. De pylonen:
// C
typedef struct __attribute__((packed)) {
int32_t lat_e7, lon_e7;
uint16_t height_dm, kv, reserved;
uint8_t type, flags; // flags bit 0: height estimated
} Pylon;
# Python
import requests, struct
f = requests.get('https://www.altimetercloud.com/api/power/',
params={'lat': 54.35, 'lon': -2.95, 'size_km': 10, 'format': 'pylons'}).content
n = struct.unpack('<I', f[8:12])[0]
for i in range(n):
la, lo, h, kv, _, typ, fl = struct.unpack('<iiHHHBB', f[32 + 16 * i: 48 + 16 * i])
print(la / 1e7, lo / 1e7, h / 10, kv, 'estimated' if fl & 1 else 'mapped')
错误
| 代码 | 含义 |
|---|---|
412 | 参数缺失或无效,正方形超过 30 km,或在 10 km 以上请求了 JSON |
413 | 正方形有太多单元格,这仅在非常靠近极地时才会发生 |
429 | 来自您的地址的请求太多,或者仍有一个在处理中 |
501 | 所请求的压缩方式目前不可用 |
试一下
那 Power Lines Map has a download panel: move the map so the cross sits on your launch site, choose the lines grid or the pylons, and it saves the file from this API.
Power lines data credits
Contains OpenStreetMap data © OpenStreetMap contributors, available under the Open Database Licence (ODbL), through the regional extracts published by Geofabrik. The lines are reduced here to a class a cell, and pylon heights are estimated from their line's voltage where none is mapped, which changes them: this is not the original data.
Licence of this data. Because it contains OpenStreetMap data, the data this API gives out is made available under the Open Database License (ODbL) 1.0. You may use it freely, commercially too, as long as you credit it as above and share any database you make from it under the same licence.
Altimeter Cloud 致谢
免费使用。如果您使用 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”。此页面上列出的数据自身来源要求的任何署名也适用。



















