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

Weather - Get Quarter Day Forecast

用于获取未来 1 天、5 天、10 天或 15 天的 Quarter-Day 预测。

Get Quarter-Day Forecast API 是一个 HTTP GET 请求,它返回给定位置未来 1 天、5 天、10 天或 15 天(按季度)的详细天气预报。 响应数据按一天中的季度表示 - 上午、下午、晚上和夜间。 将返回温度、湿度、风、降水和 UV 指数等详细信息。

GET https://atlas.microsoft.com/weather/forecast/quarterDay/json?api-version=1.1&query={query}
GET https://atlas.microsoft.com/weather/forecast/quarterDay/json?api-version=1.1&query={query}&unit={unit}&duration={duration}&language={language}

URI 参数

名称 必需 类型 说明
format
path True

JsonFormat

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

api-version
query True

string

Azure Maps API 的版本号。

query
query True

number[]

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

通常,天气信息适用于陆地上的位置、被陆地包围的水体以及距离海岸线约 50 海里以内的海洋区域。

duration
query

integer

指定返回 quester-day forecast 响应的天数。 支持的值有:

  • 1 - 返回第二天的预测数据。 默认情况下返回。
  • 5 - 返回未来 5 天的预测数据。
  • 10 - 返回未来 10 天的预测数据。
  • 15 - 返回未来 15 天的预测数据。
language
query

string

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

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

unit
query

WeatherDataUnit

指定以公制单位或英制单位返回数据。 默认值为 metric。

请求头

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

string

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

响应

名称 类型 说明
200 OK

QuarterDayForecastResult

好的

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 允许为多个用例设置基于应用程序的配置。

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

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

subscription-key

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

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

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

类型: apiKey
在: query

SAS Token

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

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

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

类型: apiKey
在: header

示例

Successfully retrieve detailed weather forecast by a given location

示例请求

GET https://atlas.microsoft.com/weather/forecast/quarterDay/json?api-version=1.1&query=47.632346,-122.138874&duration=1

示例响应

