Estoy etiquetando datos geoespaciales con S2 y me gustaría mostrarlos en un mapa de folleto, junto con el mosaico S2 correspondiente. Cuando uso la biblioteca s2-cell-draw para trazar los cuadros s2, hay una fila con un triángulo y polígonos abiertos. Imagen adjunta. Además, los polígonos no siempre se tocan entre sí como cabría esperar.
¿Alguien tiene una solución para esto? Los mosaicos deben tocarse entre sí y representar el mosaico S2 correspondiente. ¿O hay otra biblioteca de dibujo s2 en js que debería usar? Imágenes y código a continuación.
import {createPolygonListFromBounds, deboxByKey} from 's2-cell-draw'; const bounds = [ [11.987743,-7.815649], [43.158713,10.386320], [74.118173,58.119280], [-2.337240,40.379856], ] const polygonList = createPolygonListFromBounds({ bounds: [ [bounds[0][1], bounds[0][0]], [bounds[2][1], bounds[2][0]] ], level: 7 }); let boxes = []; for (let i = 0; i < polygonList.length; i++) { boxes.push(deboxByKey(polygonList[i]["S2Key"])) } // ... in Leaflet map: {boxes.map((box, i) => ( <Polygon pathOptions={{ color: 'purple' }} positions={[ [box.path[0][1], box.path[0][0]], [box.path[1][1], box.path[1][0]], [box.path[2][1], box.path[2][0]], [box.path[3][1], box.path[3][0]], [box.path[0][1], box.path[0][0]], ]} /> ))}