你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Weather - Get Severe Weather Alerts

用于获取有关给定位置的恶劣天气条件的信息,如飓风、雷暴、洪水、闪电、热浪或森林火灾。

恶劣天气现象可以显著影响我们的日常生活和业务运营。 例如,热带风暴、大风或洪水等恶劣天气条件可能会关闭道路,迫使物流公司重新路由其车队,导致到达目的地延迟,并打破冷藏食品的冷链。

API Get Severe Weather Alerts 是一个 HTTP GET 请求,可返回从官方政府气象机构以及全球到区域气象警报提供商提供的全球恶劣天气警报。 该服务可以返回详细信息,例如警报类型、类别、级别以及有关所请求位置的活动严重警报的详细说明,例如飓风、雷暴、闪电、热浪或森林火灾。 有关详细信息,请参阅 请求恶劣天气警报

GET https://atlas.microsoft.com/weather/severe/alerts/json?api-version=1.1&query={query}
GET https://atlas.microsoft.com/weather/severe/alerts/json?api-version=1.1&query={query}&language={language}&details={details}

URI 参数

名称 必需 类型 说明
format
path True

JsonFormat

响应的所需格式。 仅支持 json 格式。

api-version
query True

string

Azure Maps API 的版本号。

query
query True

number[]

指定为逗号分隔字符串的适用查询,该字符串由纬度后跟经度组成,例如“47.641268,-122.125679”。

details
query

string

返回恶劣天气警报的完整详细信息。 可用值为

  • true - 返回完整详细信息。 默认情况下,将返回所有详细信息。
  • false - 返回警报数据的截断版本,这不包括警报详细信息 (alertDetails) 特定于区域的完整说明。
language
query

string

返回搜索结果时应采用的语言。 应是受支持的 IETF 语言标记之一,不区分大小写。 当指定语言的数据不适用于特定字段时,将使用默认语言。

有关详细信息,请参阅 支持的语言

请求头

名称 必需 类型 说明
x-ms-client-id

string

指定要与Microsoft Entra ID安全模型结合使用的帐户。 它表示Azure Maps帐户的唯一 ID,可从Azure Maps管理平面帐户 API 检索。 若要在 Azure Maps 中使用Microsoft Entra ID安全性,请参阅以下文章以获取指导。

响应

名称 类型 说明
200 OK

SevereWeatherAlertsResult

还行

Other Status Codes

ErrorResponse

发生了意外错误。

安全性

AADToken

这些是Microsoft Entra OAuth 2.0 流。 与 Azure 基于角色的访问控制配对时,它可用于控制对Azure Maps REST API 的访问。 Azure 基于角色的访问控制用于指定对一个或多个Azure Maps资源帐户或子资源的访问权限。 可以通过内置角色或由一个或多个权限组成的自定义角色授予任何用户、组或服务主体的访问权限,以Azure Maps REST API。

若要实现方案,建议查看 身份验证概念。 总之,此安全定义提供了一种解决方案,用于通过能够对特定 API 和作用域进行访问控制的对象对应用程序 () 建模。

备注

  • 此安全定义需要使用x-ms-client-id 标头来指示应用程序请求访问的Azure Maps资源。 这可以从 地图管理 API 获取。

Authorization URL特定于 Azure 公有云实例。 主权云具有唯一的授权 URL 和Microsoft Entra ID配置。 * Azure 基于角色的访问控制是通过 Azure 门户、PowerShell、CLI、Azure SDK 或 REST API 从 Azure 管理平面配置的。 * 使用 Azure Maps Web SDK 允许针对多个用例对应用程序进行基于配置的设置。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名称 说明
https://atlas.microsoft.com/.default https://atlas.microsoft.com/.default

subscription-key

这是在Azure 门户中使用 PowerShell、CLI、Azure SDK 或 REST API Create Azure Maps 帐户时预配的共享密钥。

使用此密钥,任何应用程序都可以访问所有 REST API。 换句话说,此密钥可用作颁发密钥的帐户中的主密钥。

对于公开的应用程序,我们建议使用机密客户端应用程序方法来访问Azure Maps REST API,以便安全地存储密钥。

Type: apiKey
In: query

SAS Token

这是一个共享访问签名令牌,通过 Azure 门户、PowerShell、CLI、Azure SDK 或 REST API,通过 Azure 管理平面在Azure Maps资源上列出 SAS 操作创建。

