Skip to content

Commit

Permalink
multi-feature coverings are actually supported, however results are u…
Browse files Browse the repository at this point in the history
…nioned and therefore will not satisfy maxCells and minLevel conditions.
  • Loading branch information
missinglink committed Sep 22, 2024
1 parent a2843cc commit 1780240
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ const getCovering = (
coverer: geojson.RegionCoverer,
features: Feature[],
): s2.CellUnion => {
if (features.length > 1) throw new Error("multi-feature unsupported");
return coverer.covering(features[0].geometry);
return s2.CellUnion.fromUnion(
...features.map((f) => coverer.covering(f.geometry)),
);
};

// We adjust the lines from great-circle to have lng > 180 and < -180 so that
Expand Down

0 comments on commit 1780240

Please sign in to comment.