diff --git a/src/App.tsx b/src/App.tsx index a3fc1c5..cf073b6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -78,7 +78,6 @@ const getCellVisualization = (union: s2.CellUnion): FeatureCollection => { console.error("polygonize error"); console.error(e); } - return collection; }); return { @@ -106,12 +105,12 @@ function App() { let covering; switch (snapshot[0].properties.mode) { case "rectangle": { - console.error("rectangle covering"); + console.info("rectangle covering"); covering = getCovering(regionCoverer, polygons, rectBuilder); break; } default: { - console.error("polygon covering"); + console.info("polygon covering"); covering = getCovering(regionCoverer, polygons, polygonBuilder); } } @@ -185,6 +184,20 @@ function App() { "line-color": "yellow", }, }); + map.addLayer({ + id: "covering-label", + type: "symbol", + source: "covering", + filter: ["<=", ["get", "level"], ["+", ["zoom"], 3]], + layout: { + "text-font": ["Noto Sans Medium"], + "text-field": ["get", "level"], + "text-size": 10, + }, + paint: { + "text-color": "yellow", + }, + }); }); }); @@ -194,9 +207,7 @@ function App() {
- +
- +

s2js Demo

- Visual demo of s2js, a pure TypeScript implementation of S2 Geometry.
- - Draw any region to see its cell covering.
- - Built with Terra Draw, MapLibre and Protomaps tiles. -

-

- Why are there gaps between cells? The visual cells are approximated by trapezoids; in reality they are geodesics, or straight on great circles. + Visual demo of{" "} + + s2js + + , a pure TypeScript implementation of{" "} + + S2 Geometry. + +
+ Draw any region to see its cell covering. +
+ Built with{" "} + + Terra Draw + + ,{" "} + + MapLibre + {" "} + and{" "} + + Protomaps + {" "} + tiles.

- Why don't the cells cover my region? The library interprets edges in the input also as geodesics; this can be mitigated by shorter distances between boundary vertices. + Why don't the cells cover my region? The library + interprets edges in the input also as geodesics; this can be + mitigated by shorter distances between boundary vertices.

Fork me on GitHub
-
+ ); }