How to use the @turf/explode function in @turf/explode

To help you get started, we’ve selected a few @turf/explode 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-isobands / index.js View on Github external
function isInside(testPolygon, targetPolygon) {
    var points = explode(testPolygon);
    for (var i = 0; i < points.features.length; i++) {
        if (!booleanPointInPolygon(points.features[i], targetPolygon)) {
            return false;
        }
    }
    return true;
}
github Turfjs / turf / packages / turf-point-on-surface / index.js View on Github external
type: 'Feature',
                geometry: geom,
                properties: {}
            };
            if (inside(cent, f)) {
                onSurface = true;
            }
        }
        i++;
    }
    if (onSurface) {
        return cent;
    } else {
        var vertices = featureCollection([]);
        for (i = 0; i < fc.features.length; i++) {
            vertices.features = vertices.features.concat(explode(fc.features[i]).features);
        }
        return nearest(cent, vertices);
    }
}

@turf/explode

turf explode module

MIT
Latest version published 3 years ago

Package Health Score

80 / 100
Full package analysis

Popular @turf/explode functions