Merge branch 'develop'
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

# Conflicts:
#	package.json
#	projects/common-map/src/fm-map/common-map.module.ts
#	projects/common/src/fm/reducers/app-common.reducer.ts
This commit is contained in:
Willem Dantuma
2022-01-31 21:04:52 +01:00
51 changed files with 6185 additions and 6128 deletions

View File

@@ -49,6 +49,22 @@ export class WeatherService {
return this.getWeatherRange(centroid, startDateString, endDateString);
}
public getDailyHistoricalObservations(centroid: number[], startDate: string, endDate: string): Observable<HourlyWeatherData[]> {
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
const apiKey = this.appConfig.getConfig('weatherApiKey');
// weather does not support UTC format, also remove Z
const sd = encodeURIComponent(startDate);
const edHistoricalDate = new Date();
edHistoricalDate.setHours(edHistoricalDate.getHours(), 0, 0, 0);
const edHistorical = moment(edHistoricalDate).local().format('YYYY-MM-DD[T]HH:mm:ss');
const historical = `${endpoint}${this.apiObservation}/?c=${centroid[0]},${centroid[1]}&sd=${sd}&ed=${edHistorical}&t=cleanedobservation&interval=daily&key=${apiKey}`;
return this.httpClient.get<any[]>(historical);
}
public getWeatherRange(centroid: number[], startDate: string, endDate: string): Observable<HourlyWeatherData[]> {
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
const apiKey = this.appConfig.getConfig('weatherApiKey');