@turf/convex 7.2.0 → 7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +12 -13
package/dist/cjs/index.cjs
CHANGED
|
@@ -17,9 +17,9 @@ function convex(geojson, options = {}) {
|
|
|
17
17
|
}
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
var
|
|
20
|
+
var index_default = convex;
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
exports.convex = convex; exports.default =
|
|
24
|
+
exports.convex = convex; exports.default = index_default;
|
|
25
25
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-convex/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,wCAAoC;AACpC,kCAA0B;AAC1B,gGAAuB;AA8BvB,SAAS,MAAA,CACP,OAAA,EACA,QAAA,EAGI,CAAC,CAAA,EACuB;AAE5B,EAAA,OAAA,CAAQ,UAAA,EAAY,OAAA,CAAQ,UAAA,GAAa,QAAA;AAGzC,EAAA,MAAM,OAAA,EAAqB,CAAC,CAAA;AAG5B,EAAA,6BAAA,OAAU,EAAS,CAAC,KAAA,EAAA,GAAU;AAC5B,IAAA,MAAA,CAAO,IAAA,CAAK,CAAC,KAAA,CAAM,CAAC,CAAA,EAAG,KAAA,CAAM,CAAC,CAAC,CAAC,CAAA;AAAA,EAClC,CAAC,CAAA;AACD,EAAA,GAAA,CAAI,CAAC,MAAA,CAAO,MAAA,EAAQ;AAClB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,WAAA,EAAa,kCAAA,MAAW,EAAQ,OAAA,CAAQ,SAAS,CAAA;AAGvD,EAAA,GAAA,CAAI,UAAA,CAAW,OAAA,EAAS,CAAA,EAAG;AACzB,IAAA,OAAO,8BAAA,CAAS,UAAU,CAAC,CAAA;AAAA,EAC7B;AACA,EAAA,OAAO,IAAA;AACT;AAGA,IAAO,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-convex/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,wCAAoC;AACpC,kCAA0B;AAC1B,gGAAuB;AA8BvB,SAAS,MAAA,CACP,OAAA,EACA,QAAA,EAGI,CAAC,CAAA,EACuB;AAE5B,EAAA,OAAA,CAAQ,UAAA,EAAY,OAAA,CAAQ,UAAA,GAAa,QAAA;AAGzC,EAAA,MAAM,OAAA,EAAqB,CAAC,CAAA;AAG5B,EAAA,6BAAA,OAAU,EAAS,CAAC,KAAA,EAAA,GAAU;AAC5B,IAAA,MAAA,CAAO,IAAA,CAAK,CAAC,KAAA,CAAM,CAAC,CAAA,EAAG,KAAA,CAAM,CAAC,CAAC,CAAC,CAAA;AAAA,EAClC,CAAC,CAAA;AACD,EAAA,GAAA,CAAI,CAAC,MAAA,CAAO,MAAA,EAAQ;AAClB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,WAAA,EAAa,kCAAA,MAAW,EAAQ,OAAA,CAAQ,SAAS,CAAA;AAGvD,EAAA,GAAA,CAAI,UAAA,CAAW,OAAA,EAAS,CAAA,EAAG;AACzB,IAAA,OAAO,8BAAA,CAAS,UAAU,CAAC,CAAA;AAAA,EAC7B;AACA,EAAA,OAAO,IAAA;AACT;AAGA,IAAO,cAAA,EAAQ,MAAA;AD5Cf;AACE;AACA;AACF,yDAAC","file":"/home/runner/work/turf/turf/packages/turf-convex/dist/cjs/index.cjs","sourcesContent":[null,"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 * @function\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
|
@@ -17,9 +17,9 @@ function convex(geojson, options = {}) {
|
|
|
17
17
|
}
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
var
|
|
20
|
+
var index_default = convex;
|
|
21
21
|
export {
|
|
22
22
|
convex,
|
|
23
|
-
|
|
23
|
+
index_default as default
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -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 * @function\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,
|
|
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 * @function\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,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/convex",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.3.1",
|
|
4
|
+
"description": "Creates a convex hull around points",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": {
|
|
@@ -45,29 +45,28 @@
|
|
|
45
45
|
"bench": "tsx bench.ts",
|
|
46
46
|
"build": "tsup --config ../../tsup.config.ts",
|
|
47
47
|
"docs": "tsx ../../scripts/generate-readmes.ts",
|
|
48
|
-
"test": "
|
|
48
|
+
"test": "pnpm run /test:.*/",
|
|
49
49
|
"test:tape": "tsx test.ts"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/benchmark": "^2.1.5",
|
|
53
53
|
"@types/concaveman": "^1.1.6",
|
|
54
|
-
"@types/tape": "^
|
|
54
|
+
"@types/tape": "^5.8.1",
|
|
55
55
|
"benchmark": "^2.1.4",
|
|
56
|
-
"glob": "^
|
|
56
|
+
"glob": "^11.1.0",
|
|
57
57
|
"load-json-file": "^7.0.1",
|
|
58
|
-
"npm-run-all": "^4.1.5",
|
|
59
58
|
"tape": "^5.9.0",
|
|
60
|
-
"tsup": "^8.
|
|
61
|
-
"tsx": "^4.19.
|
|
62
|
-
"typescript": "^5.
|
|
63
|
-
"write-json-file": "^
|
|
59
|
+
"tsup": "^8.4.0",
|
|
60
|
+
"tsx": "^4.19.4",
|
|
61
|
+
"typescript": "^5.8.3",
|
|
62
|
+
"write-json-file": "^6.0.0"
|
|
64
63
|
},
|
|
65
64
|
"dependencies": {
|
|
66
|
-
"@turf/helpers": "
|
|
67
|
-
"@turf/meta": "
|
|
65
|
+
"@turf/helpers": "7.3.1",
|
|
66
|
+
"@turf/meta": "7.3.1",
|
|
68
67
|
"@types/geojson": "^7946.0.10",
|
|
69
68
|
"concaveman": "^1.2.1",
|
|
70
69
|
"tslib": "^2.8.1"
|
|
71
70
|
},
|
|
72
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "b7f1b4eafb760431e03955499d8eac9489438219"
|
|
73
72
|
}
|