Grid Weather Real-time

Platform: API iOS Android

Get high-precision real-time weather at any latitude and longitude around the world.

The spatial resolution is 1x1, 3x3 or 5x5 KM, depending on the region.

Interface code Interface Class
gridNow Grid Weather Real-time GridNowResponse

Parameters

GridWeatherParameter

Name Type Required Exemple
longitude Double true 116.41
latitude Double true 39.92
lang Lang false ZH_HANS
unit Unit false METRIC

Sample code

Swift

Task{
    do {
        let parameter = GridWeatherParameter(longitude: 116.41, latitude: 39.92)
        let response = try await QWeather.instance
            .gridNow(parameter)
        print(response)
    } catch QWeatherError.errorResponse(let error) {
        print(error)
    } catch {
        print(error)
    }
}

Objective-C

GridWeatherParameter *parameter = [GridWeatherParameter instanceWithLongitude:116.41 latitude:39.92 lang:@(LangZH_HANS) unit:@(UnitMETRIC)];
[QWeatherObjc gridNow:parameter completionHandler:^(GridNowResponse * _Nullable response, NSError * _Nullable error) {
    if (response) {
        NSLog(@"%@", response.description);
    }
    if (error) {
        NSLog(@"%@", error.localizedDescription);
    }
}];

Response

GridNowResponse

  • code See Status Code
  • updateTime API last update time
  • fxLink Responsive web page of this data, for embedded in website or APP
  • now.obsTime Observation time
  • now.temp temperature
  • now.icon Icon code for weather conditions. See also QWeather Icons
  • now.text Weather conditions
  • now.wind360 Wind direction in azimuth degree
  • now.windDir Wind direction
  • now.windScale Wind scale
  • now.windSpeed Wind speed, KM/H
  • now.humidity Relative humidity in percent
  • now.precip Accumulated precipitation in the last hour
  • now.pressure Atmospheric pressure, hPa
  • now.cloud Cloud cover in percent, may be null
  • now.dew Dew point temperature, may be null
  • refer.sources Data source and other statements, may be null
  • refer.license Data license, may be null