How to use the @turf/boolean-intersects function in @turf/boolean-intersects

To help you get started, we’ve selected a few @turf/boolean-intersects examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Turfjs / turf / packages / turf-square-grid / index.ts View on Github external
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);
}

@turf/boolean-intersects

turf boolean-intersects module

MIT
Latest version published 3 months ago

Package Health Score

98 / 100
Full package analysis

Popular @turf/boolean-intersects functions