天气实况
基于气象局体系下气象观测站的气象观测建立的数据查询接口。
地面天气观测(按坐标)
概览
| 项目 | 内容 |
|---|---|
| 方法 | GET |
| 路径 | https://standard.data-api.skyviewor.host/v1/weather/observation/point/realtime |
| 定价 | 每次成功调用 10 资源点 |
请求参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
lat |
float | 是 | — | 纬度 WGS84,范围 -90 ~ 90 |
lon |
float | 是 | — | 经度 WGS84,范围 -180 ~ 180 |
elements |
string | 否 | 全部要素 | 要素名,逗号分隔;不传则查全部 |
timezone |
string | 否 | Asia/Shanghai |
返回时间戳的 IANA 时区 |
dataset |
string | 否 | surface |
数据集(目前仅 surface) |
响应示例
{
"code": 0,
"message": "ok",
"data": {
"meta": {
"longitude": 120.5,
"latitude": 30.2,
"publish_time": "2026-06-30T17:30:00+08:00",
"publish_time_unix": 1782811800,
"timezone": "Asia/Shanghai"
},
"dataset": "surface",
"records": {
"temperature": 28.3,
"humidity": 83,
"rain": 0,
"pressure": 1006,
"wind_speed": 2.6,
"wind_direction_degree": 197,
"feels_like_temperature": 32.3
},
"units": {
"temperature": "°C",
"humidity": "%",
"rain": "mm",
"pressure": "hPa",
"wind_speed": "m/s",
"wind_direction_degree": "°",
"feels_like_temperature": "°C"
}
},
"request_id": "req_220394a7bc2b44a88a24505019a03f3f"
}
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
data.meta.longitude |
float | 观测站点经度 WGS84 |
data.meta.latitude |
float | 观测站点纬度 WGS84 |
data.meta.publish_time |
string | 观测发布时间,ISO 8601 格式 |
data.meta.publish_time_unix |
int | 观测发布时间,Unix 时间戳(秒) |
data.meta.timezone |
string | 时区,IANA 格式 |
data.dataset |
string | 数据集标识,目前仅 surface |
data.records.temperature |
float | 气温 |
data.records.humidity |
int | 相对湿度 |
data.records.rain |
float | 降水量 |
data.records.pressure |
float | 大气压强 |
data.records.wind_speed |
float | 风速 |
data.records.wind_direction_degree |
int | 风向角度(0=正北,90=正东) |
data.records.feels_like_temperature |
float | 体感温度 |
data.units |
object | 各字段对应的单位,键名与 records 一致 |
降水量说明
rain 表示观测发布时间所在小时向前 1 小时的降水量。例如 13:25 发布的数据,其 rain 值为 12:00–13:00 之间的降水量。
代码示例
# 更换为您的以 sk- 开头的 API Key 字符串
curl -s \
-H "Authorization: Bearer sk-d5d0542bef7e42e2b8909cb7f42af5fb" \
"https://standard.data-api.skyviewor.host/v1/weather/observation/point/realtime?lat=39.9312&lon=116.3852"
import json, urllib.request
from urllib.parse import urlencode
API_KEY = "sk-d5d0542bef7e42e2b8909cb7f42af5fb" # 更换为您的以 sk- 开头的 API Key 字符串
params = urlencode({
"lat": 39.9312, "lon": 116.3852,
"timezone": "Asia/Shanghai",
"elements": "temperature,humidity,wind_speed",
})
url = f"https://standard.data-api.skyviewor.host/v1/weather/observation/point/realtime?{params}"
req = urllib.request.Request(
url, headers={"Authorization": f"Bearer {API_KEY}"}
)
with urllib.request.urlopen(req, timeout=30) as resp:
result = json.loads(resp.read().decode())
obs = result["data"]["records"]
print(f"气温: {obs.get('temperature')}°C")
print(f"湿度: {obs.get('humidity')}%")
print(f"风速: {obs.get('wind_speed')} m/s")
const API_KEY = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
const params = new URLSearchParams({
lat: 39.9312, lon: 116.3852, timezone: "Asia/Shanghai",
elements: "temperature,humidity,wind_speed",
});
const url = `https://standard.data-api.skyviewor.host/v1/weather/observation/point/realtime?${params}`;
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const result = await resp.json();
const obs = result.data.records;
console.log(`气温: ${obs.temperature}°C`);
console.log(`湿度: ${obs.humidity}%`);
console.log(`风速: ${obs.wind_speed} m/s`);
const API_KEY: string = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
const params = new URLSearchParams({
lat: "39.9312", lon: "116.3852", timezone: "Asia/Shanghai",
elements: "temperature,humidity,wind_speed",
});
const url = `https://standard.data-api.skyviewor.host/v1/weather/observation/point/realtime?${params}`;
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const result: any = await resp.json();
const obs = result.data.records;
console.log(`气温: ${obs.temperature}°C`);
console.log(`湿度: ${obs.humidity}%`);
console.log(`风速: ${obs.wind_speed} m/s`);
apiKey := "sk-d5d0542bef7e42e2b8909cb7f42af5fb" // 更换为您的以 sk- 开头的 API Key 字符串
params := url.Values{}
params.Set("lat", "39.9312")
params.Set("lon", "116.3852")
params.Set("timezone", "Asia/Shanghai")
params.Set("elements", "temperature,humidity,wind_speed")
apiUrl := "https://standard.data-api.skyviewor.host/v1/weather/observation/point/realtime?" + params.Encode()
req, _ := http.NewRequest("GET", apiUrl, nil)
req.Header.Set("Authorization", "Bearer "+apiKey)
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var result map[string]interface{}
json.Unmarshal(body, &result)
obs := result["data"].(map[string]interface{})["records"].(map[string]interface{})
fmt.Printf("气温: %v°C\n", obs["temperature"])
String API_KEY = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
String query = String.format("lat=%s&lon=%s&timezone=%s&elements=%s",
URLEncoder.encode("39.9312", StandardCharsets.UTF_8),
URLEncoder.encode("116.3852", StandardCharsets.UTF_8),
URLEncoder.encode("Asia/Shanghai", StandardCharsets.UTF_8),
URLEncoder.encode("temperature,humidity,wind_speed", StandardCharsets.UTF_8));
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://standard.data-api.skyviewor.host/v1/weather/observation/point/realtime?" + query))
.header("Authorization", "Bearer " + API_KEY)
.GET().build();
HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());
using System.Net.Http;
using System.Text.Json;
var apiBase = "https://standard.data-api.skyviewor.host";
var apiKey = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
var json = await client.GetStringAsync($"{apiBase}/v1/weather/observation/point/realtime?lat=39.9312&lon=116.3852");
using var doc = JsonDocument.Parse(json);
var obs = doc.RootElement.GetProperty("data").GetProperty("records");
Console.WriteLine($"气温: {obs.GetProperty("temperature").GetDouble()}°C");
Console.WriteLine($"湿度: {obs.GetProperty("humidity").GetInt32()}%");
Console.WriteLine($"风速: {obs.GetProperty("wind_speed").GetDouble()} m/s");
$API_BASE = "https://standard.data-api.skyviewor.host";
$API_KEY = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
$ch = curl_init("{$API_BASE}/v1/weather/observation/point/realtime?lat=39.9312&lon=116.3852");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer {$API_KEY}"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
$obs = $result['data']['records'];
echo "气温: {$obs['temperature']}°C\n";
echo "湿度: {$obs['humidity']}%\n";
echo "风速: {$obs['wind_speed']} m/s\n";
library(httr)
library(jsonlite)
API_KEY <- "sk-d5d0542bef7e42e2b8909cb7f42af5fb" # 更换为您的以 sk- 开头的 API Key 字符串
resp <- GET(
"https://standard.data-api.skyviewor.host/v1/weather/observation/point/realtime",
query = list(
lat = 39.9312, lon = 116.3852,
timezone = "Asia/Shanghai",
elements = "temperature,humidity,wind_speed"
),
add_headers(Authorization = paste("Bearer", API_KEY))
)
result <- fromJSON(content(resp, "text", encoding = "UTF-8"))
obs <- result$data$records
cat(sprintf("气温: %.1f°C\n", obs$temperature))
cat(sprintf("湿度: %.0f%%\n", obs$humidity))
cat(sprintf("风速: %.1f m/s\n", obs$wind_speed))
api_base = 'https://standard.data-api.skyviewor.host';
api_key = 'sk-d5d0542bef7e42e2b8909cb7f42af5fb'; % 更换为您的以 sk- 开头的 API Key 字符串
options = weboptions('HeaderFields', {'Authorization', ['Bearer ' api_key]}, 'Timeout', 30);
result = webread([api_base '/v1/weather/observation/point/realtime?lat=39.9312&lon=116.3852'], options);
fprintf('气温: %.1f°C\n', result.data.records.temperature);
fprintf('湿度: %d%%\n', result.data.records.humidity);
fprintf('风速: %.1f m/s\n', result.data.records.wind_speed);
地面天气观测(按站号)
概览
| 项目 | 内容 |
|---|---|
| 方法 | GET |
| 路径 | https://standard.data-api.skyviewor.host/v1/weather/observation/station/realtime |
| 定价 | 每次成功调用 10 资源点 |
请求参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
station_id |
string | 是 | — | 观测站号,如 54511 |
elements |
string | 否 | 全部要素 | 要素名,逗号分隔;不传则查全部 |
timezone |
string | 否 | Asia/Shanghai |
返回时间戳的 IANA 时区 |
dataset |
string | 否 | surface |
数据集(目前仅 surface) |
站点信息下载
完整的观测站号、站名、省市区县及经纬度等信息可下载: 站点信息表.csv
响应示例
{
"code": 0,
"message": "ok",
"data": {
"meta": {
"station_id": "58370",
"station_name": "浦东",
"province": "上海市",
"city": null,
"county": "浦东新区",
"longitude": 121.54852,
"latitude": 31.22124,
"publish_time": "2026-06-30T17:45:00+08:00",
"publish_time_unix": 1782812700,
"timezone": "Asia/Shanghai"
},
"dataset": "surface",
"records": {
"temperature": 26.7,
"humidity": 100,
"rain": 0,
"pressure": 1005,
"wind_speed": 1,
"wind_direction_degree": 163,
"feels_like_temperature": 32.2
},
"units": {
"temperature": "°C",
"humidity": "%",
"rain": "mm",
"pressure": "hPa",
"wind_speed": "m/s",
"wind_direction_degree": "°",
"feels_like_temperature": "°C"
}
},
"request_id": "req_b9dedf37ab994317b65d56e950541231"
}
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
data.meta.station_id |
string | 观测站号 |
data.meta.station_name |
string | 观测站名 |
data.meta.province |
string | 所在省份/直辖市 |
data.meta.city |
string/null | 所在城市(可能为 null) |
data.meta.county |
string | 所在区县 |
data.meta.longitude |
float | 观测站点经度 WGS84 |
data.meta.latitude |
float | 观测站点纬度 WGS84 |
data.meta.publish_time |
string | 观测发布时间,ISO 8601 格式 |
data.meta.publish_time_unix |
int | 观测发布时间,Unix 时间戳(秒) |
data.meta.timezone |
string | 时区,IANA 格式 |
data.meta.publish_time_unix |
int | 观测发布时间,Unix 时间戳(秒) |
data.meta.timezone |
string | 时区,IANA 格式 |
data.dataset |
string | 数据集标识,目前仅 surface |
data.records.temperature |
float | 气温 |
data.records.humidity |
int | 相对湿度 |
data.records.rain |
float | 降水量 |
data.records.pressure |
float | 大气压强 |
data.records.wind_speed |
float | 风速 |
data.records.wind_direction_degree |
int | 风向角度(0=正北,90=正东) |
data.records.feels_like_temperature |
float | 体感温度 |
data.units |
object | 各字段对应的单位,键名与 records 一致 |
降水量说明
rain 表示观测发布时间所在小时向前 1 小时的降水量。例如 13:25 发布的数据,其 rain 值为 12:00–13:00 之间的降水量。
代码示例
# 更换为您的以 sk- 开头的 API Key 字符串
curl -s \
-H "Authorization: Bearer sk-d5d0542bef7e42e2b8909cb7f42af5fb" \
"https://standard.data-api.skyviewor.host/v1/weather/observation/station/realtime?station_id=54511"
import json, urllib.request
from urllib.parse import urlencode
API_KEY = "sk-d5d0542bef7e42e2b8909cb7f42af5fb" # 更换为您的以 sk- 开头的 API Key 字符串
params = urlencode({"station_id": "54511", "timezone": "Asia/Shanghai"})
url = f"https://standard.data-api.skyviewor.host/v1/weather/observation/station/realtime?{params}"
try:
req = urllib.request.Request(
url, headers={"Authorization": f"Bearer {API_KEY}"}
)
with urllib.request.urlopen(req, timeout=30) as resp:
result = json.loads(resp.read().decode())
except urllib.error.HTTPError as exc:
print(f"HTTP {exc.code}: 无数据(未扣资源点)")
raise
obs = result["data"]["records"]
print(f"气温: {obs.get('temperature')}°C")
print(f"湿度: {obs.get('humidity')}%")
const API_KEY = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
const params = new URLSearchParams({ station_id: "54511", timezone: "Asia/Shanghai" });
const url = `https://standard.data-api.skyviewor.host/v1/weather/observation/station/realtime?${params}`;
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
if (!resp.ok) {
console.log(`HTTP ${resp.status}: 无数据(未扣资源点)`);
} else {
const result = await resp.json();
const obs = result.data.records;
console.log(`气温: ${obs.temperature}°C`);
console.log(`湿度: ${obs.humidity}%`);
}
const API_KEY: string = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
const params = new URLSearchParams({ station_id: "58370" });
const url = `https://standard.data-api.skyviewor.host/v1/weather/observation/station/realtime?${params}`;
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const result: any = await resp.json();
const meta = result.data.meta;
const obs = result.data.records;
console.log(`站点: ${meta.station_name}`);
console.log(`气温: ${obs.temperature}°C`);
console.log(`湿度: ${obs.humidity}%`);
console.log(`风速: ${obs.wind_speed} m/s`);
apiKey := "sk-d5d0542bef7e42e2b8909cb7f42af5fb" // 更换为您的以 sk- 开头的 API Key 字符串
params := url.Values{}
params.Set("station_id", "54511")
params.Set("timezone", "Asia/Shanghai")
apiUrl := "https://standard.data-api.skyviewor.host/v1/weather/observation/station/realtime?" + params.Encode()
req, _ := http.NewRequest("GET", apiUrl, nil)
req.Header.Set("Authorization", "Bearer "+apiKey)
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 404 {
fmt.Println("无数据(未扣资源点)")
return
}
var result map[string]interface{}
json.Unmarshal(body, &result)
obs := result["data"].(map[string]interface{})["records"].(map[string]interface{})
fmt.Printf("气温: %v°C\n", obs["temperature"])
String API_KEY = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
String query = String.format("station_id=%s&timezone=%s",
URLEncoder.encode("54511", StandardCharsets.UTF_8),
URLEncoder.encode("Asia/Shanghai", StandardCharsets.UTF_8));
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://standard.data-api.skyviewor.host/v1/weather/observation/station/realtime?" + query))
.header("Authorization", "Bearer " + API_KEY)
.GET().build();
HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
if (resp.statusCode() == 404) {
System.out.println("无数据(未扣资源点)");
} else {
System.out.println(resp.body());
}
using System.Net.Http;
using System.Text.Json;
var apiBase = "https://standard.data-api.skyviewor.host";
var apiKey = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
var json = await client.GetStringAsync($"{apiBase}/v1/weather/observation/station/realtime?station_id=58370");
using var doc = JsonDocument.Parse(json);
var meta = doc.RootElement.GetProperty("data").GetProperty("meta");
var obs = doc.RootElement.GetProperty("data").GetProperty("records");
Console.WriteLine($"站点: {meta.GetProperty("station_name").GetString()}");
Console.WriteLine($"气温: {obs.GetProperty("temperature").GetDouble()}°C");
Console.WriteLine($"湿度: {obs.GetProperty("humidity").GetInt32()}%");
Console.WriteLine($"风速: {obs.GetProperty("wind_speed").GetDouble()} m/s");
$API_BASE = "https://standard.data-api.skyviewor.host";
$API_KEY = "sk-d5d0542bef7e42e2b8909cb7f42af5fb"; // 更换为您的以 sk- 开头的 API Key 字符串
$ch = curl_init("{$API_BASE}/v1/weather/observation/station/realtime?station_id=58370");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer {$API_KEY}"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
$obs = $result['data']['records'];
echo "站点: {$result['data']['meta']['station_name']}\n";
echo "气温: {$obs['temperature']}°C\n";
echo "湿度: {$obs['humidity']}%\n";
echo "风速: {$obs['wind_speed']} m/s\n";
library(httr)
library(jsonlite)
API_KEY <- "sk-d5d0542bef7e42e2b8909cb7f42af5fb" # 更换为您的以 sk- 开头的 API Key 字符串
resp <- GET(
"https://standard.data-api.skyviewor.host/v1/weather/observation/station/realtime",
query = list(station_id = "54511", timezone = "Asia/Shanghai"),
add_headers(Authorization = paste("Bearer", API_KEY))
)
if (status_code(resp) == 404) {
cat("无数据(未扣资源点)\n")
} else {
result <- fromJSON(content(resp, "text", encoding = "UTF-8"))
obs <- result$data$records
cat(sprintf("气温: %.1f°C\n", obs$temperature))
}
api_base = 'https://standard.data-api.skyviewor.host';
api_key = 'sk-d5d0542bef7e42e2b8909cb7f42af5fb'; % 更换为您的以 sk- 开头的 API Key 字符串
options = weboptions('HeaderFields', {'Authorization', ['Bearer ' api_key]}, 'Timeout', 30);
result = webread([api_base '/v1/weather/observation/station/realtime?station_id=58370'], options);
fprintf('站点: %s\n', result.data.meta.station_name);
fprintf('气温: %.1f°C\n', result.data.records.temperature);
fprintf('湿度: %d%%\n', result.data.records.humidity);
fprintf('风速: %.1f m/s\n', result.data.records.wind_speed);