@turf/concave 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 CHANGED
@@ -9,12 +9,12 @@ Internally, this uses [turf-tin][2] to generate geometries.
9
9
 
10
10
  ### Parameters
11
11
 
12
- * `points` **[FeatureCollection][3]<[Point][4]>** input points
13
- * `options` **[Object][5]** Optional parameters (optional, default `{}`)
12
+ * `points` **[FeatureCollection][3]<[Point][1]>** input points
13
+ * `options` **[Object][4]** Optional parameters (optional, default `{}`)
14
14
 
15
- * `options.maxEdge` **[number][6]** the length (in 'units') of an edge necessary for part of the
15
+ * `options.maxEdge` **[number][5]** the length (in 'units') of an edge necessary for part of the
16
16
  hull to become concave. (optional, default `Infinity`)
17
- * `options.units` **[string][7]** can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
17
+ * `options.units` **[string][6]** can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
18
18
 
19
19
  ### Examples
20
20
 
@@ -35,7 +35,7 @@ var hull = turf.concave(points, options);
35
35
  var addToMap = [points, hull]
36
36
  ```
37
37
 
38
- Returns **([Feature][8]<([Polygon][9] | [MultiPolygon][10])> | null)** a concave hull (null value is returned if unable to compute hull)
38
+ Returns **([Feature][7]<([Polygon][8] | [MultiPolygon][9])> | null)** a concave hull (null value is returned if unable to compute hull)
39
39
 
40
40
  [1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
41
41
 
@@ -43,19 +43,17 @@ Returns **([Feature][8]<([Polygon][9] | [MultiPolygon][10])> | null)** a concave
43
43
 
44
44
  [3]: https://tools.ietf.org/html/rfc7946#section-3.3
45
45
 
46
- [4]: https://tools.ietf.org/html/rfc7946#section-3.1.2
46
+ [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
47
47
 
48
- [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
48
+ [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
49
49
 
50
- [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
50
+ [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
51
51
 
52
- [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
52
+ [7]: https://tools.ietf.org/html/rfc7946#section-3.2
53
53
 
54
- [8]: https://tools.ietf.org/html/rfc7946#section-3.2
54
+ [8]: https://tools.ietf.org/html/rfc7946#section-3.1.6
55
55
 
56
- [9]: https://tools.ietf.org/html/rfc7946#section-3.1.6
57
-
58
- [10]: https://tools.ietf.org/html/rfc7946#section-3.1.7
56
+ [9]: https://tools.ietf.org/html/rfc7946#section-3.1.7
59
57
 
60
58
  <!-- 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. -->
61
59
 
@@ -1,7 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
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 _distance = require('@turf/distance');
6
3
  var _helpers = require('@turf/helpers');
7
4
  var _meta = require('@turf/meta');
@@ -61,11 +58,9 @@ function lineDissolve(geojson, options = {}) {
61
58
  );
62
59
  }
63
60
  }
64
- __name(lineDissolve, "lineDissolve");
65
61
  function coordId(coord) {
66
62
  return coord[0].toString() + "," + coord[1].toString();
67
63
  }
68
- __name(coordId, "coordId");
69
64
  function mergeLineStrings(a, b) {
70
65
  const coords1 = a.geometry.coordinates;
71
66
  const coords2 = b.geometry.coordinates;
@@ -87,7 +82,6 @@ function mergeLineStrings(a, b) {
87
82
  }
88
83
  return _helpers.lineString.call(void 0, coords);
89
84
  }
90
- __name(mergeLineStrings, "mergeLineStrings");
91
85
 
92
86
  // lib/turf-polygon-dissolve.ts
93
87
 
@@ -114,7 +108,6 @@ function polygonDissolve(geojson, options = {}) {
114
108
  const merged = _topojsonclient.merge.call(void 0, topo, topo.objects.geoms.geometries);
115
109
  return merged;
116
110
  }
117
- __name(polygonDissolve, "polygonDissolve");
118
111
 
119
112
  // lib/turf-dissolve.ts
120
113
  function dissolve(geojson, options = {}) {
@@ -146,7 +139,6 @@ function dissolve(geojson, options = {}) {
146
139
  throw new Error(type + " is not supported");
147
140
  }
148
141
  }
149
- __name(dissolve, "dissolve");
150
142
  function getHomogenousType(geojson) {
151
143
  const types = {};
152
144
  _meta.flattenEach.call(void 0, geojson, (feature2) => {
@@ -158,7 +150,6 @@ function getHomogenousType(geojson) {
158
150
  }
159
151
  return null;
160
152
  }
161
- __name(getHomogenousType, "getHomogenousType");
162
153
 
163
154
  // index.ts
164
155
  function concave(points, options = {}) {
@@ -184,7 +175,6 @@ function concave(points, options = {}) {
184
175
  }
185
176
  return _helpers.feature.call(void 0, dissolved);
186
177
  }
187
- __name(concave, "concave");
188
178
  function removeDuplicates(points) {
189
179
  const cleaned = [];
190
180
  const existing = {};
@@ -200,7 +190,6 @@ function removeDuplicates(points) {
200
190
  });
201
191
  return _helpers.featureCollection.call(void 0, cleaned);
202
192
  }
203
- __name(removeDuplicates, "removeDuplicates");
204
193
  var turf_concave_default = concave;
205
194
 
206
195
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../lib/turf-dissolve.ts","../../lib/turf-line-dissolve.ts","../../lib/turf-polygon-dissolve.ts"],"names":["clone","isObject","getType","flattenEach","feature"],"mappings":";;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,SAAS,yBAAyB;AAS3C,SAAS,mBAAmB;AAC5B,SAAS,WAAW;;;ACHpB,SAAS,SAAAA,cAAa;AACtB,SAAS,YAAAC,iBAAgB;AACzB,SAAS,WAAAC,gBAAe;AACxB,SAAS,eAAAC,oBAAmB;;;ACL5B,SAAS,aAAa;AACtB,SAAS,UAAU,YAAY,uBAAuB;AACtD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O,CAAC,aAAa;AACzD,UAAM,MAAM,SAAS,SAAS,YAAY,CAAC,EAAE,CAAC;AAC9C,UAAM,MAAM,SAAS,SAAS,YAAY,CAAC,EAAE,CAAC;AAC9C,UAAM,MAAM,SAAS,SAAS,YAAY,CAAC,EAAE,CAAC;AAC9C,UAAM,QAAQ,SAAS,KAAK,KAAK,OAAO;AACxC,UAAM,QAAQ,SAAS,KAAK,KAAK,OAAO;AACxC,UAAM,QAAQ,SAAS,KAAK,KAAK,OAAO;AACxC,WAAO,SAAS,WAAW,SAAS,WAAW,SAAS;AAAA,EAC1D,CAAC;AAED,MAAI,SAAS,SAAS,SAAS,GAAG;AAChC,WAAO;AAAA,EACT;AAGA,QAAM,YAAiB,SAAS,QAAQ;AAGxC,MAAI,UAAU,YAAY,WAAW,GAAG;AACtC,cAAU,cAAc,UAAU,YAAY,CAAC;AAC/C,cAAU,OAAO;AAAA,EACnB;AACA,SAAO,QAAQ,SAAS;AAC1B;AAlCS;AA2CT,SAAS,iBACP,QAC0B;AAC1B,QAAM,UAAiC,CAAC;AACxC,QAAM,WAAuC,CAAC;AAE9C,cAAY,QAAQ,CAAC,OAAO;AAC1B,QAAI,CAAC,GAAG,UAAU;AAChB;AAAA,IACF;AACA,UAAM,MAAM,GAAG,SAAS,YAAY,KAAK,GAAG;AAC5C,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAG,GAAG;AACxD,cAAQ,KAAK,EAAE;AACf,eAAS,GAAG,IAAI;AAAA,IAClB;AAAA,EACF,CAAC;AACD,SAAO,kBAAkB,OAAO;AAClC;AAjBS;AAoBT,IAAO,uBAAQ","sourcesContent":["import { distance } from \"@turf/distance\";\nimport { feature, featureCollection } from \"@turf/helpers\";\nimport {\n Feature,\n FeatureCollection,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { Units } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\nimport { tin } from \"@turf/tin\";\nimport { dissolve } from \"./lib/turf-dissolve.js\";\n\n/**\n * Takes a set of {@link Point|points} and returns a concave hull Polygon or MultiPolygon.\n * Internally, this uses [turf-tin](https://github.com/Turfjs/turf-tin) to generate geometries.\n *\n * @name concave\n * @param {FeatureCollection<Point>} points input points\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.maxEdge=Infinity] the length (in 'units') of an edge necessary for part of the\n * hull to become concave.\n * @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers\n * @returns {Feature<(Polygon|MultiPolygon)>|null} a concave hull (null value is returned if unable to compute hull)\n * @example\n * var points = turf.featureCollection([\n * turf.point([-63.601226, 44.642643]),\n * turf.point([-63.591442, 44.651436]),\n * turf.point([-63.580799, 44.648749]),\n * turf.point([-63.573589, 44.641788]),\n * turf.point([-63.587665, 44.64533]),\n * turf.point([-63.595218, 44.64765])\n * ]);\n * var options = {units: 'miles', maxEdge: 1};\n *\n * var hull = turf.concave(points, options);\n *\n * //addToMap\n * var addToMap = [points, hull]\n */\nfunction concave(\n points: FeatureCollection<Point>,\n options: { maxEdge?: number; units?: Units } = {}\n): Feature<Polygon | MultiPolygon> | null {\n const maxEdge = options.maxEdge || Infinity;\n\n const cleaned = removeDuplicates(points);\n\n const tinPolys = tin(cleaned);\n // calculate length of all edges and area of all triangles\n // and remove triangles that fail the max length test\n tinPolys.features = tinPolys.features.filter((triangle) => {\n const pt1 = triangle.geometry.coordinates[0][0];\n const pt2 = triangle.geometry.coordinates[0][1];\n const pt3 = triangle.geometry.coordinates[0][2];\n const dist1 = distance(pt1, pt2, options);\n const dist2 = distance(pt2, pt3, options);\n const dist3 = distance(pt1, pt3, options);\n return dist1 <= maxEdge && dist2 <= maxEdge && dist3 <= maxEdge;\n });\n\n if (tinPolys.features.length < 1) {\n return null;\n }\n\n // merge the adjacent triangles\n const dissolved: any = dissolve(tinPolys);\n\n // geojson-dissolve always returns a MultiPolygon\n if (dissolved.coordinates.length === 1) {\n dissolved.coordinates = dissolved.coordinates[0];\n dissolved.type = \"Polygon\";\n }\n return feature(dissolved);\n}\n\n/**\n * Removes duplicated points in a collection returning a new collection\n *\n * @private\n * @param {FeatureCollection<Point>} points to be cleaned\n * @returns {FeatureCollection<Point>} cleaned set of points\n */\nfunction removeDuplicates(\n points: FeatureCollection<Point>\n): FeatureCollection<Point> {\n const cleaned: Array<Feature<Point>> = [];\n const existing: { [key: string]: boolean } = {};\n\n featureEach(points, (pt) => {\n if (!pt.geometry) {\n return;\n }\n const key = pt.geometry.coordinates.join(\"-\");\n if (!Object.prototype.hasOwnProperty.call(existing, key)) {\n cleaned.push(pt);\n existing[key] = true;\n }\n });\n return featureCollection(cleaned);\n}\n\nexport { concave };\nexport default concave;\n","import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPolygon,\n Polygon,\n} from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { isObject } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { flattenEach } from \"@turf/meta\";\nimport { lineDissolve } from \"./turf-line-dissolve.js\";\nimport { polygonDissolve } from \"./turf-polygon-dissolve.js\";\n\n/**\n * Transform function: attempts to dissolve geojson objects where possible\n * [GeoJSON] -> GeoJSON geometry\n *\n * @private\n * @param {FeatureCollection<LineString|MultiLineString|Polygon|MultiPolygon>} geojson Features to dissolved\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<MultiLineString|MultiPolygon>} Dissolved Features\n */\nfunction dissolve(\n geojson: FeatureCollection<\n LineString | MultiLineString | Polygon | MultiPolygon\n >,\n options: {\n mutate?: boolean;\n } = {}\n): Feature<LineString | MultiLineString | Polygon | MultiPolygon> | null {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) {\n throw new Error(\"options is invalid\");\n }\n const mutate = options.mutate;\n\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n // Topojson modifies in place, so we need to deep clone first\n if (mutate === false || mutate === undefined) {\n geojson = clone(geojson);\n }\n\n // Assert homogenity\n const type = getHomogenousType(geojson);\n if (!type) {\n throw new Error(\"geojson must be homogenous\");\n }\n\n // Data => Typescript hack\n const data: any = geojson;\n\n switch (type) {\n case \"LineString\":\n return lineDissolve(data, options);\n case \"Polygon\":\n return polygonDissolve(data, options);\n default:\n throw new Error(type + \" is not supported\");\n }\n}\n\n/**\n * Checks if GeoJSON is Homogenous\n *\n * @private\n * @param {GeoJSON} geojson GeoJSON\n * @returns {string|null} Homogenous type or null if multiple types\n */\nfunction getHomogenousType(geojson: any) {\n const types: { [key: string]: boolean } = {};\n flattenEach(geojson, (feature) => {\n types[feature.geometry.type] = true;\n });\n const keys = Object.keys(types);\n if (keys.length === 1) {\n return keys[0];\n }\n return null;\n}\n\nexport { dissolve };\nexport default dissolve;\n","import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n} from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { isObject, lineString, multiLineString } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { lineReduce } from \"@turf/meta\";\n\n/**\n * Merges all connected (non-forking, non-junctioning) line strings into single lineStrings.\n * [LineString] -> LineString|MultiLineString\n *\n * @param {FeatureCollection<LineString|MultiLineString>} geojson Lines to dissolve\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<LineString|MultiLineString>} Dissolved lines\n */\nfunction lineDissolve(\n geojson: FeatureCollection<LineString | MultiLineString>,\n options: { mutate?: boolean } = {}\n): Feature<LineString | MultiLineString> | null {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) {\n throw new Error(\"options is invalid\");\n }\n const mutate = options.mutate;\n\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n if (mutate === false || mutate === undefined) {\n geojson = clone(geojson);\n }\n\n const result: any[] = [];\n const lastLine = lineReduce(\n geojson,\n (previousLine: any, currentLine: any) => {\n // Attempt to merge this LineString with the other LineStrings, updating\n // the reference as it is merged with others and grows.\n const merged = mergeLineStrings(previousLine, currentLine);\n\n // Accumulate the merged LineString\n if (merged) {\n return merged;\n // Put the unmerged LineString back into the list\n } else {\n result.push(previousLine);\n return currentLine;\n }\n }\n );\n // Append the last line\n if (lastLine) {\n result.push(lastLine);\n }\n\n // Return null if no lines were dissolved\n if (!result.length) {\n return null;\n // Return LineString if only 1 line was dissolved\n } else if (result.length === 1) {\n return result[0];\n // Return MultiLineString if multiple lines were dissolved with gaps\n } else {\n return multiLineString(\n result.map((line) => {\n return line.coordinates;\n })\n );\n }\n}\n\n// [Number, Number] -> String\nfunction coordId(coord: number[]) {\n return coord[0].toString() + \",\" + coord[1].toString();\n}\n\n/**\n * LineString, LineString -> LineString\n *\n * @private\n * @param {Feature<LineString>} a line1\n * @param {Feature<LineString>} b line2\n * @returns {Feature<LineString>|null} Merged LineString\n */\nfunction mergeLineStrings(a: Feature<LineString>, b: Feature<LineString>) {\n const coords1 = a.geometry.coordinates;\n const coords2 = b.geometry.coordinates;\n\n const s1 = coordId(coords1[0]);\n const e1 = coordId(coords1[coords1.length - 1]);\n const s2 = coordId(coords2[0]);\n const e2 = coordId(coords2[coords2.length - 1]);\n\n // TODO: handle case where more than one of these is true!\n let coords;\n if (s1 === e2) {\n coords = coords2.concat(coords1.slice(1));\n } else if (s2 === e1) {\n coords = coords1.concat(coords2.slice(1));\n } else if (s1 === s2) {\n coords = coords1.slice(1).reverse().concat(coords2);\n } else if (e1 === e2) {\n coords = coords1.concat(coords2.reverse().slice(1));\n } else {\n return null;\n }\n\n return lineString(coords);\n}\n\nexport { lineDissolve };\nexport default lineDissolve;\n","import { Feature, FeatureCollection, MultiPolygon, Polygon } from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { geometryCollection } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { flattenEach } from \"@turf/meta\";\nimport { merge } from \"topojson-client\";\nimport { topology } from \"topojson-server\";\n\n/**\n * Dissolves all overlapping (Multi)Polygon\n *\n * @param {FeatureCollection<Polygon|MultiPolygon>} geojson Polygons to dissolve\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<Polygon|MultiPolygon>} Dissolved Polygons\n */\nfunction polygonDissolve(\n geojson: FeatureCollection<Polygon | MultiPolygon>,\n options: { mutate?: boolean } = {}\n): Feature<Polygon | MultiPolygon> | null {\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n // Topojson modifies in place, so we need to deep clone first\n if (options.mutate === false || options.mutate === undefined) {\n geojson = clone(geojson);\n }\n\n const geoms: any[] = [];\n flattenEach(geojson, (feature) => {\n geoms.push(feature.geometry);\n });\n const topo: any = topology({ geoms: geometryCollection(geoms).geometry });\n const merged: any = merge(topo, topo.objects.geoms.geometries);\n return merged;\n}\n\nexport { polygonDissolve };\nexport default polygonDissolve;\n"]}
1
+ {"version":3,"sources":["../../index.ts","../../lib/turf-dissolve.ts","../../lib/turf-line-dissolve.ts","../../lib/turf-polygon-dissolve.ts"],"names":["clone","isObject","getType","flattenEach","feature"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,SAAS,yBAAyB;AAS3C,SAAS,mBAAmB;AAC5B,SAAS,WAAW;;;ACHpB,SAAS,SAAAA,cAAa;AACtB,SAAS,YAAAC,iBAAgB;AACzB,SAAS,WAAAC,gBAAe;AACxB,SAAS,eAAAC,oBAAmB;;;ACL5B,SAAS,aAAa;AACtB,SAAS,UAAU,YAAY,uBAAuB;AACtD,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAW3B,SAAS,aACP,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,SAAS,YAAY,CAAC,EAAE,CAAC;AAC9C,UAAM,MAAM,SAAS,SAAS,YAAY,CAAC,EAAE,CAAC;AAC9C,UAAM,QAAQ,SAAS,KAAK,KAAK,OAAO;AACxC,UAAM,QAAQ,SAAS,KAAK,KAAK,OAAO;AACxC,UAAM,QAAQ,SAAS,KAAK,KAAK,OAAO;AACxC,WAAO,SAAS,WAAW,SAAS,WAAW,SAAS;AAAA,EAC1D,CAAC;AAED,MAAI,SAAS,SAAS,SAAS,GAAG;AAChC,WAAO;AAAA,EACT;AAGA,QAAM,YAAiB,SAAS,QAAQ;AAGxC,MAAI,UAAU,YAAY,WAAW,GAAG;AACtC,cAAU,cAAc,UAAU,YAAY,CAAC;AAC/C,cAAU,OAAO;AAAA,EACnB;AACA,SAAO,QAAQ,SAAS;AAC1B;AASA,SAAS,iBACP,QAC0B;AAC1B,QAAM,UAAiC,CAAC;AACxC,QAAM,WAAuC,CAAC;AAE9C,cAAY,QAAQ,CAAC,OAAO;AAC1B,QAAI,CAAC,GAAG,UAAU;AAChB;AAAA,IACF;AACA,UAAM,MAAM,GAAG,SAAS,YAAY,KAAK,GAAG;AAC5C,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAG,GAAG;AACxD,cAAQ,KAAK,EAAE;AACf,eAAS,GAAG,IAAI;AAAA,IAClB;AAAA,EACF,CAAC;AACD,SAAO,kBAAkB,OAAO;AAClC;AAGA,IAAO,uBAAQ","sourcesContent":["import { distance } from \"@turf/distance\";\nimport { feature, featureCollection } from \"@turf/helpers\";\nimport {\n Feature,\n FeatureCollection,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { Units } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\nimport { tin } from \"@turf/tin\";\nimport { dissolve } from \"./lib/turf-dissolve.js\";\n\n/**\n * Takes a set of {@link Point|points} and returns a concave hull Polygon or MultiPolygon.\n * Internally, this uses [turf-tin](https://github.com/Turfjs/turf-tin) to generate geometries.\n *\n * @name concave\n * @param {FeatureCollection<Point>} points input points\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.maxEdge=Infinity] the length (in 'units') of an edge necessary for part of the\n * hull to become concave.\n * @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers\n * @returns {Feature<(Polygon|MultiPolygon)>|null} a concave hull (null value is returned if unable to compute hull)\n * @example\n * var points = turf.featureCollection([\n * turf.point([-63.601226, 44.642643]),\n * turf.point([-63.591442, 44.651436]),\n * turf.point([-63.580799, 44.648749]),\n * turf.point([-63.573589, 44.641788]),\n * turf.point([-63.587665, 44.64533]),\n * turf.point([-63.595218, 44.64765])\n * ]);\n * var options = {units: 'miles', maxEdge: 1};\n *\n * var hull = turf.concave(points, options);\n *\n * //addToMap\n * var addToMap = [points, hull]\n */\nfunction concave(\n points: FeatureCollection<Point>,\n options: { maxEdge?: number; units?: Units } = {}\n): Feature<Polygon | MultiPolygon> | null {\n const maxEdge = options.maxEdge || Infinity;\n\n const cleaned = removeDuplicates(points);\n\n const tinPolys = tin(cleaned);\n // calculate length of all edges and area of all triangles\n // and remove triangles that fail the max length test\n tinPolys.features = tinPolys.features.filter((triangle) => {\n const pt1 = triangle.geometry.coordinates[0][0];\n const pt2 = triangle.geometry.coordinates[0][1];\n const pt3 = triangle.geometry.coordinates[0][2];\n const dist1 = distance(pt1, pt2, options);\n const dist2 = distance(pt2, pt3, options);\n const dist3 = distance(pt1, pt3, options);\n return dist1 <= maxEdge && dist2 <= maxEdge && dist3 <= maxEdge;\n });\n\n if (tinPolys.features.length < 1) {\n return null;\n }\n\n // merge the adjacent triangles\n const dissolved: any = dissolve(tinPolys);\n\n // geojson-dissolve always returns a MultiPolygon\n if (dissolved.coordinates.length === 1) {\n dissolved.coordinates = dissolved.coordinates[0];\n dissolved.type = \"Polygon\";\n }\n return feature(dissolved);\n}\n\n/**\n * Removes duplicated points in a collection returning a new collection\n *\n * @private\n * @param {FeatureCollection<Point>} points to be cleaned\n * @returns {FeatureCollection<Point>} cleaned set of points\n */\nfunction removeDuplicates(\n points: FeatureCollection<Point>\n): FeatureCollection<Point> {\n const cleaned: Array<Feature<Point>> = [];\n const existing: { [key: string]: boolean } = {};\n\n featureEach(points, (pt) => {\n if (!pt.geometry) {\n return;\n }\n const key = pt.geometry.coordinates.join(\"-\");\n if (!Object.prototype.hasOwnProperty.call(existing, key)) {\n cleaned.push(pt);\n existing[key] = true;\n }\n });\n return featureCollection(cleaned);\n}\n\nexport { concave };\nexport default concave;\n","import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPolygon,\n Polygon,\n} from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { isObject } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { flattenEach } from \"@turf/meta\";\nimport { lineDissolve } from \"./turf-line-dissolve.js\";\nimport { polygonDissolve } from \"./turf-polygon-dissolve.js\";\n\n/**\n * Transform function: attempts to dissolve geojson objects where possible\n * [GeoJSON] -> GeoJSON geometry\n *\n * @private\n * @param {FeatureCollection<LineString|MultiLineString|Polygon|MultiPolygon>} geojson Features to dissolved\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<MultiLineString|MultiPolygon>} Dissolved Features\n */\nfunction dissolve(\n geojson: FeatureCollection<\n LineString | MultiLineString | Polygon | MultiPolygon\n >,\n options: {\n mutate?: boolean;\n } = {}\n): Feature<LineString | MultiLineString | Polygon | MultiPolygon> | null {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) {\n throw new Error(\"options is invalid\");\n }\n const mutate = options.mutate;\n\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n // Topojson modifies in place, so we need to deep clone first\n if (mutate === false || mutate === undefined) {\n geojson = clone(geojson);\n }\n\n // Assert homogenity\n const type = getHomogenousType(geojson);\n if (!type) {\n throw new Error(\"geojson must be homogenous\");\n }\n\n // Data => Typescript hack\n const data: any = geojson;\n\n switch (type) {\n case \"LineString\":\n return lineDissolve(data, options);\n case \"Polygon\":\n return polygonDissolve(data, options);\n default:\n throw new Error(type + \" is not supported\");\n }\n}\n\n/**\n * Checks if GeoJSON is Homogenous\n *\n * @private\n * @param {GeoJSON} geojson GeoJSON\n * @returns {string|null} Homogenous type or null if multiple types\n */\nfunction getHomogenousType(geojson: any) {\n const types: { [key: string]: boolean } = {};\n flattenEach(geojson, (feature) => {\n types[feature.geometry.type] = true;\n });\n const keys = Object.keys(types);\n if (keys.length === 1) {\n return keys[0];\n }\n return null;\n}\n\nexport { dissolve };\nexport default dissolve;\n","import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n} from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { isObject, lineString, multiLineString } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { lineReduce } from \"@turf/meta\";\n\n/**\n * Merges all connected (non-forking, non-junctioning) line strings into single lineStrings.\n * [LineString] -> LineString|MultiLineString\n *\n * @param {FeatureCollection<LineString|MultiLineString>} geojson Lines to dissolve\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<LineString|MultiLineString>} Dissolved lines\n */\nfunction lineDissolve(\n geojson: FeatureCollection<LineString | MultiLineString>,\n options: { mutate?: boolean } = {}\n): Feature<LineString | MultiLineString> | null {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) {\n throw new Error(\"options is invalid\");\n }\n const mutate = options.mutate;\n\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n if (mutate === false || mutate === undefined) {\n geojson = clone(geojson);\n }\n\n const result: any[] = [];\n const lastLine = lineReduce(\n geojson,\n (previousLine: any, currentLine: any) => {\n // Attempt to merge this LineString with the other LineStrings, updating\n // the reference as it is merged with others and grows.\n const merged = mergeLineStrings(previousLine, currentLine);\n\n // Accumulate the merged LineString\n if (merged) {\n return merged;\n // Put the unmerged LineString back into the list\n } else {\n result.push(previousLine);\n return currentLine;\n }\n }\n );\n // Append the last line\n if (lastLine) {\n result.push(lastLine);\n }\n\n // Return null if no lines were dissolved\n if (!result.length) {\n return null;\n // Return LineString if only 1 line was dissolved\n } else if (result.length === 1) {\n return result[0];\n // Return MultiLineString if multiple lines were dissolved with gaps\n } else {\n return multiLineString(\n result.map((line) => {\n return line.coordinates;\n })\n );\n }\n}\n\n// [Number, Number] -> String\nfunction coordId(coord: number[]) {\n return coord[0].toString() + \",\" + coord[1].toString();\n}\n\n/**\n * LineString, LineString -> LineString\n *\n * @private\n * @param {Feature<LineString>} a line1\n * @param {Feature<LineString>} b line2\n * @returns {Feature<LineString>|null} Merged LineString\n */\nfunction mergeLineStrings(a: Feature<LineString>, b: Feature<LineString>) {\n const coords1 = a.geometry.coordinates;\n const coords2 = b.geometry.coordinates;\n\n const s1 = coordId(coords1[0]);\n const e1 = coordId(coords1[coords1.length - 1]);\n const s2 = coordId(coords2[0]);\n const e2 = coordId(coords2[coords2.length - 1]);\n\n // TODO: handle case where more than one of these is true!\n let coords;\n if (s1 === e2) {\n coords = coords2.concat(coords1.slice(1));\n } else if (s2 === e1) {\n coords = coords1.concat(coords2.slice(1));\n } else if (s1 === s2) {\n coords = coords1.slice(1).reverse().concat(coords2);\n } else if (e1 === e2) {\n coords = coords1.concat(coords2.reverse().slice(1));\n } else {\n return null;\n }\n\n return lineString(coords);\n}\n\nexport { lineDissolve };\nexport default lineDissolve;\n","import { Feature, FeatureCollection, MultiPolygon, Polygon } from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { geometryCollection } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { flattenEach } from \"@turf/meta\";\nimport { merge } from \"topojson-client\";\nimport { topology } from \"topojson-server\";\n\n/**\n * Dissolves all overlapping (Multi)Polygon\n *\n * @param {FeatureCollection<Polygon|MultiPolygon>} geojson Polygons to dissolve\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<Polygon|MultiPolygon>} Dissolved Polygons\n */\nfunction polygonDissolve(\n geojson: FeatureCollection<Polygon | MultiPolygon>,\n options: { mutate?: boolean } = {}\n): Feature<Polygon | MultiPolygon> | null {\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n // Topojson modifies in place, so we need to deep clone first\n if (options.mutate === false || options.mutate === undefined) {\n geojson = clone(geojson);\n }\n\n const geoms: any[] = [];\n flattenEach(geojson, (feature) => {\n geoms.push(feature.geometry);\n });\n const topo: any = topology({ geoms: geometryCollection(geoms).geometry });\n const merged: any = merge(topo, topo.objects.geoms.geometries);\n return merged;\n}\n\nexport { polygonDissolve };\nexport default polygonDissolve;\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 { distance } from "@turf/distance";
6
3
  import { feature, featureCollection } from "@turf/helpers";
@@ -61,11 +58,9 @@ function lineDissolve(geojson, options = {}) {
61
58
  );
62
59
  }
63
60
  }
64
- __name(lineDissolve, "lineDissolve");
65
61
  function coordId(coord) {
66
62
  return coord[0].toString() + "," + coord[1].toString();
67
63
  }
68
- __name(coordId, "coordId");
69
64
  function mergeLineStrings(a, b) {
70
65
  const coords1 = a.geometry.coordinates;
71
66
  const coords2 = b.geometry.coordinates;
@@ -87,7 +82,6 @@ function mergeLineStrings(a, b) {
87
82
  }
88
83
  return lineString(coords);
89
84
  }
90
- __name(mergeLineStrings, "mergeLineStrings");
91
85
 
92
86
  // lib/turf-polygon-dissolve.ts
93
87
  import { clone as clone2 } from "@turf/clone";
@@ -114,7 +108,6 @@ function polygonDissolve(geojson, options = {}) {
114
108
  const merged = merge(topo, topo.objects.geoms.geometries);
115
109
  return merged;
116
110
  }
117
- __name(polygonDissolve, "polygonDissolve");
118
111
 
119
112
  // lib/turf-dissolve.ts
120
113
  function dissolve(geojson, options = {}) {
@@ -146,7 +139,6 @@ function dissolve(geojson, options = {}) {
146
139
  throw new Error(type + " is not supported");
147
140
  }
148
141
  }
149
- __name(dissolve, "dissolve");
150
142
  function getHomogenousType(geojson) {
151
143
  const types = {};
152
144
  flattenEach2(geojson, (feature2) => {
@@ -158,7 +150,6 @@ function getHomogenousType(geojson) {
158
150
  }
159
151
  return null;
160
152
  }
161
- __name(getHomogenousType, "getHomogenousType");
162
153
 
163
154
  // index.ts
164
155
  function concave(points, options = {}) {
@@ -184,7 +175,6 @@ function concave(points, options = {}) {
184
175
  }
185
176
  return feature(dissolved);
186
177
  }
187
- __name(concave, "concave");
188
178
  function removeDuplicates(points) {
189
179
  const cleaned = [];
190
180
  const existing = {};
@@ -200,7 +190,6 @@ function removeDuplicates(points) {
200
190
  });
201
191
  return featureCollection(cleaned);
202
192
  }
203
- __name(removeDuplicates, "removeDuplicates");
204
193
  var turf_concave_default = concave;
205
194
  export {
206
195
  concave,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../lib/turf-dissolve.ts","../../lib/turf-line-dissolve.ts","../../lib/turf-polygon-dissolve.ts"],"sourcesContent":["import { distance } from \"@turf/distance\";\nimport { feature, featureCollection } from \"@turf/helpers\";\nimport {\n Feature,\n FeatureCollection,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { Units } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\nimport { tin } from \"@turf/tin\";\nimport { dissolve } from \"./lib/turf-dissolve.js\";\n\n/**\n * Takes a set of {@link Point|points} and returns a concave hull Polygon or MultiPolygon.\n * Internally, this uses [turf-tin](https://github.com/Turfjs/turf-tin) to generate geometries.\n *\n * @name concave\n * @param {FeatureCollection<Point>} points input points\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.maxEdge=Infinity] the length (in 'units') of an edge necessary for part of the\n * hull to become concave.\n * @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers\n * @returns {Feature<(Polygon|MultiPolygon)>|null} a concave hull (null value is returned if unable to compute hull)\n * @example\n * var points = turf.featureCollection([\n * turf.point([-63.601226, 44.642643]),\n * turf.point([-63.591442, 44.651436]),\n * turf.point([-63.580799, 44.648749]),\n * turf.point([-63.573589, 44.641788]),\n * turf.point([-63.587665, 44.64533]),\n * turf.point([-63.595218, 44.64765])\n * ]);\n * var options = {units: 'miles', maxEdge: 1};\n *\n * var hull = turf.concave(points, options);\n *\n * //addToMap\n * var addToMap = [points, hull]\n */\nfunction concave(\n points: FeatureCollection<Point>,\n options: { maxEdge?: number; units?: Units } = {}\n): Feature<Polygon | MultiPolygon> | null {\n const maxEdge = options.maxEdge || Infinity;\n\n const cleaned = removeDuplicates(points);\n\n const tinPolys = tin(cleaned);\n // calculate length of all edges and area of all triangles\n // and remove triangles that fail the max length test\n tinPolys.features = tinPolys.features.filter((triangle) => {\n const pt1 = triangle.geometry.coordinates[0][0];\n const pt2 = triangle.geometry.coordinates[0][1];\n const pt3 = triangle.geometry.coordinates[0][2];\n const dist1 = distance(pt1, pt2, options);\n const dist2 = distance(pt2, pt3, options);\n const dist3 = distance(pt1, pt3, options);\n return dist1 <= maxEdge && dist2 <= maxEdge && dist3 <= maxEdge;\n });\n\n if (tinPolys.features.length < 1) {\n return null;\n }\n\n // merge the adjacent triangles\n const dissolved: any = dissolve(tinPolys);\n\n // geojson-dissolve always returns a MultiPolygon\n if (dissolved.coordinates.length === 1) {\n dissolved.coordinates = dissolved.coordinates[0];\n dissolved.type = \"Polygon\";\n }\n return feature(dissolved);\n}\n\n/**\n * Removes duplicated points in a collection returning a new collection\n *\n * @private\n * @param {FeatureCollection<Point>} points to be cleaned\n * @returns {FeatureCollection<Point>} cleaned set of points\n */\nfunction removeDuplicates(\n points: FeatureCollection<Point>\n): FeatureCollection<Point> {\n const cleaned: Array<Feature<Point>> = [];\n const existing: { [key: string]: boolean } = {};\n\n featureEach(points, (pt) => {\n if (!pt.geometry) {\n return;\n }\n const key = pt.geometry.coordinates.join(\"-\");\n if (!Object.prototype.hasOwnProperty.call(existing, key)) {\n cleaned.push(pt);\n existing[key] = true;\n }\n });\n return featureCollection(cleaned);\n}\n\nexport { concave };\nexport default concave;\n","import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPolygon,\n Polygon,\n} from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { isObject } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { flattenEach } from \"@turf/meta\";\nimport { lineDissolve } from \"./turf-line-dissolve.js\";\nimport { polygonDissolve } from \"./turf-polygon-dissolve.js\";\n\n/**\n * Transform function: attempts to dissolve geojson objects where possible\n * [GeoJSON] -> GeoJSON geometry\n *\n * @private\n * @param {FeatureCollection<LineString|MultiLineString|Polygon|MultiPolygon>} geojson Features to dissolved\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<MultiLineString|MultiPolygon>} Dissolved Features\n */\nfunction dissolve(\n geojson: FeatureCollection<\n LineString | MultiLineString | Polygon | MultiPolygon\n >,\n options: {\n mutate?: boolean;\n } = {}\n): Feature<LineString | MultiLineString | Polygon | MultiPolygon> | null {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) {\n throw new Error(\"options is invalid\");\n }\n const mutate = options.mutate;\n\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n // Topojson modifies in place, so we need to deep clone first\n if (mutate === false || mutate === undefined) {\n geojson = clone(geojson);\n }\n\n // Assert homogenity\n const type = getHomogenousType(geojson);\n if (!type) {\n throw new Error(\"geojson must be homogenous\");\n }\n\n // Data => Typescript hack\n const data: any = geojson;\n\n switch (type) {\n case \"LineString\":\n return lineDissolve(data, options);\n case \"Polygon\":\n return polygonDissolve(data, options);\n default:\n throw new Error(type + \" is not supported\");\n }\n}\n\n/**\n * Checks if GeoJSON is Homogenous\n *\n * @private\n * @param {GeoJSON} geojson GeoJSON\n * @returns {string|null} Homogenous type or null if multiple types\n */\nfunction getHomogenousType(geojson: any) {\n const types: { [key: string]: boolean } = {};\n flattenEach(geojson, (feature) => {\n types[feature.geometry.type] = true;\n });\n const keys = Object.keys(types);\n if (keys.length === 1) {\n return keys[0];\n }\n return null;\n}\n\nexport { dissolve };\nexport default dissolve;\n","import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n} from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { isObject, lineString, multiLineString } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { lineReduce } from \"@turf/meta\";\n\n/**\n * Merges all connected (non-forking, non-junctioning) line strings into single lineStrings.\n * [LineString] -> LineString|MultiLineString\n *\n * @param {FeatureCollection<LineString|MultiLineString>} geojson Lines to dissolve\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<LineString|MultiLineString>} Dissolved lines\n */\nfunction lineDissolve(\n geojson: FeatureCollection<LineString | MultiLineString>,\n options: { mutate?: boolean } = {}\n): Feature<LineString | MultiLineString> | null {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) {\n throw new Error(\"options is invalid\");\n }\n const mutate = options.mutate;\n\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n if (mutate === false || mutate === undefined) {\n geojson = clone(geojson);\n }\n\n const result: any[] = [];\n const lastLine = lineReduce(\n geojson,\n (previousLine: any, currentLine: any) => {\n // Attempt to merge this LineString with the other LineStrings, updating\n // the reference as it is merged with others and grows.\n const merged = mergeLineStrings(previousLine, currentLine);\n\n // Accumulate the merged LineString\n if (merged) {\n return merged;\n // Put the unmerged LineString back into the list\n } else {\n result.push(previousLine);\n return currentLine;\n }\n }\n );\n // Append the last line\n if (lastLine) {\n result.push(lastLine);\n }\n\n // Return null if no lines were dissolved\n if (!result.length) {\n return null;\n // Return LineString if only 1 line was dissolved\n } else if (result.length === 1) {\n return result[0];\n // Return MultiLineString if multiple lines were dissolved with gaps\n } else {\n return multiLineString(\n result.map((line) => {\n return line.coordinates;\n })\n );\n }\n}\n\n// [Number, Number] -> String\nfunction coordId(coord: number[]) {\n return coord[0].toString() + \",\" + coord[1].toString();\n}\n\n/**\n * LineString, LineString -> LineString\n *\n * @private\n * @param {Feature<LineString>} a line1\n * @param {Feature<LineString>} b line2\n * @returns {Feature<LineString>|null} Merged LineString\n */\nfunction mergeLineStrings(a: Feature<LineString>, b: Feature<LineString>) {\n const coords1 = a.geometry.coordinates;\n const coords2 = b.geometry.coordinates;\n\n const s1 = coordId(coords1[0]);\n const e1 = coordId(coords1[coords1.length - 1]);\n const s2 = coordId(coords2[0]);\n const e2 = coordId(coords2[coords2.length - 1]);\n\n // TODO: handle case where more than one of these is true!\n let coords;\n if (s1 === e2) {\n coords = coords2.concat(coords1.slice(1));\n } else if (s2 === e1) {\n coords = coords1.concat(coords2.slice(1));\n } else if (s1 === s2) {\n coords = coords1.slice(1).reverse().concat(coords2);\n } else if (e1 === e2) {\n coords = coords1.concat(coords2.reverse().slice(1));\n } else {\n return null;\n }\n\n return lineString(coords);\n}\n\nexport { lineDissolve };\nexport default lineDissolve;\n","import { Feature, FeatureCollection, MultiPolygon, Polygon } from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { geometryCollection } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { flattenEach } from \"@turf/meta\";\nimport { merge } from \"topojson-client\";\nimport { topology } from \"topojson-server\";\n\n/**\n * Dissolves all overlapping (Multi)Polygon\n *\n * @param {FeatureCollection<Polygon|MultiPolygon>} geojson Polygons to dissolve\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<Polygon|MultiPolygon>} Dissolved Polygons\n */\nfunction polygonDissolve(\n geojson: FeatureCollection<Polygon | MultiPolygon>,\n options: { mutate?: boolean } = {}\n): Feature<Polygon | MultiPolygon> | null {\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n // Topojson modifies in place, so we need to deep clone first\n if (options.mutate === false || options.mutate === undefined) {\n geojson = clone(geojson);\n }\n\n const geoms: any[] = [];\n flattenEach(geojson, (feature) => {\n geoms.push(feature.geometry);\n });\n const topo: any = topology({ geoms: geometryCollection(geoms).geometry });\n const merged: any = merge(topo, topo.objects.geoms.geometries);\n return merged;\n}\n\nexport { polygonDissolve };\nexport default polygonDissolve;\n"],"mappings":";;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,SAAS,yBAAyB;AAS3C,SAAS,mBAAmB;AAC5B,SAAS,WAAW;;;ACHpB,SAAS,SAAAA,cAAa;AACtB,SAAS,YAAAC,iBAAgB;AACzB,SAAS,WAAAC,gBAAe;AACxB,SAAS,eAAAC,oBAAmB;;;ACL5B,SAAS,aAAa;AACtB,SAAS,UAAU,YAAY,uBAAuB;AACtD,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAW3B,SAAS,aACP,SACA,UAAgC,CAAC,GACa;AAE9C,YAAU,WAAW,CAAC;AACtB,MAAI,CAAC,SAAS,OAAO,GAAG;AACtB,UAAM,IAAI,MAAM,oBAAoB;AAAA,EACtC;AACA,QAAM,SAAS,QAAQ;AAGvB,MAAI,QAAQ,OAAO,MAAM,qBAAqB;AAC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KAAK,KAAK,OAAO;AACxC,UAAM,QAAQ,SAAS,KAAK,KAAK,OAAO;AACxC,WAAO,SAAS,WAAW,SAAS,WAAW,SAAS;AAAA,EAC1D,CAAC;AAED,MAAI,SAAS,SAAS,SAAS,GAAG;AAChC,WAAO;AAAA,EACT;AAGA,QAAM,YAAiB,SAAS,QAAQ;AAGxC,MAAI,UAAU,YAAY,WAAW,GAAG;AACtC,cAAU,cAAc,UAAU,YAAY,CAAC;AAC/C,cAAU,OAAO;AAAA,EACnB;AACA,SAAO,QAAQ,SAAS;AAC1B;AAlCS;AA2CT,SAAS,iBACP,QAC0B;AAC1B,QAAM,UAAiC,CAAC;AACxC,QAAM,WAAuC,CAAC;AAE9C,cAAY,QAAQ,CAAC,OAAO;AAC1B,QAAI,CAAC,GAAG,UAAU;AAChB;AAAA,IACF;AACA,UAAM,MAAM,GAAG,SAAS,YAAY,KAAK,GAAG;AAC5C,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAG,GAAG;AACxD,cAAQ,KAAK,EAAE;AACf,eAAS,GAAG,IAAI;AAAA,IAClB;AAAA,EACF,CAAC;AACD,SAAO,kBAAkB,OAAO;AAClC;AAjBS;AAoBT,IAAO,uBAAQ;","names":["clone","isObject","getType","flattenEach","clone","getType","getType","clone","feature","isObject","getType","clone","flattenEach","feature"]}
1
+ {"version":3,"sources":["../../index.ts","../../lib/turf-dissolve.ts","../../lib/turf-line-dissolve.ts","../../lib/turf-polygon-dissolve.ts"],"sourcesContent":["import { distance } from \"@turf/distance\";\nimport { feature, featureCollection } from \"@turf/helpers\";\nimport {\n Feature,\n FeatureCollection,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { Units } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\nimport { tin } from \"@turf/tin\";\nimport { dissolve } from \"./lib/turf-dissolve.js\";\n\n/**\n * Takes a set of {@link Point|points} and returns a concave hull Polygon or MultiPolygon.\n * Internally, this uses [turf-tin](https://github.com/Turfjs/turf-tin) to generate geometries.\n *\n * @name concave\n * @param {FeatureCollection<Point>} points input points\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.maxEdge=Infinity] the length (in 'units') of an edge necessary for part of the\n * hull to become concave.\n * @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers\n * @returns {Feature<(Polygon|MultiPolygon)>|null} a concave hull (null value is returned if unable to compute hull)\n * @example\n * var points = turf.featureCollection([\n * turf.point([-63.601226, 44.642643]),\n * turf.point([-63.591442, 44.651436]),\n * turf.point([-63.580799, 44.648749]),\n * turf.point([-63.573589, 44.641788]),\n * turf.point([-63.587665, 44.64533]),\n * turf.point([-63.595218, 44.64765])\n * ]);\n * var options = {units: 'miles', maxEdge: 1};\n *\n * var hull = turf.concave(points, options);\n *\n * //addToMap\n * var addToMap = [points, hull]\n */\nfunction concave(\n points: FeatureCollection<Point>,\n options: { maxEdge?: number; units?: Units } = {}\n): Feature<Polygon | MultiPolygon> | null {\n const maxEdge = options.maxEdge || Infinity;\n\n const cleaned = removeDuplicates(points);\n\n const tinPolys = tin(cleaned);\n // calculate length of all edges and area of all triangles\n // and remove triangles that fail the max length test\n tinPolys.features = tinPolys.features.filter((triangle) => {\n const pt1 = triangle.geometry.coordinates[0][0];\n const pt2 = triangle.geometry.coordinates[0][1];\n const pt3 = triangle.geometry.coordinates[0][2];\n const dist1 = distance(pt1, pt2, options);\n const dist2 = distance(pt2, pt3, options);\n const dist3 = distance(pt1, pt3, options);\n return dist1 <= maxEdge && dist2 <= maxEdge && dist3 <= maxEdge;\n });\n\n if (tinPolys.features.length < 1) {\n return null;\n }\n\n // merge the adjacent triangles\n const dissolved: any = dissolve(tinPolys);\n\n // geojson-dissolve always returns a MultiPolygon\n if (dissolved.coordinates.length === 1) {\n dissolved.coordinates = dissolved.coordinates[0];\n dissolved.type = \"Polygon\";\n }\n return feature(dissolved);\n}\n\n/**\n * Removes duplicated points in a collection returning a new collection\n *\n * @private\n * @param {FeatureCollection<Point>} points to be cleaned\n * @returns {FeatureCollection<Point>} cleaned set of points\n */\nfunction removeDuplicates(\n points: FeatureCollection<Point>\n): FeatureCollection<Point> {\n const cleaned: Array<Feature<Point>> = [];\n const existing: { [key: string]: boolean } = {};\n\n featureEach(points, (pt) => {\n if (!pt.geometry) {\n return;\n }\n const key = pt.geometry.coordinates.join(\"-\");\n if (!Object.prototype.hasOwnProperty.call(existing, key)) {\n cleaned.push(pt);\n existing[key] = true;\n }\n });\n return featureCollection(cleaned);\n}\n\nexport { concave };\nexport default concave;\n","import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPolygon,\n Polygon,\n} from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { isObject } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { flattenEach } from \"@turf/meta\";\nimport { lineDissolve } from \"./turf-line-dissolve.js\";\nimport { polygonDissolve } from \"./turf-polygon-dissolve.js\";\n\n/**\n * Transform function: attempts to dissolve geojson objects where possible\n * [GeoJSON] -> GeoJSON geometry\n *\n * @private\n * @param {FeatureCollection<LineString|MultiLineString|Polygon|MultiPolygon>} geojson Features to dissolved\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<MultiLineString|MultiPolygon>} Dissolved Features\n */\nfunction dissolve(\n geojson: FeatureCollection<\n LineString | MultiLineString | Polygon | MultiPolygon\n >,\n options: {\n mutate?: boolean;\n } = {}\n): Feature<LineString | MultiLineString | Polygon | MultiPolygon> | null {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) {\n throw new Error(\"options is invalid\");\n }\n const mutate = options.mutate;\n\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n // Topojson modifies in place, so we need to deep clone first\n if (mutate === false || mutate === undefined) {\n geojson = clone(geojson);\n }\n\n // Assert homogenity\n const type = getHomogenousType(geojson);\n if (!type) {\n throw new Error(\"geojson must be homogenous\");\n }\n\n // Data => Typescript hack\n const data: any = geojson;\n\n switch (type) {\n case \"LineString\":\n return lineDissolve(data, options);\n case \"Polygon\":\n return polygonDissolve(data, options);\n default:\n throw new Error(type + \" is not supported\");\n }\n}\n\n/**\n * Checks if GeoJSON is Homogenous\n *\n * @private\n * @param {GeoJSON} geojson GeoJSON\n * @returns {string|null} Homogenous type or null if multiple types\n */\nfunction getHomogenousType(geojson: any) {\n const types: { [key: string]: boolean } = {};\n flattenEach(geojson, (feature) => {\n types[feature.geometry.type] = true;\n });\n const keys = Object.keys(types);\n if (keys.length === 1) {\n return keys[0];\n }\n return null;\n}\n\nexport { dissolve };\nexport default dissolve;\n","import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n} from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { isObject, lineString, multiLineString } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { lineReduce } from \"@turf/meta\";\n\n/**\n * Merges all connected (non-forking, non-junctioning) line strings into single lineStrings.\n * [LineString] -> LineString|MultiLineString\n *\n * @param {FeatureCollection<LineString|MultiLineString>} geojson Lines to dissolve\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<LineString|MultiLineString>} Dissolved lines\n */\nfunction lineDissolve(\n geojson: FeatureCollection<LineString | MultiLineString>,\n options: { mutate?: boolean } = {}\n): Feature<LineString | MultiLineString> | null {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) {\n throw new Error(\"options is invalid\");\n }\n const mutate = options.mutate;\n\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n if (mutate === false || mutate === undefined) {\n geojson = clone(geojson);\n }\n\n const result: any[] = [];\n const lastLine = lineReduce(\n geojson,\n (previousLine: any, currentLine: any) => {\n // Attempt to merge this LineString with the other LineStrings, updating\n // the reference as it is merged with others and grows.\n const merged = mergeLineStrings(previousLine, currentLine);\n\n // Accumulate the merged LineString\n if (merged) {\n return merged;\n // Put the unmerged LineString back into the list\n } else {\n result.push(previousLine);\n return currentLine;\n }\n }\n );\n // Append the last line\n if (lastLine) {\n result.push(lastLine);\n }\n\n // Return null if no lines were dissolved\n if (!result.length) {\n return null;\n // Return LineString if only 1 line was dissolved\n } else if (result.length === 1) {\n return result[0];\n // Return MultiLineString if multiple lines were dissolved with gaps\n } else {\n return multiLineString(\n result.map((line) => {\n return line.coordinates;\n })\n );\n }\n}\n\n// [Number, Number] -> String\nfunction coordId(coord: number[]) {\n return coord[0].toString() + \",\" + coord[1].toString();\n}\n\n/**\n * LineString, LineString -> LineString\n *\n * @private\n * @param {Feature<LineString>} a line1\n * @param {Feature<LineString>} b line2\n * @returns {Feature<LineString>|null} Merged LineString\n */\nfunction mergeLineStrings(a: Feature<LineString>, b: Feature<LineString>) {\n const coords1 = a.geometry.coordinates;\n const coords2 = b.geometry.coordinates;\n\n const s1 = coordId(coords1[0]);\n const e1 = coordId(coords1[coords1.length - 1]);\n const s2 = coordId(coords2[0]);\n const e2 = coordId(coords2[coords2.length - 1]);\n\n // TODO: handle case where more than one of these is true!\n let coords;\n if (s1 === e2) {\n coords = coords2.concat(coords1.slice(1));\n } else if (s2 === e1) {\n coords = coords1.concat(coords2.slice(1));\n } else if (s1 === s2) {\n coords = coords1.slice(1).reverse().concat(coords2);\n } else if (e1 === e2) {\n coords = coords1.concat(coords2.reverse().slice(1));\n } else {\n return null;\n }\n\n return lineString(coords);\n}\n\nexport { lineDissolve };\nexport default lineDissolve;\n","import { Feature, FeatureCollection, MultiPolygon, Polygon } from \"geojson\";\nimport { clone } from \"@turf/clone\";\nimport { geometryCollection } from \"@turf/helpers\";\nimport { getType } from \"@turf/invariant\";\nimport { flattenEach } from \"@turf/meta\";\nimport { merge } from \"topojson-client\";\nimport { topology } from \"topojson-server\";\n\n/**\n * Dissolves all overlapping (Multi)Polygon\n *\n * @param {FeatureCollection<Polygon|MultiPolygon>} geojson Polygons to dissolve\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.mutate=false] Prevent input mutation\n * @returns {Feature<Polygon|MultiPolygon>} Dissolved Polygons\n */\nfunction polygonDissolve(\n geojson: FeatureCollection<Polygon | MultiPolygon>,\n options: { mutate?: boolean } = {}\n): Feature<Polygon | MultiPolygon> | null {\n // Validation\n if (getType(geojson) !== \"FeatureCollection\") {\n throw new Error(\"geojson must be a FeatureCollection\");\n }\n if (!geojson.features.length) {\n throw new Error(\"geojson is empty\");\n }\n\n // Clone geojson to avoid side effects\n // Topojson modifies in place, so we need to deep clone first\n if (options.mutate === false || options.mutate === undefined) {\n geojson = clone(geojson);\n }\n\n const geoms: any[] = [];\n flattenEach(geojson, (feature) => {\n geoms.push(feature.geometry);\n });\n const topo: any = topology({ geoms: geometryCollection(geoms).geometry });\n const merged: any = merge(topo, topo.objects.geoms.geometries);\n return merged;\n}\n\nexport { polygonDissolve };\nexport default polygonDissolve;\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,SAAS,yBAAyB;AAS3C,SAAS,mBAAmB;AAC5B,SAAS,WAAW;;;ACHpB,SAAS,SAAAA,cAAa;AACtB,SAAS,YAAAC,iBAAgB;AACzB,SAAS,WAAAC,gBAAe;AACxB,SAAS,eAAAC,oBAAmB;;;ACL5B,SAAS,aAAa;AACtB,SAAS,UAAU,YAAY,uBAAuB;AACtD,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAW3B,SAAS,aACP,SACA,UAAgC,CAAC,GACa;AAE9C,YAAU,WAAW,CAAC;AACtB,MAAI,CAAC,SAAS,OAAO,GAAG;AACtB,UAAM,IAAI,MAAM,oBAAoB;AAAA,EACtC;AACA,QAAM,SAAS,QAAQ;AAGvB,MAAI,QAAQ,OAAO,MAAM,qBAAqB;AAC5C,UAAM,IAA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,OAAO;AACxC,WAAO,SAAS,WAAW,SAAS,WAAW,SAAS;AAAA,EAC1D,CAAC;AAED,MAAI,SAAS,SAAS,SAAS,GAAG;AAChC,WAAO;AAAA,EACT;AAGA,QAAM,YAAiB,SAAS,QAAQ;AAGxC,MAAI,UAAU,YAAY,WAAW,GAAG;AACtC,cAAU,cAAc,UAAU,YAAY,CAAC;AAC/C,cAAU,OAAO;AAAA,EACnB;AACA,SAAO,QAAQ,SAAS;AAC1B;AASA,SAAS,iBACP,QAC0B;AAC1B,QAAM,UAAiC,CAAC;AACxC,QAAM,WAAuC,CAAC;AAE9C,cAAY,QAAQ,CAAC,OAAO;AAC1B,QAAI,CAAC,GAAG,UAAU;AAChB;AAAA,IACF;AACA,UAAM,MAAM,GAAG,SAAS,YAAY,KAAK,GAAG;AAC5C,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,UAAU,GAAG,GAAG;AACxD,cAAQ,KAAK,EAAE;AACf,eAAS,GAAG,IAAI;AAAA,IAClB;AAAA,EACF,CAAC;AACD,SAAO,kBAAkB,OAAO;AAClC;AAGA,IAAO,uBAAQ;","names":["clone","isObject","getType","flattenEach","clone","getType","feature","isObject","getType","clone","flattenEach","feature"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/concave",
3
- "version": "7.0.0",
3
+ "version": "7.1.0-alpha.70+948cdafaf",
4
4
  "description": "turf concave module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -76,15 +76,16 @@
76
76
  "write-json-file": "^5.0.0"
77
77
  },
78
78
  "dependencies": {
79
- "@turf/clone": "^7.0.0",
80
- "@turf/distance": "^7.0.0",
81
- "@turf/helpers": "^7.0.0",
82
- "@turf/invariant": "^7.0.0",
83
- "@turf/meta": "^7.0.0",
84
- "@turf/tin": "^7.0.0",
79
+ "@turf/clone": "^7.1.0-alpha.70+948cdafaf",
80
+ "@turf/distance": "^7.1.0-alpha.70+948cdafaf",
81
+ "@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
82
+ "@turf/invariant": "^7.1.0-alpha.70+948cdafaf",
83
+ "@turf/meta": "^7.1.0-alpha.70+948cdafaf",
84
+ "@turf/tin": "^7.1.0-alpha.70+948cdafaf",
85
+ "@types/geojson": "^7946.0.10",
85
86
  "topojson-client": "3.x",
86
87
  "topojson-server": "3.x",
87
88
  "tslib": "^2.6.2"
88
89
  },
89
- "gitHead": "3d3a7917025fbabe191dbddbc89754b86f9c7739"
90
+ "gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
90
91
  }