Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const deltaY = (bboxHeight - rows * cellHeight) / 2;
// iterate over columns & rows
let currentX = west + deltaX;
for (let column = 0; column < columns; column++) {
let currentY = south + deltaY;
for (let row = 0; row < rows; row++) {
const cellPoly = polygon([[
[currentX, currentY],
[currentX, currentY + cellHeight],
[currentX + cellWidth, currentY + cellHeight],
[currentX + cellWidth, currentY],
[currentX, currentY],
]], options.properties);
if (options.mask) {
if (intersect(options.mask, cellPoly)) { results.push(cellPoly); }
} else {
results.push(cellPoly);
}
currentY += cellHeight;
}
currentX += cellWidth;
}
return featureCollection(results);
}
.filter(f => booleanIntersects(bbox, f))