diff --git a/libs/feature/map/src/lib/utils/map-utils.service.ts b/libs/feature/map/src/lib/utils/map-utils.service.ts index 969c30ee23..a99f1ee611 100644 --- a/libs/feature/map/src/lib/utils/map-utils.service.ts +++ b/libs/feature/map/src/lib/utils/map-utils.service.ts @@ -217,21 +217,18 @@ export class MapUtilsService { } getRecordExtent(record: Partial): 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 { + if (!('spatialExtents' in record) || record.spatialExtents.length === 0) { 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') } }