{
  "forecasts": [
    {
      "date": "2019-11-14T00:00:00-08:00",
      "effectiveDate": "2019-11-14T07:00:00-08:00",
      "quarter": 0,
      "iconCode": 12,
      "iconPhrase": "Showers",
      "phrase": "Mostly cloudy with a shower in spots",
      "temperature": {
        "minimum": {
          "value": 6.9,
          "unit": "C",
          "unitType": 17
        },
        "maximum": {
          "value": 11.1,
          "unit": "C",
          "unitType": 17
        }
      },
      "realFeelTemperature": {
        "minimum": {
          "value": 7.9,
          "unit": "C",
          "unitType": 17
        },
        "maximum": {
          "value": 11.2,
          "unit": "C",
          "unitType": 17
        }
      },
      "dewPoint": {
        "value": 7.5,
        "unit": "C",
        "unitType": 17
      },
      "relativeHumidity": 90,
      "wind": {
        "direction": {
          "degrees": 206,
          "localizedDescription": "SSW"
        },
        "speed": {
          "value": 3.7,
          "unit": "km/h",
          "unitType": 7
        }
      },
      "windGust": {
        "direction": {
          "degrees": 192,
          "localizedDescription": "SSW"
        },
        "speed": {
          "value": 9.3,
          "unit": "km/h",
          "unitType": 7
        }
      },
      "visibility": {
        "value": 2,
        "unit": "km",
        "unitType": 6
      },
      "cloudCover": 99,
      "hasPrecipitation": true,
      "precipitationType": "Rain",
      "precipitationIntensity": "Light",
      "precipitationProbability": 55,
      "thunderstormProbability": 20,
      "totalLiquid": {
        "value": 0.6,
        "unit": "mm",
        "unitType": 3
      },
      "rain": {
        "value": 0.6,
        "unit": "mm",
        "unitType": 3
      },
      "snow": {
        "value": 0,
        "unit": "cm",
        "unitType": 4
      },
      "ice": {
        "value": 0,
        "unit": "mm",
        "unitType": 3
      }
    },
    {
      "date": "2019-11-14T00:00:00-08:00",
      "effectiveDate": "2019-11-14T13:00:00-08:00",
      "quarter": 1,
      "iconCode": 12,
      "iconPhrase": "Showers",
      "phrase": "Mostly cloudy with a shower in spots",
      "temperature": {
        "minimum": {
          "value": 11.3,
          "unit": "C",
          "unitType": 17
        },
        "maximum": {
          "value": 13.7,
          "unit": "C",
          "unitType": 17
        }
      },
      "realFeelTemperature": {
        "minimum": {
          "value": 11.3,
          "unit": "C",
          "unitType": 17
        },
        "maximum": {
          "value": 14.7,
          "unit": "C",
          "unitType": 17
        }
      },
      "dewPoint": {
        "value": 8.4,
        "unit": "C",
        "unitType": 17
      },
      "relativeHumidity": 76,
      "wind": {
        "direction": {
          "degrees": 296,
          "localizedDescription": "WNW"
        },
        "speed": {
          "value": 3.7,
          "unit": "km/h",
          "unitType": 7
        }
      },
      "windGust": {
        "direction": {
          "degrees": 206,
          "localizedDescription": "SSW"
        },
        "speed": {
          "value": 9.3,
          "unit": "km/h",
          "unitType": 7
        }
      },
      "visibility": {
        "value": 8,
        "unit": "km",
        "unitType": 6
      },
      "cloudCover": 96,
      "hasPrecipitation": true,
      "precipitationType": "Rain",
      "precipitationIntensity": "Light",
      "precipitationProbability": 50,
      "thunderstormProbability": 20,
      "totalLiquid": {
        "value": 0.3,
        "unit": "mm",
        "unitType": 3
      },
      "rain": {
        "value": 0.3,
        "unit": "mm",
        "unitType": 3
      },
      "snow": {
        "value": 0,
        "unit": "cm",
        "unitType": 4
      },
      "ice": {
        "value": 0,
        "unit": "mm",
        "unitType": 3
      }
    },
    {
      "date": "2019-11-14T00:00:00-08:00",
      "effectiveDate": "2019-11-14T19:00:00-08:00",
      "quarter": 2,
      "iconCode": 7,
      "iconPhrase": "Cloudy",
      "phrase": "Cloudy",
      "temperature": {
        "minimum": {
          "value": 9.8,
          "unit": "C",
          "unitType": 17
        },
        "maximum": {
          "value": 10.4,
          "unit": "C",
          "unitType": 17
        }
      },
      "realFeelTemperature": {
        "minimum": {
          "value": 8.5,
          "unit": "C",
          "unitType": 17
        },
        "maximum": {
          "value": 9.8,
          "unit": "C",
          "unitType": 17
        }
      },
      "dewPoint": {
        "value": 7,
        "unit": "C",
        "unitType": 17
      },
      "relativeHumidity": 81,
      "wind": {
        "direction": {
          "degrees": 172,
          "localizedDescription": "S"
        },
        "speed": {
          "value": 9.3,
          "unit": "km/h",
          "unitType": 7
        }
      },
      "windGust": {
        "direction": {
          "degrees": 174,
          "localizedDescription": "S"
        },
        "speed": {
          "value": 13,
          "unit": "km/h",
          "unitType": 7
        }
      },
      "visibility": {
        "value": 10,
        "unit": "km",
        "unitType": 6
      },
      "cloudCover": 93,
      "hasPrecipitation": false,
      "precipitationProbability": 25,
      "thunderstormProbability": 0,
      "totalLiquid": {
        "value": 0,
        "unit": "mm",
        "unitType": 3
      },
      "rain": {
        "value": 0,
        "unit": "mm",
        "unitType": 3
      },
      "snow": {
        "value": 0,
        "unit": "cm",
        "unitType": 4
      },
      "ice": {
        "value": 0,
        "unit": "mm",
        "unitType": 3
      }
    },
    {
      "date": "2019-11-14T00:00:00-08:00",
      "effectiveDate": "2019-11-15T01:00:00-08:00",
      "quarter": 3,
      "iconCode": 12,
      "iconPhrase": "Showers",
      "phrase": "Cloudy with a little rain",
      "temperature": {
        "minimum": {
          "value": 8.9,
          "unit": "C",
          "unitType": 17
        },
        "maximum": {
          "value": 9.9,
          "unit": "C",
          "unitType": 17
        }
      },
      "realFeelTemperature": {
        "minimum": {
          "value": 6.2,
          "unit": "C",
          "unitType": 17
        },
        "maximum": {
          "value": 8.6,
          "unit": "C",
          "unitType": 17
        }
      },
      "dewPoint": {
        "value": 6.9,
        "unit": "C",
        "unitType": 17
      },
      "relativeHumidity": 84,
      "wind": {
        "direction": {
          "degrees": 164,
          "localizedDescription": "SSE"
        },
        "speed": {
          "value": 9.3,
          "unit": "km/h",
          "unitType": 7
        }
      },
      "windGust": {
        "direction": {
          "degrees": 165,
          "localizedDescription": "SSE"
        },
        "speed": {
          "value": 14.8,
          "unit": "km/h",
          "unitType": 7
        }
      },
      "visibility": {
        "value": 9,
        "unit": "km",
        "unitType": 6
      },
      "cloudCover": 99,
      "hasPrecipitation": true,
      "precipitationType": "Rain",
      "precipitationIntensity": "Light",
      "precipitationProbability": 59,
      "thunderstormProbability": 0,
      "totalLiquid": {
        "value": 1.4,
        "unit": "mm",
        "unitType": 3
      },
      "rain": {
        "value": 1.4,
        "unit": "mm",
        "unitType": 3
      },
      "snow": {
        "value": 0,
        "unit": "cm",
        "unitType": 4
      },
      "ice": {
        "value": 0,
        "unit": "mm",
        "unitType": 3
      }
    }
  ]
}

