@turf/combine 7.0.0 → 7.1.0-alpha.70
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/README.md +2 -16
- package/dist/cjs/index.cjs +1 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ into [MultiPoint][5], [MultiLineString][6], or [MultiPolygon][7] features.
|
|
|
9
9
|
|
|
10
10
|
### Parameters
|
|
11
11
|
|
|
12
|
-
* `fc` **[FeatureCollection][
|
|
12
|
+
* `fc` **[FeatureCollection][1]<([Point][2] | [LineString][3] | [Polygon][4])>** a FeatureCollection of any type
|
|
13
13
|
|
|
14
14
|
### Examples
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ var combined = turf.combine(fc);
|
|
|
25
25
|
var addToMap = [combined]
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Returns **[FeatureCollection][
|
|
28
|
+
Returns **[FeatureCollection][1]<([MultiPoint][5] | [MultiLineString][6] | [MultiPolygon][7])>** a FeatureCollection of corresponding type to input
|
|
29
29
|
|
|
30
30
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
31
31
|
|
|
@@ -41,20 +41,6 @@ Returns **[FeatureCollection][8]<([MultiPoint][12] | [MultiLineString][13] | [Mu
|
|
|
41
41
|
|
|
42
42
|
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.7
|
|
43
43
|
|
|
44
|
-
[8]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
45
|
-
|
|
46
|
-
[9]: https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
47
|
-
|
|
48
|
-
[10]: https://tools.ietf.org/html/rfc7946#section-3.1.4
|
|
49
|
-
|
|
50
|
-
[11]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
51
|
-
|
|
52
|
-
[12]: https://tools.ietf.org/html/rfc7946#section-3.1.3
|
|
53
|
-
|
|
54
|
-
[13]: https://tools.ietf.org/html/rfc7946#section-3.1.5
|
|
55
|
-
|
|
56
|
-
[14]: https://tools.ietf.org/html/rfc7946#section-3.1.7
|
|
57
|
-
|
|
58
44
|
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
|
|
59
45
|
|
|
60
46
|
---
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// index.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
|
|
5
2
|
var _helpers = require('@turf/helpers');
|
|
6
3
|
var _meta = require('@turf/meta');
|
|
7
4
|
function combine(fc) {
|
|
@@ -62,7 +59,6 @@ function combine(fc) {
|
|
|
62
59
|
})
|
|
63
60
|
);
|
|
64
61
|
}
|
|
65
|
-
__name(combine, "combine");
|
|
66
62
|
var turf_combine_default = combine;
|
|
67
63
|
|
|
68
64
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":["feature"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":["feature"],"mappings":";AAUA,SAAS,SAAS,yBAAyB;AAC3C,SAAS,mBAAmB;AAoB5B,SAAS,QACP,IAGA;AACA,MAAI,SAAS;AAAA,IACX,YAAY;AAAA,MACV,aAAa,CAAC;AAAA,MACd,YAAY,CAAC;AAAA,IACf;AAAA,IACA,iBAAiB;AAAA,MACf,aAAa,CAAC;AAAA,MACd,YAAY,CAAC;AAAA,IACf;AAAA,IACA,cAAc;AAAA,MACZ,aAAa,CAAC;AAAA,MACd,YAAY,CAAC;AAAA,IACf;AAAA,E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,uBAAQ","sourcesContent":["import {\n GeoJsonProperties,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { feature, featureCollection } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\n\n/**\n * Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features\n * into {@link MultiPoint}, {@link MultiLineString}, or {@link MultiPolygon} features.\n *\n * @name combine\n * @param {FeatureCollection<Point|LineString|Polygon>} fc a FeatureCollection of any type\n * @returns {FeatureCollection<MultiPoint|MultiLineString|MultiPolygon>} a FeatureCollection of corresponding type to input\n * @example\n * var fc = turf.featureCollection([\n * turf.point([19.026432, 47.49134]),\n * turf.point([19.074497, 47.509548])\n * ]);\n *\n * var combined = turf.combine(fc);\n *\n * //addToMap\n * var addToMap = [combined]\n */\nfunction combine(\n fc: FeatureCollection<\n Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon\n >\n) {\n var groups = {\n MultiPoint: {\n coordinates: [] as number[][],\n properties: [] as GeoJsonProperties[],\n },\n MultiLineString: {\n coordinates: [] as number[][][],\n properties: [] as GeoJsonProperties[],\n },\n MultiPolygon: {\n coordinates: [] as number[][][][],\n properties: [] as GeoJsonProperties[],\n },\n };\n\n featureEach(fc, (feature) => {\n switch (feature.geometry?.type) {\n case \"Point\":\n groups.MultiPoint.coordinates.push(feature.geometry.coordinates);\n groups.MultiPoint.properties.push(feature.properties);\n break;\n case \"MultiPoint\":\n groups.MultiPoint.coordinates.push(...feature.geometry.coordinates);\n groups.MultiPoint.properties.push(feature.properties);\n break;\n case \"LineString\":\n groups.MultiLineString.coordinates.push(feature.geometry.coordinates);\n groups.MultiLineString.properties.push(feature.properties);\n break;\n case \"MultiLineString\":\n groups.MultiLineString.coordinates.push(\n ...feature.geometry.coordinates\n );\n groups.MultiLineString.properties.push(feature.properties);\n break;\n case \"Polygon\":\n groups.MultiPolygon.coordinates.push(feature.geometry.coordinates);\n groups.MultiPolygon.properties.push(feature.properties);\n break;\n case \"MultiPolygon\":\n groups.MultiPolygon.coordinates.push(...feature.geometry.coordinates);\n groups.MultiPolygon.properties.push(feature.properties);\n break;\n default:\n break;\n }\n });\n\n return featureCollection(\n (Object.keys(groups) as (keyof typeof groups)[])\n .filter(function (key) {\n return groups[key].coordinates.length;\n })\n .sort()\n .map(function (key) {\n var geometry = { type: key, coordinates: groups[key].coordinates } as\n | MultiPoint\n | MultiLineString\n | MultiPolygon;\n var properties = { collectedProperties: groups[key].properties };\n return feature(geometry, properties);\n })\n );\n}\n\nexport { combine };\nexport default combine;\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// index.ts
|
|
5
2
|
import { feature, featureCollection } from "@turf/helpers";
|
|
6
3
|
import { featureEach } from "@turf/meta";
|
|
@@ -62,7 +59,6 @@ function combine(fc) {
|
|
|
62
59
|
})
|
|
63
60
|
);
|
|
64
61
|
}
|
|
65
|
-
__name(combine, "combine");
|
|
66
62
|
var turf_combine_default = combine;
|
|
67
63
|
export {
|
|
68
64
|
combine,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import {\n GeoJsonProperties,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { feature, featureCollection } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\n\n/**\n * Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features\n * into {@link MultiPoint}, {@link MultiLineString}, or {@link MultiPolygon} features.\n *\n * @name combine\n * @param {FeatureCollection<Point|LineString|Polygon>} fc a FeatureCollection of any type\n * @returns {FeatureCollection<MultiPoint|MultiLineString|MultiPolygon>} a FeatureCollection of corresponding type to input\n * @example\n * var fc = turf.featureCollection([\n * turf.point([19.026432, 47.49134]),\n * turf.point([19.074497, 47.509548])\n * ]);\n *\n * var combined = turf.combine(fc);\n *\n * //addToMap\n * var addToMap = [combined]\n */\nfunction combine(\n fc: FeatureCollection<\n Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon\n >\n) {\n var groups = {\n MultiPoint: {\n coordinates: [] as number[][],\n properties: [] as GeoJsonProperties[],\n },\n MultiLineString: {\n coordinates: [] as number[][][],\n properties: [] as GeoJsonProperties[],\n },\n MultiPolygon: {\n coordinates: [] as number[][][][],\n properties: [] as GeoJsonProperties[],\n },\n };\n\n featureEach(fc, (feature) => {\n switch (feature.geometry?.type) {\n case \"Point\":\n groups.MultiPoint.coordinates.push(feature.geometry.coordinates);\n groups.MultiPoint.properties.push(feature.properties);\n break;\n case \"MultiPoint\":\n groups.MultiPoint.coordinates.push(...feature.geometry.coordinates);\n groups.MultiPoint.properties.push(feature.properties);\n break;\n case \"LineString\":\n groups.MultiLineString.coordinates.push(feature.geometry.coordinates);\n groups.MultiLineString.properties.push(feature.properties);\n break;\n case \"MultiLineString\":\n groups.MultiLineString.coordinates.push(\n ...feature.geometry.coordinates\n );\n groups.MultiLineString.properties.push(feature.properties);\n break;\n case \"Polygon\":\n groups.MultiPolygon.coordinates.push(feature.geometry.coordinates);\n groups.MultiPolygon.properties.push(feature.properties);\n break;\n case \"MultiPolygon\":\n groups.MultiPolygon.coordinates.push(...feature.geometry.coordinates);\n groups.MultiPolygon.properties.push(feature.properties);\n break;\n default:\n break;\n }\n });\n\n return featureCollection(\n (Object.keys(groups) as (keyof typeof groups)[])\n .filter(function (key) {\n return groups[key].coordinates.length;\n })\n .sort()\n .map(function (key) {\n var geometry = { type: key, coordinates: groups[key].coordinates } as\n | MultiPoint\n | MultiLineString\n | MultiPolygon;\n var properties = { collectedProperties: groups[key].properties };\n return feature(geometry, properties);\n })\n );\n}\n\nexport { combine };\nexport default combine;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import {\n GeoJsonProperties,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { feature, featureCollection } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\n\n/**\n * Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features\n * into {@link MultiPoint}, {@link MultiLineString}, or {@link MultiPolygon} features.\n *\n * @name combine\n * @param {FeatureCollection<Point|LineString|Polygon>} fc a FeatureCollection of any type\n * @returns {FeatureCollection<MultiPoint|MultiLineString|MultiPolygon>} a FeatureCollection of corresponding type to input\n * @example\n * var fc = turf.featureCollection([\n * turf.point([19.026432, 47.49134]),\n * turf.point([19.074497, 47.509548])\n * ]);\n *\n * var combined = turf.combine(fc);\n *\n * //addToMap\n * var addToMap = [combined]\n */\nfunction combine(\n fc: FeatureCollection<\n Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon\n >\n) {\n var groups = {\n MultiPoint: {\n coordinates: [] as number[][],\n properties: [] as GeoJsonProperties[],\n },\n MultiLineString: {\n coordinates: [] as number[][][],\n properties: [] as GeoJsonProperties[],\n },\n MultiPolygon: {\n coordinates: [] as number[][][][],\n properties: [] as GeoJsonProperties[],\n },\n };\n\n featureEach(fc, (feature) => {\n switch (feature.geometry?.type) {\n case \"Point\":\n groups.MultiPoint.coordinates.push(feature.geometry.coordinates);\n groups.MultiPoint.properties.push(feature.properties);\n break;\n case \"MultiPoint\":\n groups.MultiPoint.coordinates.push(...feature.geometry.coordinates);\n groups.MultiPoint.properties.push(feature.properties);\n break;\n case \"LineString\":\n groups.MultiLineString.coordinates.push(feature.geometry.coordinates);\n groups.MultiLineString.properties.push(feature.properties);\n break;\n case \"MultiLineString\":\n groups.MultiLineString.coordinates.push(\n ...feature.geometry.coordinates\n );\n groups.MultiLineString.properties.push(feature.properties);\n break;\n case \"Polygon\":\n groups.MultiPolygon.coordinates.push(feature.geometry.coordinates);\n groups.MultiPolygon.properties.push(feature.properties);\n break;\n case \"MultiPolygon\":\n groups.MultiPolygon.coordinates.push(...feature.geometry.coordinates);\n groups.MultiPolygon.properties.push(feature.properties);\n break;\n default:\n break;\n }\n });\n\n return featureCollection(\n (Object.keys(groups) as (keyof typeof groups)[])\n .filter(function (key) {\n return groups[key].coordinates.length;\n })\n .sort()\n .map(function (key) {\n var geometry = { type: key, coordinates: groups[key].coordinates } as\n | MultiPoint\n | MultiLineString\n | MultiPolygon;\n var properties = { collectedProperties: groups[key].properties };\n return feature(geometry, properties);\n })\n );\n}\n\nexport { combine };\nexport default combine;\n"],"mappings":";AAUA,SAAS,SAAS,yBAAyB;AAC3C,SAAS,mBAAmB;AAoB5B,SAAS,QACP,IAGA;AACA,MAAI,SAAS;AAAA,IACX,YAAY;AAAA,MACV,aAAa,CAAC;AAAA,MACd,YAAY,CAAC;AAAA,IACf;AAAA,IACA,iBAAiB;AAAA,MACf,aAAa,CAAC;AAAA,MACd,YAAY,CAAC;AAAA,IACf;AAAA,IACA,cAAc;AAAA,MACZ,aAAa,CAAC;AAAA,MACd,YAAY,CAAC;AAAA,IACf;AAAA,EACF;AAEA,cAAY,IAAI,CAACA,aAAY;AAnD/B;AAoDI,aAAQ,KAAAA,SAAQ,aAAR,mBAAkB,MAAM;AAAA,MAC9B,KAAK;AACH,eAAO,WAAW,YAAY,KAAKA,SAAQ,SAAS,WAAW;AAC/D,eAAO,WAAW,WAAW,KAAKA,SAAQ,UAAU;AACpD;AAAA,MACF,KAAK;AACH,eAAO,WAAW,YAAY,KAAK,GAAGA,SAAQ,SAAS,WAAW;AAClE,eAAO,WAAW,WAAW,KAAKA,SAAQ,UAAU;AACpD;AAAA,MACF,KAAK;AACH,eAAO,gBAAgB,YAAY,KAAKA,SAAQ,SAAS,WAAW;AACpE,eAAO,gBAAgB,WAAW,KAAKA,SAAQ,UAAU;AACzD;AAAA,MACF,KAAK;AACH,eAAO,gBAAgB,YAAY;AAAA,UACjC,GAAGA,SAAQ,SAAS;AAAA,QACtB;AACA,eAAO,gBAAgB,WAAW,KAAKA,SAAQ,UAAU;AACzD;AAAA,MACF,KAAK;AACH,eAAO,aAAa,YAAY,KAAKA,SAAQ,SAAS,WAAW;AACjE,eAAO,aAAa,WAAW,KAAKA,SAAQ,UAAU;AACtD;AAAA,MACF,KAAK;AACH,eAAO,aAAa,YAAY,KAAK,GAAGA,SAAQ,SAAS,WAAW;AACpE,eAAO,aAAa,WAAW,KAAKA,SAAQ,UAAU;AACtD;AAAA,MACF;AACE;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACJ,OAAO,KAAK,MAAM,EAChB,OAAO,SAAU,KAAK;AACrB,aAAO,OAAO,GAAG,EAAE,YAAY;AAAA,IACjC,CAAC,EACA,KAAK,EACL,IAAI,SAAU,KAAK;AAClB,UAAI,WAAW,EAAE,MAAM,KAAK,aAAa,OAAO,GAAG,EAAE,YAAY;AAIjE,UAAI,aAAa,EAAE,qBAAqB,OAAO,GAAG,EAAE,WAAW;AAC/D,aAAO,QAAQ,UAAU,UAAU;AAAA,IACrC,CAAC;AAAA,EACL;AACF;AAGA,IAAO,uBAAQ;","names":["feature"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/combine",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.1.0-alpha.70+948cdafaf",
|
|
4
4
|
"description": "turf combine module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,9 +62,10 @@
|
|
|
62
62
|
"typescript": "^5.2.2"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@turf/helpers": "^7.0.
|
|
66
|
-
"@turf/meta": "^7.0.
|
|
65
|
+
"@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
|
|
66
|
+
"@turf/meta": "^7.1.0-alpha.70+948cdafaf",
|
|
67
|
+
"@types/geojson": "^7946.0.10",
|
|
67
68
|
"tslib": "^2.6.2"
|
|
68
69
|
},
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
|
|
70
71
|
}
|