@turf/intersect 7.2.0 → 7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +12 -13
package/dist/cjs/index.cjs
CHANGED
|
@@ -16,9 +16,9 @@ function intersect(features, options = {}) {
|
|
|
16
16
|
return _helpers.polygon.call(void 0, intersection2[0], options.properties);
|
|
17
17
|
return _helpers.multiPolygon.call(void 0, intersection2, options.properties);
|
|
18
18
|
}
|
|
19
|
-
var
|
|
19
|
+
var index_default = intersect;
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
exports.default =
|
|
23
|
+
exports.default = index_default; exports.intersect = intersect;
|
|
24
24
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-intersect/dist/cjs/index.cjs","../../index.ts"],"names":["intersection"],"mappings":"AAAA;ACOA,wCAAsC;AACtC,kCAAyB;AACzB,8FAA0B;AAqC1B,SAAS,SAAA,CACP,QAAA,EACA,QAAA,EAEI,CAAC,CAAA,EACsC;AAC3C,EAAA,MAAM,MAAA,EAAyB,CAAC,CAAA;AAEhC,EAAA,4BAAA,QAAS,EAAU,CAAC,IAAA,EAAA,GAAS;AAC3B,IAAA,KAAA,CAAM,IAAA,CAAK,IAAA,CAAK,WAA4B,CAAA;AAAA,EAC9C,CAAC,CAAA;AAED,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,EAAS,CAAA,EAAG;AACpB,IAAA,MAAM,IAAI,KAAA,CAAM,oCAAoC,CAAA;AAAA,EACtD;AACA,EAAA,MAAMA,cAAAA,EAAwB,QAAA,CAAA,YAAA,CAAa,KAAA,CAAM,CAAC,CAAA,EAAG,GAAG,KA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A,aAAaA,EAAc,OAAA,CAAQ,UAAU,CAAA;AACtD;AAGA,IAAO,cAAA,EAAQ,SAAA;ADlDf;AACE;AACA;AACF,+DAAC","file":"/home/runner/work/turf/turf/packages/turf-intersect/dist/cjs/index.cjs","sourcesContent":[null,"import {\n Feature,\n GeoJsonProperties,\n MultiPolygon,\n Polygon,\n FeatureCollection,\n} from \"geojson\";\nimport { multiPolygon, polygon } from \"@turf/helpers\";\nimport { geomEach } from \"@turf/meta\";\nimport * as polyclip from \"polyclip-ts\";\n\n/**\n * Takes {@link Polygon|polygon} or {@link MultiPolygon|multi-polygon} geometries and\n * finds their polygonal intersection. If they don't intersect, returns null.\n *\n * @function\n * @param {FeatureCollection<Polygon | MultiPolygon>} features the features to intersect\n * @param {Object} [options={}] Optional Parameters\n * @param {Object} [options.properties={}] Translate GeoJSON Properties to Feature\n * @returns {Feature|null} returns a feature representing the area they share (either a {@link Polygon} or\n * {@link MultiPolygon}). If they do not share any area, returns `null`.\n * @example\n * var poly1 = turf.polygon([[\n * [-122.801742, 45.48565],\n * [-122.801742, 45.60491],\n * [-122.584762, 45.60491],\n * [-122.584762, 45.48565],\n * [-122.801742, 45.48565]\n * ]]);\n *\n * var poly2 = turf.polygon([[\n * [-122.520217, 45.535693],\n * [-122.64038, 45.553967],\n * [-122.720031, 45.526554],\n * [-122.669906, 45.507309],\n * [-122.723464, 45.446643],\n * [-122.532577, 45.408574],\n * [-122.487258, 45.477466],\n * [-122.520217, 45.535693]\n * ]]);\n *\n * var intersection = turf.intersect(turf.featureCollection([poly1, poly2]));\n *\n * //addToMap\n * var addToMap = [poly1, poly2, intersection];\n */\nfunction intersect<P extends GeoJsonProperties = GeoJsonProperties>(\n features: FeatureCollection<Polygon | MultiPolygon>,\n options: {\n properties?: P;\n } = {}\n): Feature<Polygon | MultiPolygon, P> | null {\n const geoms: polyclip.Geom[] = [];\n\n geomEach(features, (geom) => {\n geoms.push(geom.coordinates as polyclip.Geom);\n });\n\n if (geoms.length < 2) {\n throw new Error(\"Must specify at least 2 geometries\");\n }\n const intersection = polyclip.intersection(geoms[0], ...geoms.slice(1));\n if (intersection.length === 0) return null;\n if (intersection.length === 1)\n return polygon(intersection[0], options.properties);\n return multiPolygon(intersection, options.properties);\n}\n\nexport { intersect };\nexport default intersect;\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -16,9 +16,9 @@ function intersect(features, options = {}) {
|
|
|
16
16
|
return polygon(intersection2[0], options.properties);
|
|
17
17
|
return multiPolygon(intersection2, options.properties);
|
|
18
18
|
}
|
|
19
|
-
var
|
|
19
|
+
var index_default = intersect;
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
index_default as default,
|
|
22
22
|
intersect
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import {\n Feature,\n GeoJsonProperties,\n MultiPolygon,\n Polygon,\n FeatureCollection,\n} from \"geojson\";\nimport { multiPolygon, polygon } from \"@turf/helpers\";\nimport { geomEach } from \"@turf/meta\";\nimport * as polyclip from \"polyclip-ts\";\n\n/**\n * Takes {@link Polygon|polygon} or {@link MultiPolygon|multi-polygon} geometries and\n * finds their polygonal intersection. If they don't intersect, returns null.\n *\n * @function\n * @param {FeatureCollection<Polygon | MultiPolygon>} features the features to intersect\n * @param {Object} [options={}] Optional Parameters\n * @param {Object} [options.properties={}] Translate GeoJSON Properties to Feature\n * @returns {Feature|null} returns a feature representing the area they share (either a {@link Polygon} or\n * {@link MultiPolygon}). If they do not share any area, returns `null`.\n * @example\n * var poly1 = turf.polygon([[\n * [-122.801742, 45.48565],\n * [-122.801742, 45.60491],\n * [-122.584762, 45.60491],\n * [-122.584762, 45.48565],\n * [-122.801742, 45.48565]\n * ]]);\n *\n * var poly2 = turf.polygon([[\n * [-122.520217, 45.535693],\n * [-122.64038, 45.553967],\n * [-122.720031, 45.526554],\n * [-122.669906, 45.507309],\n * [-122.723464, 45.446643],\n * [-122.532577, 45.408574],\n * [-122.487258, 45.477466],\n * [-122.520217, 45.535693]\n * ]]);\n *\n * var intersection = turf.intersect(turf.featureCollection([poly1, poly2]));\n *\n * //addToMap\n * var addToMap = [poly1, poly2, intersection];\n */\nfunction intersect<P extends GeoJsonProperties = GeoJsonProperties>(\n features: FeatureCollection<Polygon | MultiPolygon>,\n options: {\n properties?: P;\n } = {}\n): Feature<Polygon | MultiPolygon, P> | null {\n const geoms: polyclip.Geom[] = [];\n\n geomEach(features, (geom) => {\n geoms.push(geom.coordinates as polyclip.Geom);\n });\n\n if (geoms.length < 2) {\n throw new Error(\"Must specify at least 2 geometries\");\n }\n const intersection = polyclip.intersection(geoms[0], ...geoms.slice(1));\n if (intersection.length === 0) return null;\n if (intersection.length === 1)\n return polygon(intersection[0], options.properties);\n return multiPolygon(intersection, options.properties);\n}\n\nexport { intersect };\nexport default intersect;\n"],"mappings":";AAOA,SAAS,cAAc,eAAe;AACtC,SAAS,gBAAgB;AACzB,YAAY,cAAc;AAqC1B,SAAS,UACP,UACA,UAEI,CAAC,GACsC;AAC3C,QAAM,QAAyB,CAAC;AAEhC,WAAS,UAAU,CAAC,SAAS;AAC3B,UAAM,KAAK,KAAK,WAA4B;AAAA,EAC9C,CAAC;AAED,MAAI,MAAM,SAAS,GAAG;AACpB,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACtD;AACA,QAAMA,gBAAwB,sBAAa,MAAM,CAAC,GAAG,GAAG,MAAM,MAAM,CAAC,CAAC;AACtE,MAAIA,cAAa,WAAW,EAAG,QAAO;AACtC,MAAIA,cAAa,WAAW;AAC1B,WAAO,QAAQA,cAAa,CAAC,GAAG,QAAQ,UAAU;AACpD,SAAO,aAAaA,eAAc,QAAQ,UAAU;AACtD;AAGA,IAAO,
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import {\n Feature,\n GeoJsonProperties,\n MultiPolygon,\n Polygon,\n FeatureCollection,\n} from \"geojson\";\nimport { multiPolygon, polygon } from \"@turf/helpers\";\nimport { geomEach } from \"@turf/meta\";\nimport * as polyclip from \"polyclip-ts\";\n\n/**\n * Takes {@link Polygon|polygon} or {@link MultiPolygon|multi-polygon} geometries and\n * finds their polygonal intersection. If they don't intersect, returns null.\n *\n * @function\n * @param {FeatureCollection<Polygon | MultiPolygon>} features the features to intersect\n * @param {Object} [options={}] Optional Parameters\n * @param {Object} [options.properties={}] Translate GeoJSON Properties to Feature\n * @returns {Feature|null} returns a feature representing the area they share (either a {@link Polygon} or\n * {@link MultiPolygon}). If they do not share any area, returns `null`.\n * @example\n * var poly1 = turf.polygon([[\n * [-122.801742, 45.48565],\n * [-122.801742, 45.60491],\n * [-122.584762, 45.60491],\n * [-122.584762, 45.48565],\n * [-122.801742, 45.48565]\n * ]]);\n *\n * var poly2 = turf.polygon([[\n * [-122.520217, 45.535693],\n * [-122.64038, 45.553967],\n * [-122.720031, 45.526554],\n * [-122.669906, 45.507309],\n * [-122.723464, 45.446643],\n * [-122.532577, 45.408574],\n * [-122.487258, 45.477466],\n * [-122.520217, 45.535693]\n * ]]);\n *\n * var intersection = turf.intersect(turf.featureCollection([poly1, poly2]));\n *\n * //addToMap\n * var addToMap = [poly1, poly2, intersection];\n */\nfunction intersect<P extends GeoJsonProperties = GeoJsonProperties>(\n features: FeatureCollection<Polygon | MultiPolygon>,\n options: {\n properties?: P;\n } = {}\n): Feature<Polygon | MultiPolygon, P> | null {\n const geoms: polyclip.Geom[] = [];\n\n geomEach(features, (geom) => {\n geoms.push(geom.coordinates as polyclip.Geom);\n });\n\n if (geoms.length < 2) {\n throw new Error(\"Must specify at least 2 geometries\");\n }\n const intersection = polyclip.intersection(geoms[0], ...geoms.slice(1));\n if (intersection.length === 0) return null;\n if (intersection.length === 1)\n return polygon(intersection[0], options.properties);\n return multiPolygon(intersection, options.properties);\n}\n\nexport { intersect };\nexport default intersect;\n"],"mappings":";AAOA,SAAS,cAAc,eAAe;AACtC,SAAS,gBAAgB;AACzB,YAAY,cAAc;AAqC1B,SAAS,UACP,UACA,UAEI,CAAC,GACsC;AAC3C,QAAM,QAAyB,CAAC;AAEhC,WAAS,UAAU,CAAC,SAAS;AAC3B,UAAM,KAAK,KAAK,WAA4B;AAAA,EAC9C,CAAC;AAED,MAAI,MAAM,SAAS,GAAG;AACpB,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACtD;AACA,QAAMA,gBAAwB,sBAAa,MAAM,CAAC,GAAG,GAAG,MAAM,MAAM,CAAC,CAAC;AACtE,MAAIA,cAAa,WAAW,EAAG,QAAO;AACtC,MAAIA,cAAa,WAAW;AAC1B,WAAO,QAAQA,cAAa,CAAC,GAAG,QAAQ,UAAU;AACpD,SAAO,aAAaA,eAAc,QAAQ,UAAU;AACtD;AAGA,IAAO,gBAAQ;","names":["intersection"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/intersect",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.3.1",
|
|
4
|
+
"description": "Finds the shared area between two polygons.",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": {
|
|
@@ -46,29 +46,28 @@
|
|
|
46
46
|
"bench": "tsx bench.ts",
|
|
47
47
|
"build": "tsup --config ../../tsup.config.ts",
|
|
48
48
|
"docs": "tsx ../../scripts/generate-readmes.ts",
|
|
49
|
-
"test": "
|
|
49
|
+
"test": "pnpm run /test:.*/",
|
|
50
50
|
"test:tape": "tsx test.ts",
|
|
51
51
|
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/benchmark": "^2.1.5",
|
|
55
|
-
"@types/tape": "^
|
|
55
|
+
"@types/tape": "^5.8.1",
|
|
56
56
|
"benchmark": "^2.1.4",
|
|
57
|
-
"glob": "^
|
|
57
|
+
"glob": "^11.1.0",
|
|
58
58
|
"load-json-file": "^7.0.1",
|
|
59
|
-
"npm-run-all": "^4.1.5",
|
|
60
59
|
"tape": "^5.9.0",
|
|
61
|
-
"tsup": "^8.
|
|
62
|
-
"tsx": "^4.19.
|
|
63
|
-
"typescript": "^5.
|
|
64
|
-
"write-json-file": "^
|
|
60
|
+
"tsup": "^8.4.0",
|
|
61
|
+
"tsx": "^4.19.4",
|
|
62
|
+
"typescript": "^5.8.3",
|
|
63
|
+
"write-json-file": "^6.0.0"
|
|
65
64
|
},
|
|
66
65
|
"dependencies": {
|
|
67
|
-
"@turf/helpers": "
|
|
68
|
-
"@turf/meta": "
|
|
66
|
+
"@turf/helpers": "7.3.1",
|
|
67
|
+
"@turf/meta": "7.3.1",
|
|
69
68
|
"@types/geojson": "^7946.0.10",
|
|
70
69
|
"polyclip-ts": "^0.16.8",
|
|
71
70
|
"tslib": "^2.8.1"
|
|
72
71
|
},
|
|
73
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "b7f1b4eafb760431e03955499d8eac9489438219"
|
|
74
73
|
}
|