Method: currentConditions.lookup

返回指定地点的当前天气状况。

HTTP 请求

GET https://weather.googleapis.com/v1/currentConditions:lookup

网址采用 gRPC 转码语法。

查询参数

参数
location

object (LatLng)

必需。要获取当前天气状况的位置。

unitsSystem

enum (UnitsSystem)

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

languageCode

string

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

请求正文

请求正文必须为空。

响应正文

针对 currentConditions.lookup RPC 的响应 - 表示所请求位置的当前天气状况。

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

JSON 表示法
{
  "currentTime": string,
  "timeZone": {
    object (TimeZone)
  },
  "weatherCondition": {
    object (WeatherCondition)
  },
  "temperature": {
    object (Temperature)
  },
  "feelsLikeTemperature": {
    object (Temperature)
  },
  "dewPoint": {
    object (Temperature)
  },
  "heatIndex": {
    object (Temperature)
  },
  "windChill": {
    object (Temperature)
  },
  "precipitation": {
    object (Precipitation)
  },
  "airPressure": {
    object (AirPressure)
  },
  "wind": {
    object (Wind)
  },
  "visibility": {
    object (Visibility)
  },
  "currentConditionsHistory": {
    object (CurrentConditionsHistory)
  },
  "isDaytime": boolean,
  "relativeHumidity": integer,
  "uvIndex": integer,
  "thunderstormProbability": integer,
  "cloudCover": integer
}
字段
currentTime

string (Timestamp format)

与返回的数据相关联的当前时间(世界协调时间)。

采用 RFC 3339 标准,生成的输出将始终进行 Z 规范化(即转换为 UTC 零时区格式并在末尾附加 Z),并使用 0、3、6 或 9 个小数位。不带“Z”的偏差时间也是可以接受的。示例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"

timeZone

object (TimeZone)

所请求位置的时区。

weatherCondition

object (WeatherCondition)

当前天气状况。

temperature

object (Temperature)

当前温度。

feelsLikeTemperature

object (Temperature)

所请求位置的当前体感温度。

dewPoint

object (Temperature)

当前温度。

heatIndex

object (Temperature)

当前的酷热指数温度。

windChill

object (Temperature)

当前风寒效应,即暴露在皮肤上的空气温度。

precipitation

object (Precipitation)

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

airPressure

object (AirPressure)

当前气压条件。

wind

object (Wind)

当前风况。

visibility

object (Visibility)

当前公开范围。

currentConditionsHistory

object (CurrentConditionsHistory)

过去 24 小时内当前状况的变化。

isDaytime

boolean

如果所请求位置的当前时间介于当地日出时间(含)和日落时间(不含)之间,则为 True。否则,为夜间(日落和下一次日出之间)。

relativeHumidity

integer

当前相对湿度百分比(值介于 0 到 100 之间)。

uvIndex

integer

当前紫外线 (UV) 指数。

thunderstormProbability

integer

当前雷暴概率(值介于 0 到 100 之间)。

cloudCover

integer

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

授权范围

需要以下 OAuth 范围:

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

CurrentConditionsHistory

表示过去 24 小时内当前条件的一组变化。

JSON 表示法
{
  "temperatureChange": {
    object (Temperature)
  },
  "maxTemperature": {
    object (Temperature)
  },
  "minTemperature": {
    object (Temperature)
  },
  "snowQpf": {
    object (QuantitativePrecipitationForecast)
  },
  "qpf": {
    object (QuantitativePrecipitationForecast)
  }
}
字段
temperatureChange

object (Temperature)

当前温度减去 24 小时前的温度。

maxTemperature

object (Temperature)

过去 24 小时内的最高温度。

minTemperature

object (Temperature)

过去 24 小时内的最低温度。

snowQpf

object (QuantitativePrecipitationForecast)

过去 24 小时内累积的降雪量(以等效液态水衡量)。注意:QPF 是定量降水预报的缩写(请参阅 QuantitativePrecipitationForecast 定义了解详情)。

qpf

object (QuantitativePrecipitationForecast)

过去 24 小时内累积的降雨量(以液态水当量衡量)。注意:QPF 是定量降水预报的缩写(请参阅 QuantitativePrecipitationForecast 定义了解详情)。