Grid Weather Daily Forecast
Get daily weather forecasts at any latitude and longitude in the world, including: temperature, humidity, atmospheric pressure, weather conditions, wind, wind direction, etc.
The spatial resolution is 1x1, 3x3 or 5x5 KM, depending on the region.
Interface code | Interface | Class |
---|---|---|
grid3d | 3 Days Forecast by Grid | GridDailyResponse |
grid7d | 7 Days Forecast by Grid | GridDailyResponse |
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)
/*
* 3 Days Forecast by Grid
*/
let _ = try await QWeather.instance
.grid3d(parameter)
/*
* 7 Days Forecast by Grid
*/
let _ = try await QWeather.instance
.grid7d(parameter)
} 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)];
void (^handler)(GridDailyResponse *, NSError *) = ^(GridDailyResponse *response,
NSError *error) {
if (response) {
NSLog(@"%@", response.description);
}
if (error) {
NSLog(@"%@", error.localizedDescription);
}
};
/*
* 3 Days Forecast by Grid
*/
[QWeatherObjc grid3d:parameter completionHandler:handler];
/*
* 7 Days Forecast by Grid
*/
[QWeatherObjc grid7d:parameter completionHandler:handler];
Response
GridDailyResponse
-
code
See Status Code -
updateTime
API last update time -
fxLink
Responsive web page of this data, for embedded in website or APP -
daily.fxDate
Forecast date -
daily.tempMax
The highest temperature of the day -
daily.tempMin
The lowest temperature of the day -
daily.iconDay
Icon code for daytime weather conditions. See also QWeather Icons -
daily.textDay
Weather conditions for daytime -
daily.iconNight
Icon code for night weather conditions. See also QWeather Icons -
daily.textNight
Weather conditions for night -
daily.wind360Day
Daytime wind direction in azimuth degree -
daily.windDirDay
Daytime wind direction -
daily.windScaleDay
Daytime wind scale -
daily.windSpeedDay
Daytime wind speed, KM/H -
daily.wind360Night
Nightly wind direction in azimuth degree -
daily.windDirNight
Nightly wind direction -
daily.windScaleNight
Nightly wind scale -
daily.windSpeedNight
Nightly wind speed, KM/H -
daily.precip
Estimated total precipitation for the day -
daily.humidity
Relative humidity in percent -
daily.pressure
Atmospheric pressure, hPa -
refer.sources
Data source and other statements, may be null -
refer.license
Data license, may be null