Skip to content

Commit

Permalink
feat: don't display ogc in map if ogc service down
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed May 31, 2024
1 parent 680aacc commit 080f96f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion libs/feature/dataviz/src/lib/service/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
5 changes: 3 additions & 2 deletions libs/feature/record/src/lib/state/mdview.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down

0 comments on commit 080f96f

Please sign in to comment.