| 1234567891011121314151617181920212223 |
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// index.ts
- var _polyclipts = require('polyclip-ts'); var polyclip = _interopRequireWildcard(_polyclipts);
- var _helpers = require('@turf/helpers');
- var _meta = require('@turf/meta');
- function union2(features, options = {}) {
- const geoms = [];
- _meta.geomEach.call(void 0, features, (geom) => {
- geoms.push(geom.coordinates);
- });
- if (geoms.length < 2) {
- throw new Error("Must have at least 2 geometries");
- }
- const unioned = polyclip.union(geoms[0], ...geoms.slice(1));
- if (unioned.length === 0) return null;
- if (unioned.length === 1) return _helpers.polygon.call(void 0, unioned[0], options.properties);
- else return _helpers.multiPolygon.call(void 0, unioned, options.properties);
- }
- var turf_union_default = union2;
- exports.default = turf_union_default; exports.union = union2;
- //# sourceMappingURL=index.cjs.map
|