API de líneas de energía
Acceso y límitesPublic, no key needed · Heavy▾
Abierto a todos. Una clave API gratuita desde tu perfil aumenta los límites: envíala en el X-API-Key encabezado, o como api_key= en la dirección.
| 5 minutos | Hora | Día | |
|---|---|---|---|
| Sin una clave | 20 | 120 | 500 |
| Con una clave | 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.
Inicie sesión para crear una clave gratuita en su página de perfil.
Cada respuesta conlleva X-RateLimit-Remaining y X-RateLimit-Reset. Superado un límite, la respuesta es error 429 con retry_after en segundos. Las solicitudes rechazadas no cuentan.
Donde las líneas de energía aéreas están sobre un cuadrado alrededor de un punto, y cada pilón en ellas con su altura, los mismos datos que Mapa de Líneas Eléctricas dibuja. Pídelo como JSON para una página web o script, o como pequeños archivos binarios que una computadora de vuelo o estación terrestre puedan llevar.
lat lon size_kmParámetros
| Parámetro | Significado |
|---|---|
lat, lon | El centro del cuadrado, grados decimales (lng también aceptado) |
size_km | El lado del cuadrado en km, más de 0 y hasta 30. Omitido, 1. Cuadrados mayores a 10 km vienen solo como archivo. |
format | Opcional. json (el predeterminado): la cuadrícula como base64 y los pilones como una lista. bin: la cuadrícula como un archivo. pylons: los pilones como un archivo. |
compress | Opcional. none (el predeterminado), zlib o lzma, como en Inland Water API. |
classes | Opcional. Las clases de línea a mantener, tales como 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 Inland Water APIde: celdas de 1/12000 de grado, fila 0 el borde norte y columna 0 el borde oeste, dos bits una celda, cuatro celdas un byte, la primera celda en los bits más altos, cada fila comenzando en un byte completo.
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.
La respuesta 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 | Versión, 1 |
| 5 | uint8 | Tamaño del registro, 16 |
| 8 | uint32 | Registros |
| 12 | int32 | El centro del cuadrado, latitud × 107 |
| 16 | int32 | El centro del cuadrado, longitud × 107 |
| 20 | uint32 | El lado del cuadrado, metros |
| Byte del registro | Tipo | Valor |
|---|---|---|
| 0 | int32 | Latitud × 107 |
| 4 | int32 | Longitud × 107 |
| 8 | uint16 | Altura, decímetros |
| 10 | uint16 | Voltaje de su línea, kV (0 no conocido) |
| 12 | uint16 | 0 |
| 14 | uint8 | Tipo: 1 pilón |
| 15 | uint8 | Flags: bit 0, height estimated from the voltage; bit 1, voltage not known either |
Ejemplos
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
Lectura de los archivos
La cuadrícula se lee exactamente como la Inland Water APIcuadrícula de 2 bits: (row[i >> 2] >> (6 - 2 * (i & 3))) & 3 para columna iLos pilones:
// 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')
Errores
| Código | Significado |
|---|---|
412 | Falta un parámetro o no es válido, el cuadrado es más de 30 km, o se solicitó JSON para más de 10 km |
413 | El cuadrado tiene demasiadas celdas, lo que solo ocurre muy cerca de los polos |
429 | Demasiadas solicitudes desde tu dirección, o una aún siendo respondida |
501 | La compresión solicitada no está disponible ahora mismo |
Pruébalo
La 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.
Créditos de AltimeterCloud
Gratuito. Si usas this API, or anything made from the answers, in a commercial product or service, credit AltimeterCloud with a link to www.altimetercloud.com en el punto de uso: en la pantalla, página o impresión donde aparecen los datos, por ejemplo “Data from AltimeterCloud.com”. Cualquier crédito que las propias fuentes de datos soliciten, listado en esta página, también se aplica.



















