diff --git a/libs/feature/dataviz/src/lib/service/data.service.ts b/libs/feature/dataviz/src/lib/service/data.service.ts index c428511bd6..8380d0503e 100644 --- a/libs/feature/dataviz/src/lib/service/data.service.ts +++ b/libs/feature/dataviz/src/lib/service/data.service.ts @@ -188,7 +188,9 @@ export class DataService { const endpoint = new OgcApiEndpoint(this.proxy.getProxiedUrl(url)) return await endpoint.featureCollections .then((collections) => { - return endpoint.getCollectionItem(collections[0], '1') + return collections.length + ? endpoint.getCollectionItem(collections[0], '1') + : null }) .catch((error) => { throw new Error(`ogc.unreachable.unknown`) diff --git a/libs/feature/record/src/lib/state/mdview.facade.ts b/libs/feature/record/src/lib/state/mdview.facade.ts index 5cba2dad36..135d4be9b3 100644 --- a/libs/feature/record/src/lib/state/mdview.facade.ts +++ b/libs/feature/record/src/lib/state/mdview.facade.ts @@ -106,8 +106,9 @@ export class MdViewFacade { ) { return from(this.dataService.getItemsFromOgcApi(link.url.href)).pipe( map((collectionRecords: OgcApiRecord) => { - const hasGeometry = collectionRecords.geometry - return hasGeometry ? link : null + return collectionRecords && collectionRecords.geometry + ? link + : null }), defaultIfEmpty(null) )