Skip to content

Commit

Permalink
Merge pull request #1138 from IFRCGo/fix/bbox-emergencies-map
Browse files Browse the repository at this point in the history
Map Bounds issue fix
  • Loading branch information
samshara authored Jun 13, 2024
2 parents e5fc860 + 2c64b8b commit a24dd3f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/src/utils/map.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isDefined } from '@togglecorp/fujs';
import getBbox from '@turf/bbox';
import type {
FillLayer,
Expand Down Expand Up @@ -183,9 +184,14 @@ export function getCountryListBoundingBox(countryList: Country[]) {
return undefined;
}

const countryWithBbox = countryList.filter((country) => isDefined(country.bbox));

if (countryWithBbox.length < 1) {
return undefined;
}
const collection = {
type: 'FeatureCollection' as const,
features: countryList.map((country) => ({
features: countryWithBbox.map((country) => ({
type: 'Feature' as const,
geometry: country.bbox,
})),
Expand Down

0 comments on commit a24dd3f

Please sign in to comment.