How to use the martinez-polygon-clipping function in martinez-polygon-clipping

To help you get started, we’ve selected a few martinez-polygon-clipping 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 DoFabien / OsmGo / scripts / osmToOsmgo / index.js View on Github external
const mergeBounds = (newBboxFeature, oldBboxFeature) => {
    if (!oldBboxFeature || oldBboxFeature.length === 0) {
        return { 'type': 'FeatureCollection', 'features': [newBboxFeature] };
    } else {
        // martinez union is fast !
        const unionBboxCoordinates = martinez(oldBboxFeature.geometry.coordinates, newBboxFeature.geometry.coordinates, 1)
        let mergedFeature = {
            "type": "Feature",
            "properties": {},
            "geometry": {
                "type": "MultiPolygon",
                "coordinates": unionBboxCoordinates
            }
        };
        return { 'type': 'FeatureCollection', 'features': [mergedFeature] };
    }

}

martinez-polygon-clipping

Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis