Skip to content

单点查询 API ​

访问限制

本部分 API 属于增值服务,仅提供给企业套餐开发者,如需采购请联系彩云商务

TIP

目前支持美国和加拿大地区的 CAP 气象预警信息,其他国家和地区的预警信息正在逐步增加中。

每次调用消耗接口调用额度一次。

请求 ​

http
GET https://singer.caiyunhub.com/v3/cap_alert/location

查询参数 ​

参数必填默认值取值范围说明
token是——API 认证凭证,详见 认证与鉴权
longitude是——经度
latitude是——纬度
language否zh-CNBCP 47 语言标签返回文本语言;当前数据提供 en-US、en-CA 和 fr-CA,请求语言不可用时返回数据源提供的首个可用语言

请求示例 ​

美国:

bash
curl "https://singer.caiyunhub.com/v3/cap_alert/location?token={token}&longitude=-118.25&latitude=34.05&language=en-US"

加拿大(法语):

bash
curl "https://singer.caiyunhub.com/v3/cap_alert/location?token={token}&longitude=-73.5673&latitude=45.5017&language=fr-CA"

响应示例 ​

json
{
  "alerts": [
    {
      "id": "nws-alert-1",
      "region_code": "US",
      "source": 1,
      "msg_type": 1,
      "event_name": "Flash Flood Warning",
      "categories": [2],
      "urgency": 1,
      "severity": 2,
      "certainty": 2,
      "sent_time": 1750123200,
      "effective_time": 1750123200,
      "onset_time": 1750125000,
      "expires_time": 1750130400,
      "references": [],
      "areas": [
        {
          "area_desc": "Los Angeles",
          "geocodes": [
            {
              "value_name": "UGC",
              "value": "CAC037",
              "namespace": "NWS_UGC"
            }
          ],
          "polygons": [
            {
              "vertices": [
                { "latitude": 34.11, "longitude": -118.45 },
                { "latitude": 34.10, "longitude": -118.10 },
                { "latitude": 33.90, "longitude": -118.12 }
              ]
            }
          ],
          "circles": [
            {
              "center": { "latitude": 34.05, "longitude": -118.25 },
              "radius_km": 10
            }
          ]
        }
      ],
      "language_code": "en-US",
      "sender_name": "NWS Los Angeles/Oxnard CA",
      "headline": "Flash Flood Warning issued for Los Angeles",
      "description": "Flash flooding caused by excessive rainfall is expected.",
      "instruction": "Move to higher ground immediately."
    }
  ],
  "attributions": [
    {
      "source": 1,
      "provider": "National Weather Service (NWS)",
      "source_url": "https://api.weather.gov/alerts/active.atom",
      "attribution_text": "Source: National Weather Service (NWS).",
      "license_id": "public-domain",
      "license_url": "https://www.weather.gov/disclaimer",
      "applies_to": "alert_data"
    }
  ]
}

响应字段 ​

CAPAlerts ​

JSONPath类型说明
$.alertsarray<CAPAlert>CAP 气象预警记录列表
$.attributionsarray<CAPAlertAttribution>数据来源、许可证及署名信息

CAPAlertAttribution ​

字段类型说明
sourcenumber预警来源机构,参考 CAPAlertSource
providerstring数据或几何信息提供方
source_urlstring数据源地址
attribution_textstring用于展示的署名文本
license_idstring许可证标识
license_urlstring许可证地址,未提供时不返回该字段
terms_urlstring数据源使用条款地址,未提供时不返回该字段
applies_tostring署名信息的适用对象:alert_data 表示预警数据,geometry 表示几何信息

CAPAlert ​

JSONPath类型说明
$.alerts[].idstring预警唯一标识,不要直接解析 id 作为业务逻辑
$.alerts[].region_codestringISO 3166-1 Alpha-2 code
$.alerts[].sourcenumber预警来源机构,参考 CAPAlertSource
$.alerts[].msg_typenumberCAP msgType,参考 CAPAlertMsgType
$.alerts[].event_namestring事件名称,优先使用请求语言对应文本中的事件名称
$.alerts[].categoriesarray<number>CAP info.category,目前只返回 Met 类型,参考 CAPAlertCategory
$.alerts[].urgencynumberCAP info.urgency,参考 CAPAlertUrgency
$.alerts[].severitynumberCAP info.severity,参考 CAPAlertSeverity
$.alerts[].certaintynumberCAP info.certainty,参考 CAPAlertCertainty
$.alerts[].sent_timenumber发送时间戳(秒)
$.alerts[].effective_timenumber生效时间戳(秒)
$.alerts[].onset_timenumber事件开始时间戳(秒)
$.alerts[].expires_timenumber过期时间戳(秒)
$.alerts[].referencesarray<string>CAP references
$.alerts[].areasarray<CAPAlertArea>受影响区域
$.alerts[].language_codestring当前返回文本的语言编码
$.alerts[].sender_namestring发布机构名称
$.alerts[].headlinestring标题
$.alerts[].descriptionstring预警描述
$.alerts[].instructionstring防御建议或行动指引

CAPAlertArea ​

JSONPath类型说明
$.alerts[].areas[].area_descstring区域描述
$.alerts[].areas[].geocodesarray<CAPAlertGeocode>区域编码
$.alerts[].areas[].polygonsarray<CAPAlertPolygon>多边形范围
$.alerts[].areas[].geocode_polygonsarray<CAPAlertGeocodePolygon>根据区域编码补充的多边形范围
$.alerts[].areas[].circlesarray<CAPAlertCircle>圆形范围
$.alerts[].areas[].altitudenumberCAP altitude,单位为米
$.alerts[].areas[].ceilingnumberCAP ceiling,单位为米

CAPAlertGeocode ​

JSONPath类型说明
$.alerts[].areas[].geocodes[].value_namestring编码名称
$.alerts[].areas[].geocodes[].valuestring编码值
$.alerts[].areas[].geocodes[].namespacestring编码命名空间

CAPAlertPolygon ​

JSONPath类型说明
$.alerts[].areas[].polygons[].verticesarray<LatLng>多边形顶点,字段为 latitude/longitude

CAPAlertGeocodePolygon ​

JSONPath类型说明
$.alerts[].areas[].geocode_polygons[].ringsarray<CAPAlertPolygonRing>多边形环,首环为外边界,后续环为内洞

CAPAlertPolygonRing ​

JSONPath类型说明
$.alerts[].areas[].geocode_polygons[].rings[].verticesarray<LatLng>多边形环顶点,字段为 latitude/longitude

CAPAlertCircle ​

JSONPath类型说明
$.alerts[].areas[].circles[].centerLatLng圆心,字段为 latitude/longitude
$.alerts[].areas[].circles[].radius_kmnumber半径,单位为千米

CAPAlertSource ​

随时可能新增枚举值,代码请做好兼容处理。

NumberDescription
1US National Weather Service
2Environment and Climate Change Canada

CAPAlertMsgType ​

NumberDescription
1Alert
2Update
3Cancel

CAPAlertCategory ​

NumberDescription
1Geo
2Met
3Safety
4Security
5Rescue
6Fire
7Health
8Env
9Transport
10Infra
11CBRNE
12Other

CAPAlertUrgency ​

NumberDescription
1Immediate
2Expected
3Future
4Past
5Unknown

CAPAlertSeverity ​

NumberDescription
1Extreme
2Severe
3Moderate
4Minor
5Unknown

CAPAlertCertainty ​

NumberDescription
1Observed
2Likely
3Possible
4Unlikely
5Unknown