Skip to content

Commit

Permalink
fix: building comparison data coverage shows too much area as covered…
Browse files Browse the repository at this point in the history
… (e.g. Bremen)

Fixed by a backend change and new API endpoint to request the correct coverage polygon mask

Refs: #29
  • Loading branch information
mcauer committed Dec 18, 2023
1 parent ba0a85e commit 7c7a106
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/app/oqt/oqt-api-metadata-provider.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Injectable} from '@angular/core';
import {OqtApiService} from './oqt-api.service';
import {catchError, firstValueFrom, retry, tap, throwError} from 'rxjs';
import {MetadataResponseJSON} from './types/MetadataResponseJSON';
import mask from '@turf/mask';
import {Userlayer} from '../shared/shared-types';

@Injectable({
Expand Down Expand Up @@ -61,12 +60,12 @@ export class OqtApiMetadataProviderService {
// Start a new download only if no download is in progress
this.cachedData[indicatorKey] = (async () => {
try {
const coverageGeoJSON = await firstValueFrom(this.oqtApi.getIndicatorCoverage(indicatorKey));
const coverageGeoJSON = await firstValueFrom(this.oqtApi.getIndicatorCoverage(indicatorKey,true));
// fill cache
this.cachedData[indicatorKey] = Promise.resolve(Object.freeze({
name: indicatorKey,
title: `Coverage of reference data`,
data: mask(coverageGeoJSON),
data: coverageGeoJSON,
style: {color: '#000', stroke: false}
}) as Userlayer);

Expand Down
2 changes: 1 addition & 1 deletion src/app/oqt/oqt-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class OqtApiService {
return this.post(path, body);
}

getIndicatorCoverage(indicatorKey: string): Observable<BaseResponseJSON & FeatureCollection<Polygon|MultiPolygon>> {
getIndicatorCoverage(indicatorKey: string, inverse: boolean = false): Observable<BaseResponseJSON & FeatureCollection<Polygon|MultiPolygon>> {
const path = `metadata/indicators/${indicatorKey}/coverage`;
return this.get(path) as Observable<BaseResponseJSON & FeatureCollection<Polygon|MultiPolygon>>;
}
Expand Down

0 comments on commit 7c7a106

Please sign in to comment.