WeatherKit Historical Data Request Limited to 10 Days

Until recently, I was unable to use WeatherKit to obtain historical Daily data. Now, it appears that I can retrieve Daily and Hourly historical data, but the returned data is limited to a ten day period. No matter what start and end dates are included, I get data from start date to 10 days later (assuming the end date was more than 10 days after the start).

Is this a permanent restriction?

Example: let historicalData = try await weatherService.weather(for: location, including: .daily(startDate: startDate, endDate: endDate))

Accepted Reply

Yes, the restriction is intentional, to limit the performance impact of requests with wide date ranges. The correct approach is to make multiple requests for each of the shorter date ranges you want.

  • Understood. It would seem to me to be better to have an option, say for at least a month. I'll file an enhancement request.

Add a Comment

Replies

Yes, the restriction is intentional, to limit the performance impact of requests with wide date ranges. The correct approach is to make multiple requests for each of the shorter date ranges you want.

  • Understood. It would seem to me to be better to have an option, say for at least a month. I'll file an enhancement request.

Add a Comment

Is this currently working? When I try this code with a date range shorter than 10 days I get back the historical high and low temperatures for the first and last date only; not for all the dates in the date range. Sample code is the same as the one given by @JohnOfSF above. Here's a sample output:

Aborting silent interpolation: additional missing products that need to be fetched from the server anyway; location=CLLocationCoordinate2D(latitude: 37.77, longitude: -122.41), missing products=[WeatherDaemon.WeatherProduct.forecastDaily]

days count=4, date range=2023-10-18 07:00:00 +0000 to 2023-10-21 07:00:00 +0000, first condition=Mostly Clear, first high=28.52 °C, first low=14.12 °C, last condition=Partly Cloudy, last high=19.17 °C, last low=13.05 °C

Note the missing data for the days in between 10/18/2023 and 10/21/2023. Is this how this is supposed to work? If so, what is the point of providing a data range? Is there a different call/function I should be using to get all the data for the entire date range?