@turf/convex 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
@@ -36,7 +36,7 @@ var hull = turf.convex(points);
36
36
  var addToMap = [points, hull]
37
37
  ```
38
38
 
39
- Returns **[Feature][9]<[Polygon][10]>** a convex hull
39
+ Returns **[Feature][1]<[Polygon][3]>** a convex hull
40
40
 
41
41
  [1]: https://tools.ietf.org/html/rfc7946#section-3.2
42
42
 
@@ -54,10 +54,6 @@ Returns **[Feature][9]<[Polygon][10]>** a convex hull
54
54
 
55
55
  [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
56
56
 
57
- [9]: https://tools.ietf.org/html/rfc7946#section-3.2
58
-
59
- [10]: https://tools.ietf.org/html/rfc7946#section-3.1.6
60
-
61
57
  <!-- 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. -->
62
58
 
63
59
  ---
@@ -1,7 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }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}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// index.ts
5
2
  var _helpers = require('@turf/helpers');
6
3
  var _meta = require('@turf/meta');
7
4
  var _concaveman = require('concaveman'); var _concaveman2 = _interopRequireDefault(_concaveman);
@@ -20,7 +17,6 @@ function convex(geojson, options = {}) {
20
17
  }
21
18
  return null;
22
19
  }
23
- __name(convex, "convex");
24
20
  var turf_convex_default = convex;
25
21
 
26
22
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";;;;AACA,SAAqB,eAAe;AACpC,SAAS,iBAAiB;AAC1B,OAAO,gBAAgB;AA8BvB,SAAS,OACP,SACA,UAGI,CAAC,GACuB;AAE5B,UAAQ,YAAY,QAAQ,aAAa;AAGzC,QAAM,SAAqB,CAAC;AAG5B,YAAU,SAAS,CAAC,UAAU;AAC5B,WAAO,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AAAA,EAClC,CAAC;AACD,MAAI,CAAC,OAAO,QAAQ;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,WAAW,QAAQ,QAAQ,SAAS;AAGvD,MAAI,WAAW,SAAS,GAAG;AACzB,WAAO,QAAQ,CAAC,UAAU,CAAC;AAAA,EAC7B;AACA,SAAO;AACT;AA5BS;AA+BT,IAAO,sBAAQ","sourcesContent":["import { Feature, GeoJsonProperties, Polygon } from \"geojson\";\nimport { AllGeoJSON, polygon } from \"@turf/helpers\";\nimport { coordEach } from \"@turf/meta\";\nimport concaveman from \"concaveman\";\n\n/**\n * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}.\n *\n * Internally this uses\n * the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a\n * [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).\n *\n * @name convex\n * @param {GeoJSON} geojson input Feature or FeatureCollection\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.concavity=Infinity] 1 - thin shape. Infinity - convex hull.\n * @param {Object} [options.properties={}] Translate Properties to Feature\n * @returns {Feature<Polygon>} a convex hull\n * @example\n * var points = turf.featureCollection([\n * turf.point([10.195312, 43.755225]),\n * turf.point([10.404052, 43.8424511]),\n * turf.point([10.579833, 43.659924]),\n * turf.point([10.360107, 43.516688]),\n * turf.point([10.14038, 43.588348]),\n * turf.point([10.195312, 43.755225])\n * ]);\n *\n * var hull = turf.convex(points);\n *\n * //addToMap\n * var addToMap = [points, hull]\n */\nfunction convex<P extends GeoJsonProperties = GeoJsonProperties>(\n geojson: AllGeoJSON,\n options: {\n concavity?: number;\n properties?: P;\n } = {}\n): Feature<Polygon, P> | null {\n // Default parameters\n options.concavity = options.concavity || Infinity;\n\n // Container\n const points: number[][] = [];\n\n // Convert all points to flat 2D coordinate Array\n coordEach(geojson, (coord) => {\n points.push([coord[0], coord[1]]);\n });\n if (!points.length) {\n return null;\n }\n\n const convexHull = concaveman(points, options.concavity);\n\n // Convex hull should have at least 3 different vertices in order to create a valid polygon\n if (convexHull.length > 3) {\n return polygon([convexHull]);\n }\n return null;\n}\n\nexport { convex };\nexport default convex;\n"]}
1
+ {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AACA,SAAqB,eAAe;AACpC,SAAS,iBAAiB;AAC1B,OAAO,gBAAgB;AA8BvB,SAAS,OACP,SACA,UAGI,CAAC,GACuB;AAE5B,UAAQ,YAAY,QAAQ,aAAa;AAGzC,QAAM,SAAqB,CAAC;AAG5B,YAAU,SAAS,CAAC,UAAU;AAC5B,WAAO,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AAAA,EAClC,CAAC;AACD,MAAI,CAAC,OAAO,QAAQ;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,WAAW,QAAQ,QAAQ,SAAS;AAGvD,MAAI,WAAW,SAAS,GAAG;AACzB,WAAO,QAAQ,CAAC,UAAU,CAAC;AAAA,EAC7B;AACA,SAAO;AACT;AAGA,IAAO,sBAAQ","sourcesContent":["import { Feature, GeoJsonProperties, Polygon } from \"geojson\";\nimport { AllGeoJSON, polygon } from \"@turf/helpers\";\nimport { coordEach } from \"@turf/meta\";\nimport concaveman from \"concaveman\";\n\n/**\n * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}.\n *\n * Internally this uses\n * the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a\n * [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).\n *\n * @name convex\n * @param {GeoJSON} geojson input Feature or FeatureCollection\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.concavity=Infinity] 1 - thin shape. Infinity - convex hull.\n * @param {Object} [options.properties={}] Translate Properties to Feature\n * @returns {Feature<Polygon>} a convex hull\n * @example\n * var points = turf.featureCollection([\n * turf.point([10.195312, 43.755225]),\n * turf.point([10.404052, 43.8424511]),\n * turf.point([10.579833, 43.659924]),\n * turf.point([10.360107, 43.516688]),\n * turf.point([10.14038, 43.588348]),\n * turf.point([10.195312, 43.755225])\n * ]);\n *\n * var hull = turf.convex(points);\n *\n * //addToMap\n * var addToMap = [points, hull]\n */\nfunction convex<P extends GeoJsonProperties = GeoJsonProperties>(\n geojson: AllGeoJSON,\n options: {\n concavity?: number;\n properties?: P;\n } = {}\n): Feature<Polygon, P> | null {\n // Default parameters\n options.concavity = options.concavity || Infinity;\n\n // Container\n const points: number[][] = [];\n\n // Convert all points to flat 2D coordinate Array\n coordEach(geojson, (coord) => {\n points.push([coord[0], coord[1]]);\n });\n if (!points.length) {\n return null;\n }\n\n const convexHull = concaveman(points, options.concavity);\n\n // Convex hull should have at least 3 different vertices in order to create a valid polygon\n if (convexHull.length > 3) {\n return polygon([convexHull]);\n }\n return null;\n}\n\nexport { convex };\nexport default convex;\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 { polygon } from "@turf/helpers";
6
3
  import { coordEach } from "@turf/meta";
@@ -20,7 +17,6 @@ function convex(geojson, options = {}) {
20
17
  }
21
18
  return null;
22
19
  }
23
- __name(convex, "convex");
24
20
  var turf_convex_default = convex;
25
21
  export {
26
22
  convex,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, GeoJsonProperties, Polygon } from \"geojson\";\nimport { AllGeoJSON, polygon } from \"@turf/helpers\";\nimport { coordEach } from \"@turf/meta\";\nimport concaveman from \"concaveman\";\n\n/**\n * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}.\n *\n * Internally this uses\n * the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a\n * [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).\n *\n * @name convex\n * @param {GeoJSON} geojson input Feature or FeatureCollection\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.concavity=Infinity] 1 - thin shape. Infinity - convex hull.\n * @param {Object} [options.properties={}] Translate Properties to Feature\n * @returns {Feature<Polygon>} a convex hull\n * @example\n * var points = turf.featureCollection([\n * turf.point([10.195312, 43.755225]),\n * turf.point([10.404052, 43.8424511]),\n * turf.point([10.579833, 43.659924]),\n * turf.point([10.360107, 43.516688]),\n * turf.point([10.14038, 43.588348]),\n * turf.point([10.195312, 43.755225])\n * ]);\n *\n * var hull = turf.convex(points);\n *\n * //addToMap\n * var addToMap = [points, hull]\n */\nfunction convex<P extends GeoJsonProperties = GeoJsonProperties>(\n geojson: AllGeoJSON,\n options: {\n concavity?: number;\n properties?: P;\n } = {}\n): Feature<Polygon, P> | null {\n // Default parameters\n options.concavity = options.concavity || Infinity;\n\n // Container\n const points: number[][] = [];\n\n // Convert all points to flat 2D coordinate Array\n coordEach(geojson, (coord) => {\n points.push([coord[0], coord[1]]);\n });\n if (!points.length) {\n return null;\n }\n\n const convexHull = concaveman(points, options.concavity);\n\n // Convex hull should have at least 3 different vertices in order to create a valid polygon\n if (convexHull.length > 3) {\n return polygon([convexHull]);\n }\n return null;\n}\n\nexport { convex };\nexport default convex;\n"],"mappings":";;;;AACA,SAAqB,eAAe;AACpC,SAAS,iBAAiB;AAC1B,OAAO,gBAAgB;AA8BvB,SAAS,OACP,SACA,UAGI,CAAC,GACuB;AAE5B,UAAQ,YAAY,QAAQ,aAAa;AAGzC,QAAM,SAAqB,CAAC;AAG5B,YAAU,SAAS,CAAC,UAAU;AAC5B,WAAO,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AAAA,EAClC,CAAC;AACD,MAAI,CAAC,OAAO,QAAQ;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,WAAW,QAAQ,QAAQ,SAAS;AAGvD,MAAI,WAAW,SAAS,GAAG;AACzB,WAAO,QAAQ,CAAC,UAAU,CAAC;AAAA,EAC7B;AACA,SAAO;AACT;AA5BS;AA+BT,IAAO,sBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, GeoJsonProperties, Polygon } from \"geojson\";\nimport { AllGeoJSON, polygon } from \"@turf/helpers\";\nimport { coordEach } from \"@turf/meta\";\nimport concaveman from \"concaveman\";\n\n/**\n * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}.\n *\n * Internally this uses\n * the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a\n * [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).\n *\n * @name convex\n * @param {GeoJSON} geojson input Feature or FeatureCollection\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.concavity=Infinity] 1 - thin shape. Infinity - convex hull.\n * @param {Object} [options.properties={}] Translate Properties to Feature\n * @returns {Feature<Polygon>} a convex hull\n * @example\n * var points = turf.featureCollection([\n * turf.point([10.195312, 43.755225]),\n * turf.point([10.404052, 43.8424511]),\n * turf.point([10.579833, 43.659924]),\n * turf.point([10.360107, 43.516688]),\n * turf.point([10.14038, 43.588348]),\n * turf.point([10.195312, 43.755225])\n * ]);\n *\n * var hull = turf.convex(points);\n *\n * //addToMap\n * var addToMap = [points, hull]\n */\nfunction convex<P extends GeoJsonProperties = GeoJsonProperties>(\n geojson: AllGeoJSON,\n options: {\n concavity?: number;\n properties?: P;\n } = {}\n): Feature<Polygon, P> | null {\n // Default parameters\n options.concavity = options.concavity || Infinity;\n\n // Container\n const points: number[][] = [];\n\n // Convert all points to flat 2D coordinate Array\n coordEach(geojson, (coord) => {\n points.push([coord[0], coord[1]]);\n });\n if (!points.length) {\n return null;\n }\n\n const convexHull = concaveman(points, options.concavity);\n\n // Convex hull should have at least 3 different vertices in order to create a valid polygon\n if (convexHull.length > 3) {\n return polygon([convexHull]);\n }\n return null;\n}\n\nexport { convex };\nexport default convex;\n"],"mappings":";AACA,SAAqB,eAAe;AACpC,SAAS,iBAAiB;AAC1B,OAAO,gBAAgB;AA8BvB,SAAS,OACP,SACA,UAGI,CAAC,GACuB;AAE5B,UAAQ,YAAY,QAAQ,aAAa;AAGzC,QAAM,SAAqB,CAAC;AAG5B,YAAU,SAAS,CAAC,UAAU;AAC5B,WAAO,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AAAA,EAClC,CAAC;AACD,MAAI,CAAC,OAAO,QAAQ;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,WAAW,QAAQ,QAAQ,SAAS;AAGvD,MAAI,WAAW,SAAS,GAAG;AACzB,WAAO,QAAQ,CAAC,UAAU,CAAC;AAAA,EAC7B;AACA,SAAO;AACT;AAGA,IAAO,sBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/convex",
3
- "version": "7.0.0",
3
+ "version": "7.1.0-alpha.70+948cdafaf",
4
4
  "description": "turf convex module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -63,10 +63,11 @@
63
63
  "write-json-file": "^5.0.0"
64
64
  },
65
65
  "dependencies": {
66
- "@turf/helpers": "^7.0.0",
67
- "@turf/meta": "^7.0.0",
66
+ "@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
67
+ "@turf/meta": "^7.1.0-alpha.70+948cdafaf",
68
+ "@types/geojson": "^7946.0.10",
68
69
  "concaveman": "^1.2.1",
69
70
  "tslib": "^2.6.2"
70
71
  },
71
- "gitHead": "3d3a7917025fbabe191dbddbc89754b86f9c7739"
72
+ "gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
72
73
  }