const index = createSnapIndex();
index.setSourceFeatures("parcels", parcels);
const snapping = bindEditSketchSnapping(map, {
index,
model: workflow,
onSnap: ({ candidate }) => showGuide(candidate),
});
map.on("click", (e) => {
snapping.applySketchGeometry("point", { type: "Point", coordinates: [e.lngLat.lng, e.lngLat.lat] });
});
Bind edit-sketch snapping to a MapLibre-shaped map.