@turf/combine 6.5.0 → 7.0.0-alpha.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/README.md +4 -4
- package/dist/es/index.js +7 -8
- package/dist/js/index.d.ts +3 -7
- package/dist/js/index.js +8 -9
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
Combines a [FeatureCollection][1] of [Point][2], [LineString][3], or [Polygon][4] features
|
|
8
8
|
into [MultiPoint][5], [MultiLineString][6], or [MultiPolygon][7] features.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Parameters
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
* `fc` **[FeatureCollection][8]<([Point][9] | [LineString][10] | [Polygon][11])>** a FeatureCollection of any type
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### Examples
|
|
15
15
|
|
|
16
16
|
```javascript
|
|
17
17
|
var fc = turf.featureCollection([
|
|
@@ -25,7 +25,7 @@ var combined = turf.combine(fc);
|
|
|
25
25
|
var addToMap = [combined]
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Returns **[FeatureCollection][8]
|
|
28
|
+
Returns **[FeatureCollection][8]<([MultiPoint][12] | [MultiLineString][13] | [MultiPolygon][14])>** a FeatureCollection of corresponding type to input
|
|
29
29
|
|
|
30
30
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
31
31
|
|
package/dist/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature, featureCollection
|
|
1
|
+
import { feature, featureCollection } from "@turf/helpers";
|
|
2
2
|
import { featureEach } from "@turf/meta";
|
|
3
3
|
/**
|
|
4
4
|
* Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features
|
|
@@ -33,16 +33,15 @@ function combine(fc) {
|
|
|
33
33
|
properties: [],
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
|
-
featureEach(fc,
|
|
37
|
-
var _a
|
|
38
|
-
|
|
39
|
-
switch ((_d = feature.geometry) === null || _d === void 0 ? void 0 : _d.type) {
|
|
36
|
+
featureEach(fc, (feature) => {
|
|
37
|
+
var _a;
|
|
38
|
+
switch ((_a = feature.geometry) === null || _a === void 0 ? void 0 : _a.type) {
|
|
40
39
|
case "Point":
|
|
41
40
|
groups.MultiPoint.coordinates.push(feature.geometry.coordinates);
|
|
42
41
|
groups.MultiPoint.properties.push(feature.properties);
|
|
43
42
|
break;
|
|
44
43
|
case "MultiPoint":
|
|
45
|
-
|
|
44
|
+
groups.MultiPoint.coordinates.push(...feature.geometry.coordinates);
|
|
46
45
|
groups.MultiPoint.properties.push(feature.properties);
|
|
47
46
|
break;
|
|
48
47
|
case "LineString":
|
|
@@ -50,7 +49,7 @@ function combine(fc) {
|
|
|
50
49
|
groups.MultiLineString.properties.push(feature.properties);
|
|
51
50
|
break;
|
|
52
51
|
case "MultiLineString":
|
|
53
|
-
|
|
52
|
+
groups.MultiLineString.coordinates.push(...feature.geometry.coordinates);
|
|
54
53
|
groups.MultiLineString.properties.push(feature.properties);
|
|
55
54
|
break;
|
|
56
55
|
case "Polygon":
|
|
@@ -58,7 +57,7 @@ function combine(fc) {
|
|
|
58
57
|
groups.MultiPolygon.properties.push(feature.properties);
|
|
59
58
|
break;
|
|
60
59
|
case "MultiPolygon":
|
|
61
|
-
|
|
60
|
+
groups.MultiPolygon.coordinates.push(...feature.geometry.coordinates);
|
|
62
61
|
groups.MultiPolygon.properties.push(feature.properties);
|
|
63
62
|
break;
|
|
64
63
|
default:
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MultiLineString, MultiPoint, MultiPolygon,
|
|
2
|
-
import { Point, LineString, Polygon, FeatureCollection } from "@turf/helpers";
|
|
1
|
+
import { GeoJsonProperties, FeatureCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from "geojson";
|
|
3
2
|
/**
|
|
4
3
|
* Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features
|
|
5
4
|
* into {@link MultiPoint}, {@link MultiLineString}, or {@link MultiPolygon} features.
|
|
@@ -18,10 +17,7 @@ import { Point, LineString, Polygon, FeatureCollection } from "@turf/helpers";
|
|
|
18
17
|
* //addToMap
|
|
19
18
|
* var addToMap = [combined]
|
|
20
19
|
*/
|
|
21
|
-
declare function combine(fc: FeatureCollection<Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon>): FeatureCollection<{
|
|
22
|
-
|
|
23
|
-
coordinates: number[][] | number[][][] | number[][][][];
|
|
24
|
-
}, {
|
|
25
|
-
collectedProperties: Properties[];
|
|
20
|
+
declare function combine(fc: FeatureCollection<Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon>): FeatureCollection<MultiPoint | MultiLineString | MultiPolygon, {
|
|
21
|
+
collectedProperties: GeoJsonProperties[];
|
|
26
22
|
}>;
|
|
27
23
|
export default combine;
|
package/dist/js/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const helpers_1 = require("@turf/helpers");
|
|
4
|
+
const meta_1 = require("@turf/meta");
|
|
5
5
|
/**
|
|
6
6
|
* Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features
|
|
7
7
|
* into {@link MultiPoint}, {@link MultiLineString}, or {@link MultiPolygon} features.
|
|
@@ -35,16 +35,15 @@ function combine(fc) {
|
|
|
35
35
|
properties: [],
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
|
-
meta_1.featureEach(fc,
|
|
39
|
-
var _a
|
|
40
|
-
|
|
41
|
-
switch ((_d = feature.geometry) === null || _d === void 0 ? void 0 : _d.type) {
|
|
38
|
+
meta_1.featureEach(fc, (feature) => {
|
|
39
|
+
var _a;
|
|
40
|
+
switch ((_a = feature.geometry) === null || _a === void 0 ? void 0 : _a.type) {
|
|
42
41
|
case "Point":
|
|
43
42
|
groups.MultiPoint.coordinates.push(feature.geometry.coordinates);
|
|
44
43
|
groups.MultiPoint.properties.push(feature.properties);
|
|
45
44
|
break;
|
|
46
45
|
case "MultiPoint":
|
|
47
|
-
|
|
46
|
+
groups.MultiPoint.coordinates.push(...feature.geometry.coordinates);
|
|
48
47
|
groups.MultiPoint.properties.push(feature.properties);
|
|
49
48
|
break;
|
|
50
49
|
case "LineString":
|
|
@@ -52,7 +51,7 @@ function combine(fc) {
|
|
|
52
51
|
groups.MultiLineString.properties.push(feature.properties);
|
|
53
52
|
break;
|
|
54
53
|
case "MultiLineString":
|
|
55
|
-
|
|
54
|
+
groups.MultiLineString.coordinates.push(...feature.geometry.coordinates);
|
|
56
55
|
groups.MultiLineString.properties.push(feature.properties);
|
|
57
56
|
break;
|
|
58
57
|
case "Polygon":
|
|
@@ -60,7 +59,7 @@ function combine(fc) {
|
|
|
60
59
|
groups.MultiPolygon.properties.push(feature.properties);
|
|
61
60
|
break;
|
|
62
61
|
case "MultiPolygon":
|
|
63
|
-
|
|
62
|
+
groups.MultiPolygon.coordinates.push(...feature.geometry.coordinates);
|
|
64
63
|
groups.MultiPolygon.properties.push(feature.properties);
|
|
65
64
|
break;
|
|
66
65
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/combine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
4
|
"description": "turf combine module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"exports": {
|
|
29
29
|
"./package.json": "./package.json",
|
|
30
30
|
".": {
|
|
31
|
+
"types": "./dist/js/index.d.ts",
|
|
31
32
|
"import": "./dist/es/index.js",
|
|
32
33
|
"require": "./dist/js/index.js"
|
|
33
34
|
}
|
|
@@ -38,26 +39,27 @@
|
|
|
38
39
|
"dist"
|
|
39
40
|
],
|
|
40
41
|
"scripts": {
|
|
41
|
-
"bench": "
|
|
42
|
+
"bench": "tsx bench.js",
|
|
42
43
|
"build": "npm-run-all build:*",
|
|
43
44
|
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
|
|
44
45
|
"build:js": "tsc",
|
|
45
|
-
"docs": "
|
|
46
|
+
"docs": "tsx ../../scripts/generate-readmes",
|
|
46
47
|
"test": "npm-run-all test:*",
|
|
47
|
-
"test:tape": "
|
|
48
|
+
"test:tape": "tsx test.js"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@types/tape": "*",
|
|
51
52
|
"benchmark": "*",
|
|
52
53
|
"npm-run-all": "*",
|
|
53
54
|
"tape": "*",
|
|
54
|
-
"ts-node": "*",
|
|
55
55
|
"tslint": "*",
|
|
56
|
+
"tsx": "*",
|
|
56
57
|
"typescript": "*"
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
|
-
"@turf/helpers": "^
|
|
60
|
-
"@turf/meta": "^
|
|
60
|
+
"@turf/helpers": "^7.0.0-alpha.1",
|
|
61
|
+
"@turf/meta": "^7.0.0-alpha.1",
|
|
62
|
+
"tslib": "^2.3.0"
|
|
61
63
|
},
|
|
62
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "cf7a0c507b017ca066acffd0ce23bda5b393fb5a"
|
|
63
65
|
}
|