Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
vertices.features.push({
type: "Feature",
properties: {},
geometry: {
type: "Point",
coordinates: [diagram.vertices[i].x, diagram.vertices[i].y]
}
})
}
vertices.features.push(centroid(polygon));
//within requires a FeatureCollection for input polygons
const polygonFeatureCollection = {
type: "FeatureCollection",
features: [polygon]
};
const ptsWithin = within(vertices, polygonFeatureCollection); //remove any vertices that are not inside the polygon
if(ptsWithin.features.length === 0) {
throw new NoPointsInShapeError('Neither the centroid nor any Voronoi vertices intersect the shape.');
}
const labelLocation = {
coordinates: [0,0],
maxDist: 0
};
const polygonBoundaries = {
type: "FeatureCollection",
features: []
};
let vertexDistance;
//define borders of polygon and holes as LineStrings
for(let j = 0; j < polygon.geometry.coordinates.length; j++) {
polygonBoundaries.features.push({