Method: forecast.hours.lookup

返回指定位置从当前小时开始的最多 240 小时的每小时预报。

HTTP 请求

GET https://weather.googleapis.com/v1/forecast/hours:lookup

网址采用 gRPC 转码语法。

查询参数

参数
location

object (LatLng)

必需。要获取每小时天气预报的位置。

unitsSystem

enum (UnitsSystem)

可选。用于返回天气状况的单位系统。如果未提供,返回的天气状况将采用公制单位(默认 = METRIC)。

pageSize

integer

可选。每页返回的小时天气预报记录数上限 - 值介于 1 到 24(含)之间。默认值为允许的最大值 24。

pageToken

string

可选。从上一个请求收到的页面令牌。用于检索后续页面。

hours

integer

可选。限制要提取的总小时数(从当前小时开始)- 值介于 1 到 240(含)之间。默认值为允许的最大值 240。

languageCode

string

可选。允许客户端选择回答的语言。如果无法提供相应语言的数据,API 会使用最接近的匹配项。允许的值取决于 IETF BCP-47 标准。默认值为“en”。

请求正文

请求正文必须为空。

响应正文

针对 hours.lookup RPC 的响应。

如果成功,响应正文将包含结构如下的数据:

JSON 表示法
{
  "forecastHours": [
    {
      object (ForecastHour)
    }
  ],
  "timeZone": {
    object (TimeZone)
  },
  "nextPageToken": string
}
字段
forecastHours[]

object (ForecastHour)

根据请求中指定的小时数和页面大小,每小时的预报记录。

timeZone

object (TimeZone)

所请求位置的时区。

nextPageToken

string

用于检索下一页的令牌。

授权范围

需要以下 OAuth 范围:

  • https://www.googleapis.com/auth/cloud-platform

ForecastHour

表示给定位置的小时天气预报记录。

JSON 表示法
{
  "interval": {
    object (Interval)
  },
  "displayDateTime": {
    object (DateTime)
  },
  "weatherCondition": {
    object (WeatherCondition)
  },
  "temperature": {
    object (Temperature)
  },
  "feelsLikeTemperature": {
    object (Temperature)
  },
  "dewPoint": {
    object (Temperature)
  },
  "heatIndex": {
    object (Temperature)
  },
  "windChill": {
    object (Temperature)
  },
  "wetBulbTemperature": {
    object (Temperature)
  },
  "precipitation": {
    object (Precipitation)
  },
  "airPressure": {
    object (AirPressure)
  },
  "wind": {
    object (Wind)
  },
  "visibility": {
    object (Visibility)
  },
  "iceThickness": {
    object (IceThickness)
  },
  "isDaytime": boolean,
  "relativeHumidity": integer,
  "uvIndex": integer,
  "thunderstormProbability": integer,
  "cloudCover": integer
}
字段
interval

object (Interval)

相应天气预报数据的有效时间段(以世界协调时间 [UTC] 表示,时间戳会向下舍入到最接近的小时)。

displayDateTime

object (DateTime)

计算相应小时天气预报时所用的位置的时区中的当地日期和时间(民用时间)。此字段可能用于在客户端上显示。注意:此日期将包含年、月、日、小时和与世界协调时间 (UTC) 的偏移量。

weatherCondition

object (WeatherCondition)

预测的天气状况。

temperature

object (Temperature)

预测温度。

feelsLikeTemperature

object (Temperature)

所请求位置的体感温度。

dewPoint

object (Temperature)

预测的温度。

heatIndex

object (Temperature)

预测的酷热指数温度。

windChill

object (Temperature)

预测的风寒指数,即暴露在皮肤上的空气温度。

wetBulbTemperature

object (Temperature)

预测的湿球温度,即通过蒸发水可达到的最低温度。

precipitation

object (Precipitation)

预测的降水概率和过去 1 小时内累积的降水量。

airPressure

object (AirPressure)

预测的气压状况。

wind

object (Wind)

预测的风况。

visibility

object (Visibility)

预测的公开范围。

iceThickness

object (IceThickness)

预测的冰层厚度。

isDaytime

boolean

如果相应小时介于当地日出时间(含)和日落时间(不含)之间,则返回 True。否则,为夜间(日落和下一次日出之间)。注意:如果相应时间段与当地日出和日落时间分别相交,则此小时将被视为白天或夜晚(例如:如果时间段为上午 5 点至上午 6 点,而日出时间为上午 5:59,则 isDaytime 将为 true)。

relativeHumidity

integer

预测的相对湿度百分比(值介于 0 到 100 之间)。

uvIndex

integer

预测的紫外线 (UV) 指数。

thunderstormProbability

integer

雷暴预报概率(值介于 0 到 100 之间)。

cloudCover

integer

云层覆盖天空的预测百分比(值介于 0 到 100 之间)。