How to use the jsts/org/locationtech/jts/operation/union/UnionOp.union function in jsts

To help you get started, we’ve selected a few jsts 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 EventKit / eventkit-cloud / eventkit_cloud / ui / static / ui / app / utils / mapUtils.js View on Github external
export function convertGeoJSONtoJSTS(geojson, bufferSize, bufferPolys) {
    const geojsonReader = new Reader();

    const jstsGeoJSON = geojsonReader.read(geojson);

    let geometry;
    if (jstsGeoJSON.features) {
        const { features } = jstsGeoJSON;
        geometry = bufferGeometry(features[0].geometry, bufferSize, bufferPolys);
        for (let i = 1; i < features.length; i += 1) {
            geometry = UnionOp.union(
                geometry,
                bufferGeometry(features[i].geometry, bufferSize, bufferPolys),
            );
        }
    } else if (jstsGeoJSON.geometries) {
        const { geometries } = jstsGeoJSON;
        geometry = bufferGeometry(geometries[0], bufferSize, bufferPolys);
        for (let i = 1; i < geometries.length; i += 1) {
            geometry = UnionOp.union(
                geometry,
                bufferGeometry(geometries[i], bufferSize, bufferPolys),
            );
        }
    } else if (jstsGeoJSON.geometry) {
        geometry = bufferGeometry(jstsGeoJSON.geometry, bufferSize, bufferPolys);
    } else {
github EventKit / eventkit-cloud / eventkit_cloud / ui / static / ui / app / utils / mapUtils.js View on Github external
let geometry;
    if (jstsGeoJSON.features) {
        const { features } = jstsGeoJSON;
        geometry = bufferGeometry(features[0].geometry, bufferSize, bufferPolys);
        for (let i = 1; i < features.length; i += 1) {
            geometry = UnionOp.union(
                geometry,
                bufferGeometry(features[i].geometry, bufferSize, bufferPolys),
            );
        }
    } else if (jstsGeoJSON.geometries) {
        const { geometries } = jstsGeoJSON;
        geometry = bufferGeometry(geometries[0], bufferSize, bufferPolys);
        for (let i = 1; i < geometries.length; i += 1) {
            geometry = UnionOp.union(
                geometry,
                bufferGeometry(geometries[i], bufferSize, bufferPolys),
            );
        }
    } else if (jstsGeoJSON.geometry) {
        geometry = bufferGeometry(jstsGeoJSON.geometry, bufferSize, bufferPolys);
    } else {
        geometry = bufferGeometry(jstsGeoJSON, bufferSize, bufferPolys);
    }
    return geometry;
}