使用此令牌,任何应用程序都有权使用 Azure 基于角色的访问控制进行访问,并精细控制特定令牌的过期、速率和区域 () 。 换句话说,SAS 令牌可用于允许应用程序以比共享密钥更安全的方式控制访问。

对于公开的应用程序,我们建议在 Map 帐户资源 上配置允许的来源的特定列表,以限制呈现滥用,并定期续订 SAS 令牌。

Type: apiKey
In: header

示例

Successfully retrieve severe weather alerts

Sample Request

GET https://atlas.microsoft.com/weather/severe/alerts/json?api-version=1.1&query=48.057,-81.091

Sample Response

{
  "results": [
    {
      "countryCode": "CA",
      "alertId": 242621,
      "description": {
        "localized": "Heat Warning",
        "english": "Heat Warning"
      },
      "category": "NON-PRECIPITATION",
      "priority": 31,
      "source": "Environment Canada",
      "sourceId": 3,
      "alertAreas": [
        {
          "name": "Kirkland Lake - Englehart",
          "summary": "Heat Warning in effect until Thursday, 3:16 AM EDT.  Source: Environment Canada",
          "startTime": "2020-06-29T19:44:00+00:00",
          "endTime": "2020-07-02T07:16:03+00:00",
          "latestStatus": {
            "localized": "Continue",
            "english": "Continue"
          },
          "alertDetails": "\nA heat event continues through Thursday.\n\nDaytime high temperatures in the low thirties with overnight lows near 18 degrees Celsius are expected to continue until Thursday. Humidex values are expected to reach between 36 and 40 today. Cooler air will move into the region Thursday night. \n\nPlease refer to your public forecast for further details on expected temperatures.\n\nHot and humid air can also bring deteriorating air quality and can result in the air quality health index to approach the high risk category.\n\n###\n\nExtreme heat affects everyone.\n\nThe risks are greater for young children, pregnant women, older adults, people with chronic illnesses and people working or exercising outdoors.\n\nWatch for the effects of heat illness: swelling, rash, cramps, fainting, heat exhaustion, heat stroke and the worsening of some health conditions.\n\nPlease continue to monitor alerts and forecasts issued by Environment Canada. To report severe weather, send an email to ONstorm@canada.ca or tweet reports using #ONStorm.\n",
          "alertDetailsLanguageCode": "en-CA"
        }
      ]
    },
    {
      "countryCode": "CA",
      "alertId": 242633,
      "description": {
        "localized": "Heat Warning",
        "english": "Heat Warning"
      },
      "category": "NON-PRECIPITATION",
      "priority": 31,
      "source": "Environment Canada",
      "sourceId": 3,
      "alertAreas": [
        {
          "name": "Kirkland Lake - Englehart",
          "summary": "Heat Warning in effect until 9:25 PM EDT.  Source: Environment Canada",
          "startTime": "2020-07-01T09:25:59+00:00",
          "endTime": "2020-07-02T01:25:59+00:00",
          "latestStatus": {
            "localized": "New",
            "english": "New"
          },
          "alertDetails": "\nA heat event is expected through Thursday.  \n\nDaytime high temperatures in the low thirties on Wednesday and Thursday with overnight lows near 18 degrees Celsius are expected. This heat event may be extended into the weekend with daytime high temperatures near 30 degrees Celsius. \n\nPlease refer to your public forecast for further details on expected temperatures.  \n\nHot and humid air can also bring deteriorating air quality and can result in the Air Quality Health Index to approach the high risk category.\n\n###\n\nExtreme heat affects everyone.\n\nThe risks are greater for young children, pregnant women, older adults, people with chronic illnesses and people working or exercising outdoors.\n\nPlease continue to monitor alerts and forecasts issued by Environment Canada. To report severe weather, send an email to ONstorm@canada.ca or tweet reports using #ONStorm.\n",
          "alertDetailsLanguageCode": "en-CA"
        }
      ]
    }
  ]
}

定义

名称 说明
AlertArea

有关受影响区域内发出的恶劣天气警报的信息 () 。 如果同一位置有多个警报处于活动状态,则警报将按 API 响应中的 的顺序 priority 返回,最高优先级的警报将在响应顶部返回。

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

JsonFormat

响应的所需格式。 仅支持 json 格式。

LatestStatus

当前区域中警报的最新状态。

LatestStatusKeyword

警报最新状态的关键字。

SevereWeatherAlert

有关恶劣天气警报的信息。

SevereWeatherAlertDescription

恶劣天气警报的说明。

SevereWeatherAlertsResult

