Confirm that turf-voroni does not alter feature order
var t=require('@turf/turf');
var p = t.randomPoint(100);
p.features.forEach((f,i) => f.properties.num=i);
var v = t.voronoi(p,{bbox: [-180, -90, 180, 90]})
v.features.forEach((f,i) => f.properties.num=i);
var ok = true;
var bad = [];
v.features.forEach((f,i) => {
if (!t.booleanWithin(p.features[i], f)) {
ok = false;
bad.push(f);
bad.push(p.features[i]);
}
});
if (!ok) {
JSON.stringify(t.featureCollection(bad));
} else {
'All good';
}
no comments