Skip to content

Commit

Permalink
feat: add fallback for failed wms
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Jun 5, 2024
1 parent 3a46fb6 commit 8837a27
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions libs/feature/map/src/lib/utils/map-utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,19 @@ export class MapUtilsService {
getRecordExtent(record: Partial<CatalogRecord>): Extent {
if (!('spatialExtents' in record)) {
return null
} else if (record.spatialExtents.length > 0) {
// transform an array of geojson geometries into a bbox
const totalExtent = record.spatialExtents.reduce(
(prev, curr) => {
const geom = GEOJSON.readGeometry(curr.geometry)
return extend(prev, geom.getExtent())
},
[Infinity, Infinity, -Infinity, -Infinity]
)
return transformExtent(totalExtent, 'EPSG:4326', 'EPSG:3857')
} else {
return null
}
// transform an array of geojson geometries into a bbox
const totalExtent = record.spatialExtents.reduce(
(prev, curr) => {
const geom = GEOJSON.readGeometry(curr.geometry)
return extend(prev, geom.getExtent())
},
[Infinity, Infinity, -Infinity, -Infinity]
)
return transformExtent(totalExtent, 'EPSG:4326', 'EPSG:3857')
}
}

Expand Down

0 comments on commit 8837a27

Please sign in to comment.