From 01d92a799a7b7a20e670ac20080b410c1796c645 Mon Sep 17 00:00:00 2001 From: Kazuma Tsuchiya Date: Mon, 5 Aug 2024 13:52:24 +0900 Subject: [PATCH] feat: support GeometryCollection --- src/mantle/data/geojson.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mantle/data/geojson.ts b/src/mantle/data/geojson.ts index b241146..86d298e 100644 --- a/src/mantle/data/geojson.ts +++ b/src/mantle/data/geojson.ts @@ -20,6 +20,14 @@ export function processGeoJSON(geojson: GeoJSON, range?: DataRange): Feature[] { if (geojson.type === "Feature") { const geo = geojson.geometry; + if (geo.type === "GeometryCollection") { + return geo.geometries.flatMap(geometry => { + return processGeoJSON({ + ...geojson, + geometry, + }); + }); + } if (geo.type === "MultiPoint") { return geo.coordinates.flatMap(coord => { return processGeoJSON({