此对象是从成功的获取恶劣天气警报调用返回的。

AlertArea

有关受影响区域内发出的恶劣天气警报的信息 () 。 如果同一位置有多个警报处于活动状态,则警报将按 API 响应中的 的顺序 priority 返回,最高优先级的警报将在响应顶部返回。

名称 类型 说明
alertDetails

string

与警报关联的完整详细信息。 如果 =True,则 details返回。 此字段始终以颁发提供程序选择的语言 () 返回,Azure Maps仅返回提供程序创建的内容。 请注意,某些国家/地区可能提供其母语和英语。 语言参数不适用于此字段。

alertDetailsLanguageCode

string

的语言 alertDetails。 此字段有助于指出 的语言 alertDetails 可能与请求的语言参数不同。 如果 =True,则 details返回。 语言代码派生自 ISO 639-1 Alpha-2 代码。

endTime

string

警报的结束日期和时间,采用 ISO 8601 格式,例如 2019-10-27T19:39:57-08:00。 如果警报跨越多个时区,则响应中返回的时间是请求的坐标位置的本地时间。

latestStatus

LatestStatus

当前区域中警报的最新状态。

name

string

受警报影响的区域的名称。 请求的位置位于警报区域下。

startTime

string

警报的开始日期和时间,采用 ISO 8601 格式,例如 2019-10-27T19:39:57-08:00。 如果警报跨越多个时区,则响应中返回的时间是请求的坐标位置的本地时间。

summary

string

在返回区域中汇总警报的文本。

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

JsonFormat

响应的所需格式。 仅支持 json 格式。

名称 类型 说明
json

string

JavaScript 对象表示法数据交换格式

LatestStatus

当前区域中警报的最新状态。

名称 类型 说明
english

LatestStatusKeyword

警报的最新状态关键字 (keyword) ,以英语 (en-US) 。

localized

string

警报的最新状态关键字 (keyword) ,采用指定语言。 默认情况下,以英语 (en-US) 返回。

LatestStatusKeyword

警报最新状态的关键字。

名称 类型 说明
Cancel

string

“取消”- 警报在其原始过期时间之前已取消。

Continue

string

“Continue” - 警报自最初发布以来已更新,但未对 alertDetailsstartTimeendTimeclass进行更改。

Correct

string

“正确”- 已修改警报以更正以前的错误。

Expire

string

“过期”- 警报已过期,不再处于活动状态。

Extend

string

“扩展”- 警报自首次发布以来,已随时间和/或区域进行了扩展。

New

string

“新建”- 初始发出时警报的状态。

Update

string

“更新”- 警报自首次发布以来已更新。

Upgrade

string

“升级”- 警报自最初发出以来已升级到更高的类或类别。

SevereWeatherAlert

有关恶劣天气警报的信息。

名称 类型 说明
alertAreas

AlertArea[]

有关特定于受影响区域的警报的信息 () 。

alertId

integer

天气警报的唯一数字标识符。

category

string

警报类别。

class

string

警报的分类。 此字段并非适用于所有国家/地区,因此并不总是返回。

countryCode

string

2 个字符的 ISO 3166-1 Alpha-2 国家/地区代码,例如“US”。

description

SevereWeatherAlertDescription

警报的说明。

disclaimer

string

有关警报信息来源的免责声明。 此字段并非始终可用。 例如,免责声明可能包括有关警报延迟或潜在问题的详细信息。

level

string

警报的严重级别。 此字段并非适用于所有国家/地区,因此并不总是返回。

priority

integer

表示给定警报在发起的国家/地区中的重要性或排名顺序的数字。 数字越小,优先级越高。 例如,1 是最高优先级。 该数字因国家/地区而异,并随着每个国家/地区的警报系统的发展而变化。

source

string

警报信息的提供程序。 默认情况下,源以英语 (en-US) 返回。 警报来自官方的政府气象机构和领先的全球天气警报提供商。

sourceId

integer

与警报数据的源提供程序名称关联的数字标识符。

SevereWeatherAlertDescription

恶劣天气警报的说明。

名称 类型 说明
english

string

警报的英文说明 (en-US) 。

localized

string

以指定语言显示警报的说明。 默认情况下,如果未在请求中指定语言参数,则返回英语 (en-US) 。

SevereWeatherAlertsResult

此对象是从成功的获取恶劣天气警报调用返回的。

名称 类型 说明
results

SevereWeatherAlert[]

查询位置的所有恶劣天气警报的列表。