定义

名称 说明
DayQuarter

四分之一日。

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

IconCode

表示显示 iconPhrase. 有关详细信息,请参阅 Azure Maps 中的天气服务

JsonFormat

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

PrecipitationType

指定降水的类型(“雨”、“雪”、“冰”或“混合”)。 如果 dbz 为零,则响应中不存在 precipitationType。

QuarterDayForecast
QuarterDayForecastResult
UnitType

与所显示的单位类型关联的数字 ID 值。 可用于单位转换。 有关详细信息,请参阅 Azure Maps 中的天气服务

WeatherDataUnit

指定以公制单位或英制单位返回数据。 默认值为 metric。

WeatherUnit

与天气相关的给定单位的特定值。

WeatherUnitRange

返回的温度值。

WindDetails

返回的风详细信息,包括速度和方向。

WindDirection

风向

DayQuarter

四分之一日。

说明
0

上午 7:00 - 下午 1:00 / 7:00 - 13:00

1

下午 1:00 - 晚上 7:00/ 13:00 - 19:00

2

晚上 7:00 - 凌晨 1:00/ 19:00 - 凌晨 1:00

3

上午 1:00 - 上午 7:00 / 01:00 - 07:00

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

IconCode

表示显示 iconPhrase. 有关详细信息,请参阅 Azure Maps 中的天气服务

说明
1

10
11

12

阵雨

13

大部多云有阵雨

14

局部晴朗有阵雨

15

雷暴

16

大部多云有雷暴

17

局部晴朗有雷暴

18

19

小雪

2

晴时多云

20

大部多云有小雪

21

局部晴朗有小雪

22

雪白

23

大部多云有雪

24

25

雨夹雪

26

冻雨

27
28
29

雨夹雪

3

局部晴朗

30

31

32

33

清晰

34

大部晴朗

35

局部多云

36

间歇性云(夜间)

37

朦胧的月光

38

大部分时间多云(夜间)

39

局部多云有阵雨

4

间歇性多云

40

大部分时间多云,有阵雨(夜间)

41

局部多云有雷暴

42

多云,有雷暴(夜间)

43

大部分时间多云,有阵雨(夜间)

44

大部分时间多云,有雪(夜间)

5

朦胧的阳光

6

大部多云

7

多云

8

阴沉(阴)

9

JsonFormat

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

说明
json

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

PrecipitationType

指定降水的类型(“雨”、“雪”、“冰”或“混合”)。 如果 dbz 为零,则响应中不存在 precipitationType。

说明
Ice

Mix

混合

Rain

Snow

雪白

QuarterDayForecast

名称 类型 说明
cloudCover

integer (int32)

表示云覆盖的百分比。

date

string (date-time)

预测日期 (以 2019-10-27T00:00:00 为例)

dewPoint

WeatherUnit

以指定单位表示的露点温度。 露点温度是空气必须冷却到才能达到饱和的温度。

effectiveDate

string (date-time)

以 ISO 8601 格式显示的预测季度开始的日期和时间,例如 2019-10-27T19:39:57-08:00。

hasPrecipitation

boolean

指示是否存在降水。 True 表示存在降水,false 表示没有降水。

ice

WeatherUnit

iconCode

IconCode (int32)

表示显示 iconPhrase. 有关详细信息,请参阅 Azure Maps 中的天气服务

iconPhrase

string

图标的短语描述。 以指定的语言显示。 例如,“Sunny”。

phrase

string

季度的简短摘要短语摘要。

precipitationIntensity

string

强度的描述。

precipitationProbability

integer (int32)

表示降水概率的百分比。 例如,'20'。

precipitationType

PrecipitationType

指定降水的类型(“雨”、“雪”、“冰”或“混合”)。 如果 dbz 为零,则响应中不存在 precipitationType。

quarter

DayQuarter (int32)

四分之一日。

rain

WeatherUnit

realFeelTemperature

WeatherUnitRange

该季度的 RealFeel™ Temperature 值。

relativeHumidity

integer (int32)

相对湿度是空气中存在的水蒸气量,表示为相同温度下饱和所需量的百分比。

snow

WeatherUnit

雪白

temperature

WeatherUnitRange

季度的温度值。

thunderstormProbability

integer (int32)

百分比表示雷暴的概率。 例如,'10'。

totalLiquid

WeatherUnit

预测期内降水的总液体当量。

visibility

WeatherUnit

以指定单位表示的可见性。 可以清楚地辨别物体或光线的距离的度量。

wind

WindDetails

返回的风详细信息,包括速度和方向。

windGust

WindDetails

阵风。 阵风是风速的突然、短暂增加。

QuarterDayForecastResult

名称 类型 说明
forecasts

QuarterDayForecast[]

响应中每个季度的 Forecast 数据。

UnitType

与所显示的单位类型关联的数字 ID 值。 可用于单位转换。 有关详细信息,请参阅 Azure Maps 中的天气服务

说明
0

英尺

1

英寸

10

米每秒

11

百帕

12

英寸汞柱

13

千帕

14

毫巴

15

毫米汞柱

16

每平方英寸磅数

17

摄氏温度

18

华氏温度

19

开氏温度

2

英里

20

百分之

21

漂浮

22

整数

3

毫米

31

MicrogramsPerCubicMeterOfAir

4

厘米

5

6

千米

7

公里每小时

8

9

英里每小时

WeatherDataUnit

指定以公制单位或英制单位返回数据。 默认值为 metric。

说明
imperial

以英制单位返回数据。 英制的一些示例单位是华氏度和英里。

metric

以公制单位返回数据。 公制的一些示例单位是 Celsius 和 Kilometer。

WeatherUnit

与天气相关的给定单位的特定值。

名称 类型 说明
unit

string

返回值的单位类型。

unitType

UnitType (int32)

与所显示的单位类型关联的数字 ID 值。 可用于单位转换。 有关详细信息,请参阅 Azure Maps 中的天气服务

value

number (float)

四舍五入的值。

WeatherUnitRange

返回的温度值。

名称 类型 说明
maximum

WeatherUnit

该时间段的最高温度

minimum

WeatherUnit

该时间段的最低温度。

WindDetails

返回的风详细信息,包括速度和方向。

名称 类型 说明
direction

WindDirection

风向

speed

WeatherUnit

以指定单位表示的风速。

WindDirection

风向

名称 类型 说明
degrees

integer (int32)

风向(方位角),从正北开始,继续顺时针方向。 北是0度,东是90度,南是180度,西部是270度。 可能的值为 0-359。

localizedDescription

string

指定语言的 Direction 缩写。