node-red-contrib-web-worldmap 5.5.4 → 5.5.7

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +1 -0
  3. package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs +2 -2
  4. package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs.map +1 -1
  5. package/node_modules/@turf/bezier-spline/dist/esm/index.js +2 -2
  6. package/node_modules/@turf/bezier-spline/dist/esm/index.js.map +1 -1
  7. package/node_modules/@turf/bezier-spline/package.json +11 -12
  8. package/node_modules/@turf/helpers/README.md +1 -1
  9. package/node_modules/@turf/helpers/dist/cjs/index.cjs.map +1 -1
  10. package/node_modules/@turf/helpers/dist/cjs/index.d.cts +6 -4
  11. package/node_modules/@turf/helpers/dist/esm/index.d.ts +6 -4
  12. package/node_modules/@turf/helpers/dist/esm/index.js.map +1 -1
  13. package/node_modules/@turf/helpers/package.json +8 -9
  14. package/node_modules/@turf/invariant/package.json +9 -10
  15. package/node_modules/body-parser/HISTORY.md +8 -0
  16. package/node_modules/body-parser/lib/types/urlencoded.js +2 -9
  17. package/node_modules/body-parser/package.json +9 -10
  18. package/node_modules/cookie/index.js +2 -1
  19. package/node_modules/cookie/package.json +1 -1
  20. package/node_modules/cookie-signature/History.md +5 -1
  21. package/node_modules/cookie-signature/index.js +6 -6
  22. package/node_modules/cookie-signature/package.json +2 -2
  23. package/node_modules/express/History.md +11 -0
  24. package/node_modules/express/package.json +17 -17
  25. package/node_modules/finalhandler/HISTORY.md +6 -0
  26. package/node_modules/finalhandler/package.json +3 -3
  27. package/node_modules/http-errors/HISTORY.md +6 -0
  28. package/node_modules/http-errors/index.js +4 -3
  29. package/node_modules/http-errors/package.json +12 -8
  30. package/node_modules/qs/.github/SECURITY.md +11 -0
  31. package/node_modules/qs/.github/THREAT_MODEL.md +78 -0
  32. package/node_modules/qs/CHANGELOG.md +31 -0
  33. package/node_modules/qs/README.md +25 -1
  34. package/node_modules/qs/dist/qs.js +95 -44
  35. package/node_modules/qs/eslint.config.mjs +56 -0
  36. package/node_modules/qs/lib/parse.js +107 -43
  37. package/node_modules/qs/lib/stringify.js +11 -6
  38. package/node_modules/qs/lib/utils.js +61 -6
  39. package/node_modules/qs/package.json +15 -12
  40. package/node_modules/qs/test/parse.js +257 -31
  41. package/node_modules/qs/test/stringify.js +23 -11
  42. package/node_modules/qs/test/utils.js +245 -0
  43. package/node_modules/raw-body/package.json +5 -7
  44. package/node_modules/send/HISTORY.md +19 -7
  45. package/node_modules/send/package.json +6 -6
  46. package/node_modules/serve-static/HISTORY.md +6 -0
  47. package/node_modules/serve-static/package.json +2 -2
  48. package/node_modules/statuses/HISTORY.md +5 -0
  49. package/node_modules/statuses/README.md +3 -0
  50. package/node_modules/statuses/package.json +7 -7
  51. package/package.json +8 -3
  52. package/worldmap/worldmap.js +3 -1
  53. package/node_modules/body-parser/SECURITY.md +0 -25
  54. package/node_modules/cookie-signature/.npmignore +0 -4
  55. package/node_modules/qs/.eslintrc +0 -38
  56. package/node_modules/raw-body/HISTORY.md +0 -308
  57. package/node_modules/raw-body/SECURITY.md +0 -24
  58. package/node_modules/send/node_modules/encodeurl/HISTORY.md +0 -14
  59. package/node_modules/send/node_modules/encodeurl/LICENSE +0 -22
  60. package/node_modules/send/node_modules/encodeurl/README.md +0 -128
  61. package/node_modules/send/node_modules/encodeurl/index.js +0 -60
  62. package/node_modules/send/node_modules/encodeurl/package.json +0 -40
package/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v5.5.7 - Fix COG handling for built in icons, bump various libs for CVEs
3
4
  - v5.5.4 - slight tweak to geojson property display as table
4
5
  - v5.5.3 - ensure SOG gets picked up earlier in chain
5
6
  - v5.5.2 - Slight improvement for on/offline choice of map
package/README.md CHANGED
@@ -10,6 +10,7 @@ A <a href="https://nodered.org" target="mapinfo">Node-RED</a> node to provide a
10
10
 
11
11
  ### Updates
12
12
 
13
+ - v5.5.7 - Fix COG handling for built in icons, bump various libs for CVEs
13
14
  - v5.5.4 - slight tweak to geojson property display as table
14
15
  - v5.5.3 - ensure SOG gets picked up earlier in chain
15
16
  - v5.5.2 - Slight improvement for on/offline choice of map
@@ -157,9 +157,9 @@ function bezierSpline(line, options = {}) {
157
157
  pushCoord(spline.duration);
158
158
  return _helpers.lineString.call(void 0, coords, options.properties);
159
159
  }
160
- var turf_bezier_spline_default = bezierSpline;
160
+ var index_default = bezierSpline;
161
161
 
162
162
 
163
163
 
164
- exports.bezierSpline = bezierSpline; exports.default = turf_bezier_spline_default;
164
+ exports.bezierSpline = bezierSpline; exports.default = index_default;
165
165
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-bezier-spline/dist/cjs/index.cjs","../../index.ts","../../lib/spline.ts"],"names":[],"mappings":"AAAA;ACCA,wCAA2B;AAC3B,4CAAwB;ADCxB;AACA;AE4BA,IAAM,OAAA,EAAN,MAAa;AAAA,EAWX,WAAA,CAAY,OAAA,EAAe;AACzB,IAAA,IAAA,CAAK,OAAA,EAAS,OAAA,CAAQ,OAAA,GAAU,CAAC,CAAA;AACjC,IAAA,IAAA,CAAK,SAAA,EAAW,OAAA,CAAQ,SAAA,GAAY,GAAA;AACpC,IAAA,IAAA,CAAK,UAAA,EAAY,OAAA,CAAQ,UAAA,GAAa,IAAA;AACtC,IAAA,IAAA,CAAK,QAAA,EAAU,CAAC,CAAA;AAChB,IAAA,IAAA,CAAK,SAAA,EAAW,CAAC,CAAA;AACjB,IAAA,IAAA,CAAK,WAAA,EAAa,OAAA,CAAQ,WAAA,GAAc,EAAA;AACxC,IAAA,IAAA,CAAK,OAAA,EAAS,IAAA,CAAK,MAAA,CAAO,MAAA;AAC1B,IAAA,IAAA,CAAK,MAAA,EAAQ,CAAA;AAGb,IAAA,IAAA,CAAA,IAAS,E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AAAA,EACF,CAAC,CAAA;AAED,EAAA,MAAM,UAAA,EAAY,CAAC,IAAA,EAAA,GAAiB;AAClC,IAAA,IAAI,IAAA,EAAM,MAAA,CAAO,GAAA,CAAI,IAAI,CAAA;AACzB,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,CAAM,KAAA,EAAO,GAAG,EAAA,EAAI,EAAA,IAAM,CAAA,EAAG;AACpC,MAAA,MAAA,CAAO,IAAA,CAAK,CAAC,GAAA,CAAI,CAAA,EAAG,GAAA,CAAI,CAAC,CAAC,CAAA;AAAA,IAC5B;AAAA,EACF,CAAA;AAEA,EAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,MAAA,CAAO,QAAA,EAAU,EAAA,GAAK,EAAA,EAAI;AAC5C,IAAA,SAAA,CAAU,CAAC,CAAA;AAAA,EACb;AACA,EAAA,SAAA,CAAU,MAAA,CAAO,QAAQ,CAAA;AAEzB,EAAA,OAAO,iCAAA,MAAW,EAAQ,OAAA,CAAQ,UAAU,CAAA;AAC9C;AAGA,IAAO,2BAAA,EAAQ,YAAA;ADuFf;AACE;AACA;AACF,kFAAC","file":"/home/runner/work/turf/turf/packages/turf-bezier-spline/dist/cjs/index.cjs","sourcesContent":[null,"import { Feature, LineString, GeoJsonProperties } from \"geojson\";\nimport { lineString } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\nimport { Spline } from \"./lib/spline.js\";\n\n/**\n * Takes a {@link LineString|line} and returns a curved version\n * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)\n * algorithm.\n *\n * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).\n *\n * @function\n * @param {Feature<LineString>} line input LineString\n * @param {Object} [options={}] Optional parameters\n * @param {Object} [options.properties={}] Translate properties to output\n * @param {number} [options.resolution=10000] time in milliseconds between points\n * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines\n * @returns {Feature<LineString>} curved line\n * @example\n * var line = turf.lineString([\n * [-76.091308, 18.427501],\n * [-76.695556, 18.729501],\n * [-76.552734, 19.40443],\n * [-74.61914, 19.134789],\n * [-73.652343, 20.07657],\n * [-73.157958, 20.210656]\n * ]);\n *\n * var curved = turf.bezierSpline(line);\n *\n * //addToMap\n * var addToMap = [line, curved]\n * curved.properties = { stroke: '#0F0' };\n */\nfunction bezierSpline<P extends GeoJsonProperties = GeoJsonProperties>(\n line: Feature<LineString> | LineString,\n options: {\n properties?: P;\n resolution?: number;\n sharpness?: number;\n } = {}\n): Feature<LineString, P> {\n // Optional params\n const resolution = options.resolution || 10000;\n const sharpness = options.sharpness || 0.85;\n\n const coords: [number, number][] = [];\n const points = getGeom(line).coordinates.map((pt) => {\n return { x: pt[0], y: pt[1] };\n });\n const spline = new Spline({\n duration: resolution,\n points,\n sharpness,\n });\n\n const pushCoord = (time: number) => {\n var pos = spline.pos(time);\n if (Math.floor(time / 100) % 2 === 0) {\n coords.push([pos.x, pos.y]);\n }\n };\n\n for (var i = 0; i < spline.duration; i += 10) {\n pushCoord(i);\n }\n pushCoord(spline.duration);\n\n return lineString(coords, options.properties);\n}\n\nexport { bezierSpline };\nexport default bezierSpline;\n","interface Point {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * BezierSpline\n * https://github.com/leszekr/bezier-spline-js\n *\n * @private\n * @copyright\n * Copyright (c) 2013 Leszek Rybicki\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nclass Spline {\n public duration: number;\n public points: Point[];\n public sharpness: number;\n public centers: Point[];\n public controls: Array<[Point, Point]>;\n public stepLength: number;\n public length: number;\n public delay: number;\n public steps: number[];\n\n constructor(options?: any) {\n this.points = options.points || [];\n this.duration = options.duration || 10000;\n this.sharpness = options.sharpness || 0.85;\n this.centers = [];\n this.controls = [];\n this.stepLength = options.stepLength || 60;\n this.length = this.points.length;\n this.delay = 0;\n\n // this is to ensure compatibility with the 2d version\n for (let i = 0; i < this.length; i++) {\n this.points[i].z = this.points[i].z || 0;\n }\n for (let i = 0; i < this.length - 1; i++) {\n const p1 = this.points[i];\n const p2 = this.points[i + 1];\n this.centers.push({\n x: (p1.x + p2.x) / 2,\n y: (p1.y + p2.y) / 2,\n z: (p1.z + p2.z) / 2,\n });\n }\n this.controls.push([this.points[0], this.points[0]]);\n for (let i = 0; i < this.centers.length - 1; i++) {\n const dx =\n this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;\n const dy =\n this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;\n const dz =\n this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;\n this.controls.push([\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i].z + dz),\n },\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i + 1].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i + 1].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i + 1].z + dz),\n },\n ]);\n }\n this.controls.push([\n this.points[this.length - 1],\n this.points[this.length - 1],\n ]);\n this.steps = this.cacheSteps(this.stepLength);\n return this;\n }\n /**\n * Caches an array of equidistant (more or less) points on the curve.\n */\n public cacheSteps(mindist: number) {\n const steps = [];\n let laststep = this.pos(0);\n steps.push(0);\n for (let t = 0; t < this.duration; t += 10) {\n const step = this.pos(t);\n const dist = Math.sqrt(\n (step.x - laststep.x) * (step.x - laststep.x) +\n (step.y - laststep.y) * (step.y - laststep.y) +\n (step.z - laststep.z) * (step.z - laststep.z)\n );\n if (dist > mindist) {\n steps.push(t);\n laststep = step;\n }\n }\n return steps;\n }\n\n /**\n * returns angle and speed in the given point in the curve\n */\n public vector(t: number) {\n const p1 = this.pos(t + 10);\n const p2 = this.pos(t - 10);\n return {\n angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,\n speed: Math.sqrt(\n (p2.x - p1.x) * (p2.x - p1.x) +\n (p2.y - p1.y) * (p2.y - p1.y) +\n (p2.z - p1.z) * (p2.z - p1.z)\n ),\n };\n }\n\n /**\n * Gets the position of the point, given time.\n *\n * WARNING: The speed is not constant. The time it takes between control points is constant.\n *\n * For constant speed, use Spline.steps[i];\n */\n public pos(time: number) {\n let t = time - this.delay;\n if (t < 0) {\n t = 0;\n }\n if (t > this.duration) {\n t = this.duration - 1;\n }\n // t = t-this.delay;\n const t2 = t / this.duration;\n if (t2 >= 1) {\n return this.points[this.length - 1];\n }\n\n const n = Math.floor((this.points.length - 1) * t2);\n const t1 = (this.length - 1) * t2 - n;\n return bezier(\n t1,\n this.points[n],\n this.controls[n][1],\n this.controls[n + 1][0],\n this.points[n + 1]\n );\n }\n}\n\nfunction bezier(t: number, p1: Point, c1: Point, c2: Point, p2: Point) {\n const b = B(t);\n const pos = {\n x: p2.x * b[0] + c2.x * b[1] + c1.x * b[2] + p1.x * b[3],\n y: p2.y * b[0] + c2.y * b[1] + c1.y * b[2] + p1.y * b[3],\n z: p2.z * b[0] + c2.z * b[1] + c1.z * b[2] + p1.z * b[3],\n };\n return pos;\n}\nfunction B(t: number) {\n const t2 = t * t;\n const t3 = t2 * t;\n return [\n t3,\n 3 * t2 * (1 - t),\n 3 * t * (1 - t) * (1 - t),\n (1 - t) * (1 - t) * (1 - t),\n ];\n}\n\nexport { Spline, Point };\nexport default Spline;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-bezier-spline/dist/cjs/index.cjs","../../index.ts","../../lib/spline.ts"],"names":[],"mappings":"AAAA;ACCA,wCAA2B;AAC3B,4CAAwB;ADCxB;AACA;AE4BA,IAAM,OAAA,EAAN,MAAa;AAAA,EAWX,WAAA,CAAY,OAAA,EAAe;AACzB,IAAA,IAAA,CAAK,OAAA,EAAS,OAAA,CAAQ,OAAA,GAAU,CAAC,CAAA;AACjC,IAAA,IAAA,CAAK,SAAA,EAAW,OAAA,CAAQ,SAAA,GAAY,GAAA;AACpC,IAAA,IAAA,CAAK,UAAA,EAAY,OAAA,CAAQ,UAAA,GAAa,IAAA;AACtC,IAAA,IAAA,CAAK,QAAA,EAAU,CAAC,CAAA;AAChB,IAAA,IAAA,CAAK,SAAA,EAAW,CAAC,CAAA;AACjB,IAAA,IAAA,CAAK,WAAA,EAAa,OAAA,CAAQ,WAAA,GAAc,EAAA;AACxC,IAAA,IAAA,CAAK,OAAA,EAAS,IAAA,CAAK,MAAA,CAAO,MAAA;AAC1B,IAAA,IAAA,CAAK,MAAA,EAAQ,CAAA;AAGb,IAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,IAAA,CAAK,MAAA,EAAQ,CAAA,EAAA,EAAK;AACpC,MAAA,IAAA,CAAK,MAAA,CAAO,CAAC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GAAA,CAAI,IAAI,CAAA;AACzB,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,CAAM,KAAA,EAAO,GAAG,EAAA,EAAI,EAAA,IAAM,CAAA,EAAG;AACpC,MAAA,MAAA,CAAO,IAAA,CAAK,CAAC,GAAA,CAAI,CAAA,EAAG,GAAA,CAAI,CAAC,CAAC,CAAA;AAAA,IAC5B;AAAA,EACF,CAAA;AAEA,EAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,MAAA,CAAO,QAAA,EAAU,EAAA,GAAK,EAAA,EAAI;AAC5C,IAAA,SAAA,CAAU,CAAC,CAAA;AAAA,EACb;AACA,EAAA,SAAA,CAAU,MAAA,CAAO,QAAQ,CAAA;AAEzB,EAAA,OAAO,iCAAA,MAAW,EAAQ,OAAA,CAAQ,UAAU,CAAA;AAC9C;AAGA,IAAO,cAAA,EAAQ,YAAA;ADuFf;AACE;AACA;AACF,qEAAC","file":"/home/runner/work/turf/turf/packages/turf-bezier-spline/dist/cjs/index.cjs","sourcesContent":[null,"import { Feature, LineString, GeoJsonProperties } from \"geojson\";\nimport { lineString } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\nimport { Spline } from \"./lib/spline.js\";\n\n/**\n * Takes a {@link LineString|line} and returns a curved version\n * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)\n * algorithm.\n *\n * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).\n *\n * @function\n * @param {Feature<LineString>} line input LineString\n * @param {Object} [options={}] Optional parameters\n * @param {Object} [options.properties={}] Translate properties to output\n * @param {number} [options.resolution=10000] time in milliseconds between points\n * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines\n * @returns {Feature<LineString>} curved line\n * @example\n * var line = turf.lineString([\n * [-76.091308, 18.427501],\n * [-76.695556, 18.729501],\n * [-76.552734, 19.40443],\n * [-74.61914, 19.134789],\n * [-73.652343, 20.07657],\n * [-73.157958, 20.210656]\n * ]);\n *\n * var curved = turf.bezierSpline(line);\n *\n * //addToMap\n * var addToMap = [line, curved]\n * curved.properties = { stroke: '#0F0' };\n */\nfunction bezierSpline<P extends GeoJsonProperties = GeoJsonProperties>(\n line: Feature<LineString> | LineString,\n options: {\n properties?: P;\n resolution?: number;\n sharpness?: number;\n } = {}\n): Feature<LineString, P> {\n // Optional params\n const resolution = options.resolution || 10000;\n const sharpness = options.sharpness || 0.85;\n\n const coords: [number, number][] = [];\n const points = getGeom(line).coordinates.map((pt) => {\n return { x: pt[0], y: pt[1] };\n });\n const spline = new Spline({\n duration: resolution,\n points,\n sharpness,\n });\n\n const pushCoord = (time: number) => {\n var pos = spline.pos(time);\n if (Math.floor(time / 100) % 2 === 0) {\n coords.push([pos.x, pos.y]);\n }\n };\n\n for (var i = 0; i < spline.duration; i += 10) {\n pushCoord(i);\n }\n pushCoord(spline.duration);\n\n return lineString(coords, options.properties);\n}\n\nexport { bezierSpline };\nexport default bezierSpline;\n","interface Point {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * BezierSpline\n * https://github.com/leszekr/bezier-spline-js\n *\n * @private\n * @copyright\n * Copyright (c) 2013 Leszek Rybicki\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nclass Spline {\n public duration: number;\n public points: Point[];\n public sharpness: number;\n public centers: Point[];\n public controls: Array<[Point, Point]>;\n public stepLength: number;\n public length: number;\n public delay: number;\n public steps: number[];\n\n constructor(options?: any) {\n this.points = options.points || [];\n this.duration = options.duration || 10000;\n this.sharpness = options.sharpness || 0.85;\n this.centers = [];\n this.controls = [];\n this.stepLength = options.stepLength || 60;\n this.length = this.points.length;\n this.delay = 0;\n\n // this is to ensure compatibility with the 2d version\n for (let i = 0; i < this.length; i++) {\n this.points[i].z = this.points[i].z || 0;\n }\n for (let i = 0; i < this.length - 1; i++) {\n const p1 = this.points[i];\n const p2 = this.points[i + 1];\n this.centers.push({\n x: (p1.x + p2.x) / 2,\n y: (p1.y + p2.y) / 2,\n z: (p1.z + p2.z) / 2,\n });\n }\n this.controls.push([this.points[0], this.points[0]]);\n for (let i = 0; i < this.centers.length - 1; i++) {\n const dx =\n this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;\n const dy =\n this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;\n const dz =\n this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;\n this.controls.push([\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i].z + dz),\n },\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i + 1].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i + 1].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i + 1].z + dz),\n },\n ]);\n }\n this.controls.push([\n this.points[this.length - 1],\n this.points[this.length - 1],\n ]);\n this.steps = this.cacheSteps(this.stepLength);\n return this;\n }\n /**\n * Caches an array of equidistant (more or less) points on the curve.\n */\n public cacheSteps(mindist: number) {\n const steps = [];\n let laststep = this.pos(0);\n steps.push(0);\n for (let t = 0; t < this.duration; t += 10) {\n const step = this.pos(t);\n const dist = Math.sqrt(\n (step.x - laststep.x) * (step.x - laststep.x) +\n (step.y - laststep.y) * (step.y - laststep.y) +\n (step.z - laststep.z) * (step.z - laststep.z)\n );\n if (dist > mindist) {\n steps.push(t);\n laststep = step;\n }\n }\n return steps;\n }\n\n /**\n * returns angle and speed in the given point in the curve\n */\n public vector(t: number) {\n const p1 = this.pos(t + 10);\n const p2 = this.pos(t - 10);\n return {\n angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,\n speed: Math.sqrt(\n (p2.x - p1.x) * (p2.x - p1.x) +\n (p2.y - p1.y) * (p2.y - p1.y) +\n (p2.z - p1.z) * (p2.z - p1.z)\n ),\n };\n }\n\n /**\n * Gets the position of the point, given time.\n *\n * WARNING: The speed is not constant. The time it takes between control points is constant.\n *\n * For constant speed, use Spline.steps[i];\n */\n public pos(time: number) {\n let t = time - this.delay;\n if (t < 0) {\n t = 0;\n }\n if (t > this.duration) {\n t = this.duration - 1;\n }\n // t = t-this.delay;\n const t2 = t / this.duration;\n if (t2 >= 1) {\n return this.points[this.length - 1];\n }\n\n const n = Math.floor((this.points.length - 1) * t2);\n const t1 = (this.length - 1) * t2 - n;\n return bezier(\n t1,\n this.points[n],\n this.controls[n][1],\n this.controls[n + 1][0],\n this.points[n + 1]\n );\n }\n}\n\nfunction bezier(t: number, p1: Point, c1: Point, c2: Point, p2: Point) {\n const b = B(t);\n const pos = {\n x: p2.x * b[0] + c2.x * b[1] + c1.x * b[2] + p1.x * b[3],\n y: p2.y * b[0] + c2.y * b[1] + c1.y * b[2] + p1.y * b[3],\n z: p2.z * b[0] + c2.z * b[1] + c1.z * b[2] + p1.z * b[3],\n };\n return pos;\n}\nfunction B(t: number) {\n const t2 = t * t;\n const t3 = t2 * t;\n return [\n t3,\n 3 * t2 * (1 - t),\n 3 * t * (1 - t) * (1 - t),\n (1 - t) * (1 - t) * (1 - t),\n ];\n}\n\nexport { Spline, Point };\nexport default Spline;\n"]}
@@ -157,9 +157,9 @@ function bezierSpline(line, options = {}) {
157
157
  pushCoord(spline.duration);
158
158
  return lineString(coords, options.properties);
159
159
  }
160
- var turf_bezier_spline_default = bezierSpline;
160
+ var index_default = bezierSpline;
161
161
  export {
162
162
  bezierSpline,
163
- turf_bezier_spline_default as default
163
+ index_default as default
164
164
  };
165
165
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../lib/spline.ts"],"sourcesContent":["import { Feature, LineString, GeoJsonProperties } from \"geojson\";\nimport { lineString } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\nimport { Spline } from \"./lib/spline.js\";\n\n/**\n * Takes a {@link LineString|line} and returns a curved version\n * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)\n * algorithm.\n *\n * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).\n *\n * @function\n * @param {Feature<LineString>} line input LineString\n * @param {Object} [options={}] Optional parameters\n * @param {Object} [options.properties={}] Translate properties to output\n * @param {number} [options.resolution=10000] time in milliseconds between points\n * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines\n * @returns {Feature<LineString>} curved line\n * @example\n * var line = turf.lineString([\n * [-76.091308, 18.427501],\n * [-76.695556, 18.729501],\n * [-76.552734, 19.40443],\n * [-74.61914, 19.134789],\n * [-73.652343, 20.07657],\n * [-73.157958, 20.210656]\n * ]);\n *\n * var curved = turf.bezierSpline(line);\n *\n * //addToMap\n * var addToMap = [line, curved]\n * curved.properties = { stroke: '#0F0' };\n */\nfunction bezierSpline<P extends GeoJsonProperties = GeoJsonProperties>(\n line: Feature<LineString> | LineString,\n options: {\n properties?: P;\n resolution?: number;\n sharpness?: number;\n } = {}\n): Feature<LineString, P> {\n // Optional params\n const resolution = options.resolution || 10000;\n const sharpness = options.sharpness || 0.85;\n\n const coords: [number, number][] = [];\n const points = getGeom(line).coordinates.map((pt) => {\n return { x: pt[0], y: pt[1] };\n });\n const spline = new Spline({\n duration: resolution,\n points,\n sharpness,\n });\n\n const pushCoord = (time: number) => {\n var pos = spline.pos(time);\n if (Math.floor(time / 100) % 2 === 0) {\n coords.push([pos.x, pos.y]);\n }\n };\n\n for (var i = 0; i < spline.duration; i += 10) {\n pushCoord(i);\n }\n pushCoord(spline.duration);\n\n return lineString(coords, options.properties);\n}\n\nexport { bezierSpline };\nexport default bezierSpline;\n","interface Point {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * BezierSpline\n * https://github.com/leszekr/bezier-spline-js\n *\n * @private\n * @copyright\n * Copyright (c) 2013 Leszek Rybicki\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nclass Spline {\n public duration: number;\n public points: Point[];\n public sharpness: number;\n public centers: Point[];\n public controls: Array<[Point, Point]>;\n public stepLength: number;\n public length: number;\n public delay: number;\n public steps: number[];\n\n constructor(options?: any) {\n this.points = options.points || [];\n this.duration = options.duration || 10000;\n this.sharpness = options.sharpness || 0.85;\n this.centers = [];\n this.controls = [];\n this.stepLength = options.stepLength || 60;\n this.length = this.points.length;\n this.delay = 0;\n\n // this is to ensure compatibility with the 2d version\n for (let i = 0; i < this.length; i++) {\n this.points[i].z = this.points[i].z || 0;\n }\n for (let i = 0; i < this.length - 1; i++) {\n const p1 = this.points[i];\n const p2 = this.points[i + 1];\n this.centers.push({\n x: (p1.x + p2.x) / 2,\n y: (p1.y + p2.y) / 2,\n z: (p1.z + p2.z) / 2,\n });\n }\n this.controls.push([this.points[0], this.points[0]]);\n for (let i = 0; i < this.centers.length - 1; i++) {\n const dx =\n this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;\n const dy =\n this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;\n const dz =\n this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;\n this.controls.push([\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i].z + dz),\n },\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i + 1].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i + 1].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i + 1].z + dz),\n },\n ]);\n }\n this.controls.push([\n this.points[this.length - 1],\n this.points[this.length - 1],\n ]);\n this.steps = this.cacheSteps(this.stepLength);\n return this;\n }\n /**\n * Caches an array of equidistant (more or less) points on the curve.\n */\n public cacheSteps(mindist: number) {\n const steps = [];\n let laststep = this.pos(0);\n steps.push(0);\n for (let t = 0; t < this.duration; t += 10) {\n const step = this.pos(t);\n const dist = Math.sqrt(\n (step.x - laststep.x) * (step.x - laststep.x) +\n (step.y - laststep.y) * (step.y - laststep.y) +\n (step.z - laststep.z) * (step.z - laststep.z)\n );\n if (dist > mindist) {\n steps.push(t);\n laststep = step;\n }\n }\n return steps;\n }\n\n /**\n * returns angle and speed in the given point in the curve\n */\n public vector(t: number) {\n const p1 = this.pos(t + 10);\n const p2 = this.pos(t - 10);\n return {\n angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,\n speed: Math.sqrt(\n (p2.x - p1.x) * (p2.x - p1.x) +\n (p2.y - p1.y) * (p2.y - p1.y) +\n (p2.z - p1.z) * (p2.z - p1.z)\n ),\n };\n }\n\n /**\n * Gets the position of the point, given time.\n *\n * WARNING: The speed is not constant. The time it takes between control points is constant.\n *\n * For constant speed, use Spline.steps[i];\n */\n public pos(time: number) {\n let t = time - this.delay;\n if (t < 0) {\n t = 0;\n }\n if (t > this.duration) {\n t = this.duration - 1;\n }\n // t = t-this.delay;\n const t2 = t / this.duration;\n if (t2 >= 1) {\n return this.points[this.length - 1];\n }\n\n const n = Math.floor((this.points.length - 1) * t2);\n const t1 = (this.length - 1) * t2 - n;\n return bezier(\n t1,\n this.points[n],\n this.controls[n][1],\n this.controls[n + 1][0],\n this.points[n + 1]\n );\n }\n}\n\nfunction bezier(t: number, p1: Point, c1: Point, c2: Point, p2: Point) {\n const b = B(t);\n const pos = {\n x: p2.x * b[0] + c2.x * b[1] + c1.x * b[2] + p1.x * b[3],\n y: p2.y * b[0] + c2.y * b[1] + c1.y * b[2] + p1.y * b[3],\n z: p2.z * b[0] + c2.z * b[1] + c1.z * b[2] + p1.z * b[3],\n };\n return pos;\n}\nfunction B(t: number) {\n const t2 = t * t;\n const t3 = t2 * t;\n return [\n t3,\n 3 * t2 * (1 - t),\n 3 * t * (1 - t) * (1 - t),\n (1 - t) * (1 - t) * (1 - t),\n ];\n}\n\nexport { Spline, Point };\nexport default Spline;\n"],"mappings":";AACA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;;;AC8BxB,IAAM,SAAN,MAAa;AAAA,EAWX,YAAY,SAAe;AACzB,SAAK,SAAS,QAAQ,UAAU,CAAC;AACjC,SAAK,WAAW,QAAQ,YAAY;AACpC,SAAK,YAAY,QAAQ,aAAa;AACtC,SAAK,UAAU,CAAC;AAChB,SAAK,WAAW,CAAC;AACjB,SAAK,aAAa,QAAQ,cAAc;AACxC,SAAK,SAAS,KAAK,OAAO;AAC1B,SAAK,QAAQ;AAGb,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,WAAK,OAAO,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,EAAE,KAAK;AAAA,IACzC;AACA,aAAS,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK;AACxC,YAAM,KAAK,KAAK,OAAO,CAAC;AACxB,YAAM,KAAK,KAAK,OAAO,IAAI,CAAC;AAC5B,WAAK,QAAQ,KAAK;AAAA,QAChB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,MACrB,CAAC;AAAA,IACH;AACA,SAAK,SAAS,KAAK,CAAC,KAAK,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC;AACnD,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,SAAS,GAAG,KAAK;AAChD,YAAM,KACJ,KAAK,OAAO,IAAI,CAAC,EAAE,KAAK,KAAK,QAAQ,CAAC,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC,EAAE,KAAK;AACvE,YAAM,KACJ,KAAK,OAAO,IAAI,C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AY,IAAI,CAAC,OAAO;AACnD,WAAO,EAAE,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE;AAAA,EAC9B,CAAC;AACD,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,YAAY,CAAC,SAAiB;AAClC,QAAI,MAAM,OAAO,IAAI,IAAI;AACzB,QAAI,KAAK,MAAM,OAAO,GAAG,IAAI,MAAM,GAAG;AACpC,aAAO,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAAA,IAC5B;AAAA,EACF;AAEA,WAAS,IAAI,GAAG,IAAI,OAAO,UAAU,KAAK,IAAI;AAC5C,cAAU,CAAC;AAAA,EACb;AACA,YAAU,OAAO,QAAQ;AAEzB,SAAO,WAAW,QAAQ,QAAQ,UAAU;AAC9C;AAGA,IAAO,6BAAQ;","names":[]}
1
+ {"version":3,"sources":["../../index.ts","../../lib/spline.ts"],"sourcesContent":["import { Feature, LineString, GeoJsonProperties } from \"geojson\";\nimport { lineString } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\nimport { Spline } from \"./lib/spline.js\";\n\n/**\n * Takes a {@link LineString|line} and returns a curved version\n * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)\n * algorithm.\n *\n * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).\n *\n * @function\n * @param {Feature<LineString>} line input LineString\n * @param {Object} [options={}] Optional parameters\n * @param {Object} [options.properties={}] Translate properties to output\n * @param {number} [options.resolution=10000] time in milliseconds between points\n * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines\n * @returns {Feature<LineString>} curved line\n * @example\n * var line = turf.lineString([\n * [-76.091308, 18.427501],\n * [-76.695556, 18.729501],\n * [-76.552734, 19.40443],\n * [-74.61914, 19.134789],\n * [-73.652343, 20.07657],\n * [-73.157958, 20.210656]\n * ]);\n *\n * var curved = turf.bezierSpline(line);\n *\n * //addToMap\n * var addToMap = [line, curved]\n * curved.properties = { stroke: '#0F0' };\n */\nfunction bezierSpline<P extends GeoJsonProperties = GeoJsonProperties>(\n line: Feature<LineString> | LineString,\n options: {\n properties?: P;\n resolution?: number;\n sharpness?: number;\n } = {}\n): Feature<LineString, P> {\n // Optional params\n const resolution = options.resolution || 10000;\n const sharpness = options.sharpness || 0.85;\n\n const coords: [number, number][] = [];\n const points = getGeom(line).coordinates.map((pt) => {\n return { x: pt[0], y: pt[1] };\n });\n const spline = new Spline({\n duration: resolution,\n points,\n sharpness,\n });\n\n const pushCoord = (time: number) => {\n var pos = spline.pos(time);\n if (Math.floor(time / 100) % 2 === 0) {\n coords.push([pos.x, pos.y]);\n }\n };\n\n for (var i = 0; i < spline.duration; i += 10) {\n pushCoord(i);\n }\n pushCoord(spline.duration);\n\n return lineString(coords, options.properties);\n}\n\nexport { bezierSpline };\nexport default bezierSpline;\n","interface Point {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * BezierSpline\n * https://github.com/leszekr/bezier-spline-js\n *\n * @private\n * @copyright\n * Copyright (c) 2013 Leszek Rybicki\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nclass Spline {\n public duration: number;\n public points: Point[];\n public sharpness: number;\n public centers: Point[];\n public controls: Array<[Point, Point]>;\n public stepLength: number;\n public length: number;\n public delay: number;\n public steps: number[];\n\n constructor(options?: any) {\n this.points = options.points || [];\n this.duration = options.duration || 10000;\n this.sharpness = options.sharpness || 0.85;\n this.centers = [];\n this.controls = [];\n this.stepLength = options.stepLength || 60;\n this.length = this.points.length;\n this.delay = 0;\n\n // this is to ensure compatibility with the 2d version\n for (let i = 0; i < this.length; i++) {\n this.points[i].z = this.points[i].z || 0;\n }\n for (let i = 0; i < this.length - 1; i++) {\n const p1 = this.points[i];\n const p2 = this.points[i + 1];\n this.centers.push({\n x: (p1.x + p2.x) / 2,\n y: (p1.y + p2.y) / 2,\n z: (p1.z + p2.z) / 2,\n });\n }\n this.controls.push([this.points[0], this.points[0]]);\n for (let i = 0; i < this.centers.length - 1; i++) {\n const dx =\n this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;\n const dy =\n this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;\n const dz =\n this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;\n this.controls.push([\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i].z + dz),\n },\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i + 1].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i + 1].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i + 1].z + dz),\n },\n ]);\n }\n this.controls.push([\n this.points[this.length - 1],\n this.points[this.length - 1],\n ]);\n this.steps = this.cacheSteps(this.stepLength);\n return this;\n }\n /**\n * Caches an array of equidistant (more or less) points on the curve.\n */\n public cacheSteps(mindist: number) {\n const steps = [];\n let laststep = this.pos(0);\n steps.push(0);\n for (let t = 0; t < this.duration; t += 10) {\n const step = this.pos(t);\n const dist = Math.sqrt(\n (step.x - laststep.x) * (step.x - laststep.x) +\n (step.y - laststep.y) * (step.y - laststep.y) +\n (step.z - laststep.z) * (step.z - laststep.z)\n );\n if (dist > mindist) {\n steps.push(t);\n laststep = step;\n }\n }\n return steps;\n }\n\n /**\n * returns angle and speed in the given point in the curve\n */\n public vector(t: number) {\n const p1 = this.pos(t + 10);\n const p2 = this.pos(t - 10);\n return {\n angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,\n speed: Math.sqrt(\n (p2.x - p1.x) * (p2.x - p1.x) +\n (p2.y - p1.y) * (p2.y - p1.y) +\n (p2.z - p1.z) * (p2.z - p1.z)\n ),\n };\n }\n\n /**\n * Gets the position of the point, given time.\n *\n * WARNING: The speed is not constant. The time it takes between control points is constant.\n *\n * For constant speed, use Spline.steps[i];\n */\n public pos(time: number) {\n let t = time - this.delay;\n if (t < 0) {\n t = 0;\n }\n if (t > this.duration) {\n t = this.duration - 1;\n }\n // t = t-this.delay;\n const t2 = t / this.duration;\n if (t2 >= 1) {\n return this.points[this.length - 1];\n }\n\n const n = Math.floor((this.points.length - 1) * t2);\n const t1 = (this.length - 1) * t2 - n;\n return bezier(\n t1,\n this.points[n],\n this.controls[n][1],\n this.controls[n + 1][0],\n this.points[n + 1]\n );\n }\n}\n\nfunction bezier(t: number, p1: Point, c1: Point, c2: Point, p2: Point) {\n const b = B(t);\n const pos = {\n x: p2.x * b[0] + c2.x * b[1] + c1.x * b[2] + p1.x * b[3],\n y: p2.y * b[0] + c2.y * b[1] + c1.y * b[2] + p1.y * b[3],\n z: p2.z * b[0] + c2.z * b[1] + c1.z * b[2] + p1.z * b[3],\n };\n return pos;\n}\nfunction B(t: number) {\n const t2 = t * t;\n const t3 = t2 * t;\n return [\n t3,\n 3 * t2 * (1 - t),\n 3 * t * (1 - t) * (1 - t),\n (1 - t) * (1 - t) * (1 - t),\n ];\n}\n\nexport { Spline, Point };\nexport default Spline;\n"],"mappings":";AACA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;;;AC8BxB,IAAM,SAAN,MAAa;AAAA,EAWX,YAAY,SAAe;AACzB,SAAK,SAAS,QAAQ,UAAU,CAAC;AACjC,SAAK,WAAW,QAAQ,YAAY;AACpC,SAAK,YAAY,QAAQ,aAAa;AACtC,SAAK,UAAU,CAAC;AAChB,SAAK,WAAW,CAAC;AACjB,SAAK,aAAa,QAAQ,cAAc;AACxC,SAAK,SAAS,KAAK,OAAO;AAC1B,SAAK,QAAQ;AAGb,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,WAAK,OAAO,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,EAAE,KAAK;AAAA,IACzC;AACA,aAAS,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK;AACxC,YAAM,KAAK,KAAK,OAAO,CAAC;AACxB,YAAM,KAAK,KAAK,OAAO,IAAI,CAAC;AAC5B,WAAK,QAAQ,KAAK;AAAA,QAChB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,MACrB,CAAC;AAAA,IACH;AACA,SAAK,SAAS,KAAK,CAAC,KAAK,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC;AACnD,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,SAAS,GAAG,KAAK;AAChD,YAAM,KACJ,KAAK,OAAO,IAAI,CAAC,EAAE,KAAK,KAAK,QAAQ,CAAC,EAAE,IAAI,KAAK,QA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AAEvC,QAAM,SAA6B,CAAC;AACpC,QAAM,SAAS,QAAQ,IAAI,EAAE,YAAY,IAAI,CAAC,OAAO;AACnD,WAAO,EAAE,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE;AAAA,EAC9B,CAAC;AACD,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,YAAY,CAAC,SAAiB;AAClC,QAAI,MAAM,OAAO,IAAI,IAAI;AACzB,QAAI,KAAK,MAAM,OAAO,GAAG,IAAI,MAAM,GAAG;AACpC,aAAO,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAAA,IAC5B;AAAA,EACF;AAEA,WAAS,IAAI,GAAG,IAAI,OAAO,UAAU,KAAK,IAAI;AAC5C,cAAU,CAAC;AAAA,EACb;AACA,YAAU,OAAO,QAAQ;AAEzB,SAAO,WAAW,QAAQ,QAAQ,UAAU;AAC9C;AAGA,IAAO,gBAAQ;","names":[]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turf/bezier-spline",
3
- "version": "7.2.0",
4
- "description": "turf bezier-spline module",
3
+ "version": "7.3.4",
4
+ "description": "Smooths a line into a curve using Bézier splines, great for visualizing routes.",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
7
7
  "bugs": {
@@ -48,26 +48,25 @@
48
48
  "bench": "tsx bench.ts",
49
49
  "build": "tsup --config ../../tsup.config.ts",
50
50
  "docs": "tsx ../../scripts/generate-readmes.ts",
51
- "test": "npm-run-all --npm-path npm test:*",
51
+ "test": "pnpm run /test:.*/",
52
52
  "test:tape": "tsx test.ts"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/benchmark": "^2.1.5",
56
- "@types/tape": "^4.13.4",
56
+ "@types/tape": "^5.8.1",
57
57
  "benchmark": "^2.1.4",
58
58
  "load-json-file": "^7.0.1",
59
- "npm-run-all": "^4.1.5",
60
59
  "tape": "^5.9.0",
61
- "tsup": "^8.3.5",
62
- "tsx": "^4.19.2",
63
- "typescript": "^5.5.4",
64
- "write-json-file": "^5.0.0"
60
+ "tsup": "^8.4.0",
61
+ "tsx": "^4.19.4",
62
+ "typescript": "^5.8.3",
63
+ "write-json-file": "^6.0.0"
65
64
  },
66
65
  "dependencies": {
67
- "@turf/helpers": "^7.2.0",
68
- "@turf/invariant": "^7.2.0",
66
+ "@turf/helpers": "7.3.4",
67
+ "@turf/invariant": "7.3.4",
69
68
  "@types/geojson": "^7946.0.10",
70
69
  "tslib": "^2.8.1"
71
70
  },
72
- "gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
71
+ "gitHead": "a0878648b801443f342aae692c60ab95a1da61a9"
73
72
  }
@@ -49,7 +49,7 @@ Type: ([Feature][7] | [FeatureCollection][8] | [Geometry][9] | [GeometryCollecti
49
49
 
50
50
  ## earthRadius
51
51
 
52
- The Earth radius in kilometers. Used by Turf modules that model the Earth as a sphere. The [mean radius][11] was selected because it is [recommended ][12] by the Haversine formula (used by turf/distance) to reduce error.
52
+ The Earth radius in meters. Used by Turf modules that model the Earth as a sphere. The [mean radius][11] was selected because it is [recommended ][12] by the Haversine formula (used by turf/distance) to reduce error.
53
53
 
54
54
  Type: [number][13]
55
55
 
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-helpers/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACuGO,IAAM,YAAA,EAAc,WAAA;AASpB,IAAM,QAAA,EAAiC;AAAA,EAC5C,WAAA,EAAa,YAAA,EAAc,GAAA;AAAA,EAC3B,WAAA,EAAa,YAAA,EAAc,GAAA;AAAA,EAC3B,OAAA,EAAS,IAAA,EAAA,CAAO,EAAA,EAAI,IAAA,CAAK,EAAA,CAAA;AAAA,EACzB,IAAA,EAAM,YAAA,EAAc,OAAA;AAAA,EACpB,MAAA,EAAQ,YAAA,EAAc,KAAA;AAAA,EACtB,UAAA,EAAY,YAAA,EA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A,EACzC;AACA,EAAA,GAAA,CAAI,IAAA,CAAK,OAAA,IAAW,EAAA,GAAK,IAAA,CAAK,OAAA,IAAW,CAAA,EAAG;AAC1C,IAAA,MAAM,IAAI,KAAA,CAAM,yCAAyC,CAAA;AAAA,EAC3D;AACA,EAAA,IAAA,CAAK,OAAA,CAAQ,CAAC,GAAA,EAAA,GAAQ;AACpB,IAAA,GAAA,CAAI,CAAC,QAAA,CAAS,GAAG,CAAA,EAAG;AAClB,MAAA,MAAM,IAAI,KAAA,CAAM,gCAAgC,CAAA;AAAA,IAClD;AAAA,EACF,CAAC,CAAA;AACH;AAuBO,SAAS,UAAA,CAAW,EAAA,EAAe;AACxC,EAAA,GAAA,CAAI,CAAC,EAAA,EAAI;AACP,IAAA,MAAM,IAAI,KAAA,CAAM,gBAAgB,CAAA;AAAA,EAClC;AACA,EAAA,GAAA,CAAI,CAAC,QAAA,EAAU,QAAQ,CAAA,CAAE,OAAA,CAAQ,OAAO,EAAE,EAAA,IAAM,CAAA,CAAA,EAAI;AAClD,IAAA,MAAM,IAAI,KAAA,CAAM,iCAAiC,CAAA;AAAA,EACnD;AACF;ADnnBA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,2iCAAC","file":"/home/runner/work/turf/turf/packages/turf-helpers/dist/cjs/index.cjs","sourcesContent":[null,"import {\n BBox,\n Feature,\n FeatureCollection,\n Geometry,\n GeometryCollection,\n GeometryObject,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n Position,\n GeoJsonProperties,\n} from \"geojson\";\n\nimport { Id } from \"./lib/geojson.js\";\nexport * from \"./lib/geojson.js\";\n\n/**\n * @module helpers\n */\n\n// TurfJS Combined Types\nexport type Coord = Feature<Point> | Point | Position;\n\n/**\n * Linear measurement units.\n *\n * ⚠️ Warning. Be aware of the implications of using radian or degree units to\n * measure distance. The distance represented by a degree of longitude *varies*\n * depending on latitude.\n *\n * See https://www.thoughtco.com/degree-of-latitude-and-longitude-distance-4070616\n * for an illustration of this behaviour.\n *\n * @typedef\n */\nexport type Units =\n | \"meters\"\n | \"metres\"\n | \"millimeters\"\n | \"millimetres\"\n | \"centimeters\"\n | \"centimetres\"\n | \"kilometers\"\n | \"kilometres\"\n | \"miles\"\n | \"nauticalmiles\"\n | \"inches\"\n | \"yards\"\n | \"feet\"\n | \"radians\"\n | \"degrees\";\n\n/**\n * Area measurement units.\n *\n * @typedef\n */\nexport type AreaUnits =\n | Exclude<Units, \"radians\" | \"degrees\">\n | \"acres\"\n | \"hectares\";\n\n/**\n * Grid types.\n *\n * @typedef\n */\nexport type Grid = \"point\" | \"square\" | \"hex\" | \"triangle\";\n\n/**\n * Shorthand corner identifiers.\n *\n * @typedef\n */\nexport type Corners = \"sw\" | \"se\" | \"nw\" | \"ne\" | \"center\" | \"centroid\";\n\n/**\n * Geometries made up of lines i.e. lines and polygons.\n *\n * @typedef\n */\nexport type Lines = LineString | MultiLineString | Polygon | MultiPolygon;\n\n/**\n * Convenience type for all possible GeoJSON.\n *\n * @typedef\n */\nexport type AllGeoJSON =\n | Feature\n | FeatureCollection\n | Geometry\n | GeometryCollection;\n\n/**\n * The Earth radius in kilometers. Used by Turf modules that model the Earth as a sphere. The {@link https://en.wikipedia.org/wiki/Earth_radius#Arithmetic_mean_radius mean radius} was selected because it is {@link https://rosettacode.org/wiki/Haversine_formula#:~:text=This%20value%20is%20recommended recommended } by the Haversine formula (used by turf/distance) to reduce error.\n *\n * @constant\n */\nexport const earthRadius = 6371008.8;\n\n/**\n * Unit of measurement factors based on earthRadius.\n *\n * Keys are the name of the unit, values are the number of that unit in a single radian\n *\n * @constant\n */\nexport const factors: Record<Units, number> = {\n centimeters: earthRadius * 100,\n centimetres: earthRadius * 100,\n degrees: 360 / (2 * Math.PI),\n feet: earthRadius * 3.28084,\n inches: earthRadius * 39.37,\n kilometers: earthRadius / 1000,\n kilometres: earthRadius / 1000,\n meters: earthRadius,\n metres: earthRadius,\n miles: earthRadius / 1609.344,\n millimeters: earthRadius * 1000,\n millimetres: earthRadius * 1000,\n nauticalmiles: earthRadius / 1852,\n radians: 1,\n yards: earthRadius * 1.0936,\n};\n\n/**\n\n * Area of measurement factors based on 1 square meter.\n *\n * @constant\n */\nexport const areaFactors: Record<AreaUnits, number> = {\n acres: 0.000247105,\n centimeters: 10000,\n centimetres: 10000,\n feet: 10.763910417,\n hectares: 0.0001,\n inches: 1550.003100006,\n kilometers: 0.000001,\n kilometres: 0.000001,\n meters: 1,\n metres: 1,\n miles: 3.86e-7,\n nauticalmiles: 2.9155334959812285e-7,\n millimeters: 1000000,\n millimetres: 1000000,\n yards: 1.195990046,\n};\n\n/**\n * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.\n *\n * @function\n * @param {GeometryObject} geometry input geometry\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<GeometryObject, GeoJsonProperties>} a GeoJSON Feature\n * @example\n * var geometry = {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 50]\n * };\n *\n * var feature = turf.feature(geometry);\n *\n * //=feature\n */\nexport function feature<\n G extends GeometryObject = Geometry,\n P extends GeoJsonProperties = GeoJsonProperties,\n>(\n geom: G | null,\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<G, P> {\n const feat: any = { type: \"Feature\" };\n if (options.id === 0 || options.id) {\n feat.id = options.id;\n }\n if (options.bbox) {\n feat.bbox = options.bbox;\n }\n feat.properties = properties || {};\n feat.geometry = geom;\n return feat;\n}\n\n/**\n * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.\n * For GeometryCollection type use `helpers.geometryCollection`\n *\n * @function\n * @param {(\"Point\" | \"LineString\" | \"Polygon\" | \"MultiPoint\" | \"MultiLineString\" | \"MultiPolygon\")} type Geometry Type\n * @param {Array<any>} coordinates Coordinates\n * @param {Object} [options={}] Optional Parameters\n * @returns {Geometry} a GeoJSON Geometry\n * @example\n * var type = \"Point\";\n * var coordinates = [110, 50];\n * var geometry = turf.geometry(type, coordinates);\n * // => geometry\n */\nexport function geometry(\n type:\n | \"Point\"\n | \"LineString\"\n | \"Polygon\"\n | \"MultiPoint\"\n | \"MultiLineString\"\n | \"MultiPolygon\",\n coordinates: any[],\n _options: Record<string, never> = {}\n) {\n switch (type) {\n case \"Point\":\n return point(coordinates).geometry;\n case \"LineString\":\n return lineString(coordinates).geometry;\n case \"Polygon\":\n return polygon(coordinates).geometry;\n case \"MultiPoint\":\n return multiPoint(coordinates).geometry;\n case \"MultiLineString\":\n return multiLineString(coordinates).geometry;\n case \"MultiPolygon\":\n return multiPolygon(coordinates).geometry;\n default:\n throw new Error(type + \" is invalid\");\n }\n}\n\n/**\n * Creates a {@link Point} {@link Feature} from a Position.\n *\n * @function\n * @param {Position} coordinates longitude, latitude position (each in decimal degrees)\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<Point, GeoJsonProperties>} a Point feature\n * @example\n * var point = turf.point([-75.343, 39.984]);\n *\n * //=point\n */\nexport function point<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position,\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<Point, P> {\n if (!coordinates) {\n throw new Error(\"coordinates is required\");\n }\n if (!Array.isArray(coordinates)) {\n throw new Error(\"coordinates must be an Array\");\n }\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be at least 2 numbers long\");\n }\n if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {\n throw new Error(\"coordinates must contain numbers\");\n }\n\n const geom: Point = {\n type: \"Point\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.\n *\n * @function\n * @param {Position[]} coordinates an array of Points\n * @param {GeoJsonProperties} [properties={}] Translate these properties to each Feature\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {Id} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Point>} Point Feature\n * @example\n * var points = turf.points([\n * [-75, 39],\n * [-80, 45],\n * [-78, 50]\n * ]);\n *\n * //=points\n */\nexport function points<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<Point, P> {\n return featureCollection(\n coordinates.map((coords) => {\n return point(coords, properties);\n }),\n options\n );\n}\n\n/**\n * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.\n *\n * @function\n * @param {Position[][]} coordinates an array of LinearRings\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<Polygon, GeoJsonProperties>} Polygon Feature\n * @example\n * var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' });\n *\n * //=polygon\n */\nexport function polygon<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<Polygon, P> {\n for (const ring of coordinates) {\n if (ring.length < 4) {\n throw new Error(\n \"Each LinearRing of a Polygon must have 4 or more Positions.\"\n );\n }\n\n if (ring[ring.length - 1].length !== ring[0].length) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n\n for (let j = 0; j < ring[ring.length - 1].length; j++) {\n // Check if first point of Polygon contains two numbers\n if (ring[ring.length - 1][j] !== ring[0][j]) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n }\n }\n const geom: Polygon = {\n type: \"Polygon\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.\n *\n * @function\n * @param {Position[][][]} coordinates an array of Polygon coordinates\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Polygon, GeoJsonProperties>} Polygon FeatureCollection\n * @example\n * var polygons = turf.polygons([\n * [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],\n * [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]],\n * ]);\n *\n * //=polygons\n */\nexport function polygons<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[][][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<Polygon, P> {\n return featureCollection(\n coordinates.map((coords) => {\n return polygon(coords, properties);\n }),\n options\n );\n}\n\n/**\n * Creates a {@link LineString} {@link Feature} from an Array of Positions.\n *\n * @function\n * @param {Position[]} coordinates an array of Positions\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<LineString, GeoJsonProperties>} LineString Feature\n * @example\n * var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});\n * var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});\n *\n * //=linestring1\n * //=linestring2\n */\nexport function lineString<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<LineString, P> {\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be an array of two or more positions\");\n }\n const geom: LineString = {\n type: \"LineString\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.\n *\n * @function\n * @param {Position[][]} coordinates an array of LinearRings\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {Id} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<LineString, GeoJsonProperties>} LineString FeatureCollection\n * @example\n * var linestrings = turf.lineStrings([\n * [[-24, 63], [-23, 60], [-25, 65], [-20, 69]],\n * [[-14, 43], [-13, 40], [-15, 45], [-10, 49]]\n * ]);\n *\n * //=linestrings\n */\nexport function lineStrings<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<LineString, P> {\n return featureCollection(\n coordinates.map((coords) => {\n return lineString(coords, properties);\n }),\n options\n );\n}\n\n/**\n * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.\n *\n * @function\n * @param {Array<Feature<GeometryObject, GeoJsonProperties>>} features input features\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {FeatureCollection<GeometryObject, GeoJsonProperties>} FeatureCollection of Features\n * @example\n * var locationA = turf.point([-75.343, 39.984], {name: 'Location A'});\n * var locationB = turf.point([-75.833, 39.284], {name: 'Location B'});\n * var locationC = turf.point([-75.534, 39.123], {name: 'Location C'});\n *\n * var collection = turf.featureCollection([\n * locationA,\n * locationB,\n * locationC\n * ]);\n *\n * //=collection\n */\nexport function featureCollection<\n G extends GeometryObject = Geometry,\n P extends GeoJsonProperties = GeoJsonProperties,\n>(\n features: Array<Feature<G, P>>,\n options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<G, P> {\n const fc: any = { type: \"FeatureCollection\" };\n if (options.id) {\n fc.id = options.id;\n }\n if (options.bbox) {\n fc.bbox = options.bbox;\n }\n fc.features = features;\n return fc;\n}\n\n/**\n * Creates a {@link Feature}<{@link MultiLineString}> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Position[][]} coordinates an array of LineStrings\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiLineString, GeoJsonProperties>} a MultiLineString feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiLine = turf.multiLineString([[[0,0],[10,10]]]);\n *\n * //=multiLine\n */\nexport function multiLineString<\n P extends GeoJsonProperties = GeoJsonProperties,\n>(\n coordinates: Position[][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<MultiLineString, P> {\n const geom: MultiLineString = {\n type: \"MultiLineString\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Feature}<{@link MultiPoint}> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Position[]} coordinates an array of Positions\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPoint, GeoJsonProperties>} a MultiPoint feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPt = turf.multiPoint([[0,0],[10,10]]);\n *\n * //=multiPt\n */\nexport function multiPoint<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<MultiPoint, P> {\n const geom: MultiPoint = {\n type: \"MultiPoint\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Feature}<{@link MultiPolygon}> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Position[][][]} coordinates an array of Polygons\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPolygon, GeoJsonProperties>} a multipolygon feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);\n *\n * //=multiPoly\n *\n */\nexport function multiPolygon<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[][][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<MultiPolygon, P> {\n const geom: MultiPolygon = {\n type: \"MultiPolygon\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a Feature<GeometryCollection> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>} geometries an array of GeoJSON Geometries\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<GeometryCollection, GeoJsonProperties>} a GeoJSON GeometryCollection Feature\n * @example\n * var pt = turf.geometry(\"Point\", [100, 0]);\n * var line = turf.geometry(\"LineString\", [[101, 0], [102, 1]]);\n * var collection = turf.geometryCollection([pt, line]);\n *\n * // => collection\n */\nexport function geometryCollection<\n P extends GeoJsonProperties = GeoJsonProperties,\n>(\n geometries: Array<\n Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon\n >,\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<GeometryCollection, P> {\n const geom: GeometryCollection = {\n type: \"GeometryCollection\",\n geometries,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Round number to precision\n *\n * @function\n * @param {number} num Number\n * @param {number} [precision=0] Precision\n * @returns {number} rounded number\n * @example\n * turf.round(120.4321)\n * //=120\n *\n * turf.round(120.4321, 2)\n * //=120.43\n */\nexport function round(num: number, precision = 0): number {\n if (precision && !(precision >= 0)) {\n throw new Error(\"precision must be a positive number\");\n }\n const multiplier = Math.pow(10, precision || 0);\n return Math.round(num * multiplier) / multiplier;\n}\n\n/**\n * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @function\n * @param {number} radians in radians across the sphere\n * @param {Units} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} distance\n */\nexport function radiansToLength(\n radians: number,\n units: Units = \"kilometers\"\n): number {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return radians * factor;\n}\n\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @function\n * @param {number} distance in real units\n * @param {Units} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} radians\n */\nexport function lengthToRadians(\n distance: number,\n units: Units = \"kilometers\"\n): number {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return distance / factor;\n}\n\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet\n *\n * @function\n * @param {number} distance in real units\n * @param {Units} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} degrees\n */\nexport function lengthToDegrees(distance: number, units?: Units): number {\n return radiansToDegrees(lengthToRadians(distance, units));\n}\n\n/**\n * Converts any bearing angle from the north line direction (positive clockwise)\n * and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line\n *\n * @function\n * @param {number} bearing angle, between -180 and +180 degrees\n * @returns {number} angle between 0 and 360 degrees\n */\nexport function bearingToAzimuth(bearing: number): number {\n let angle = bearing % 360;\n if (angle < 0) {\n angle += 360;\n }\n return angle;\n}\n\n/**\n * Converts any azimuth angle from the north line direction (positive clockwise)\n * and returns an angle between -180 and +180 degrees (positive clockwise), 0 being the north line\n *\n * @function\n * @param {number} angle between 0 and 360 degrees\n * @returns {number} bearing between -180 and +180 degrees\n */\nexport function azimuthToBearing(angle: number): number {\n // Ignore full revolutions (multiples of 360)\n angle = angle % 360;\n\n if (angle > 180) {\n return angle - 360;\n } else if (angle < -180) {\n return angle + 360;\n }\n\n return angle;\n}\n\n/**\n * Converts an angle in radians to degrees\n *\n * @function\n * @param {number} radians angle in radians\n * @returns {number} degrees between 0 and 360 degrees\n */\nexport function radiansToDegrees(radians: number): number {\n // % (2 * Math.PI) radians in case someone passes value > 2π\n const normalisedRadians = radians % (2 * Math.PI);\n return (normalisedRadians * 180) / Math.PI;\n}\n\n/**\n * Converts an angle in degrees to radians\n *\n * @function\n * @param {number} degrees angle between 0 and 360 degrees\n * @returns {number} angle in radians\n */\nexport function degreesToRadians(degrees: number): number {\n // % 360 degrees in case someone passes value > 360\n const normalisedDegrees = degrees % 360;\n return (normalisedDegrees * Math.PI) / 180;\n}\n\n/**\n * Converts a length from one unit to another.\n *\n * @function\n * @param {number} length Length to be converted\n * @param {Units} [originalUnit=\"kilometers\"] Input length unit\n * @param {Units} [finalUnit=\"kilometers\"] Returned length unit\n * @returns {number} The converted length\n */\nexport function convertLength(\n length: number,\n originalUnit: Units = \"kilometers\",\n finalUnit: Units = \"kilometers\"\n): number {\n if (!(length >= 0)) {\n throw new Error(\"length must be a positive number\");\n }\n return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);\n}\n\n/**\n * Converts an area from one unit to another.\n *\n * @function\n * @param {number} area Area to be converted\n * @param {AreaUnits} [originalUnit=\"meters\"] Input area unit\n * @param {AreaUnits} [finalUnit=\"kilometers\"] Returned area unit\n * @returns {number} The converted length\n */\nexport function convertArea(\n area: number,\n originalUnit: AreaUnits = \"meters\",\n finalUnit: AreaUnits = \"kilometers\"\n): number {\n if (!(area >= 0)) {\n throw new Error(\"area must be a positive number\");\n }\n\n const startFactor = areaFactors[originalUnit];\n if (!startFactor) {\n throw new Error(\"invalid original units\");\n }\n\n const finalFactor = areaFactors[finalUnit];\n if (!finalFactor) {\n throw new Error(\"invalid final units\");\n }\n\n return (area / startFactor) * finalFactor;\n}\n\n/**\n * isNumber\n *\n * @function\n * @param {any} num Number to validate\n * @returns {boolean} true/false\n * @example\n * turf.isNumber(123)\n * //=true\n * turf.isNumber('foo')\n * //=false\n */\nexport function isNumber(num: any): boolean {\n return !isNaN(num) && num !== null && !Array.isArray(num);\n}\n\n/**\n * isObject\n *\n * @function\n * @param {any} input variable to validate\n * @returns {boolean} true/false, including false for Arrays and Functions\n * @example\n * turf.isObject({elevation: 10})\n * //=true\n * turf.isObject('foo')\n * //=false\n */\nexport function isObject(input: any): boolean {\n return input !== null && typeof input === \"object\" && !Array.isArray(input);\n}\n\n/**\n * Validate BBox\n *\n * @private\n * @param {any} bbox BBox to validate\n * @returns {void}\n * @throws {Error} if BBox is not valid\n * @example\n * validateBBox([-180, -40, 110, 50])\n * //=OK\n * validateBBox([-180, -40])\n * //=Error\n * validateBBox('Foo')\n * //=Error\n * validateBBox(5)\n * //=Error\n * validateBBox(null)\n * //=Error\n * validateBBox(undefined)\n * //=Error\n */\nexport function validateBBox(bbox: any): void {\n if (!bbox) {\n throw new Error(\"bbox is required\");\n }\n if (!Array.isArray(bbox)) {\n throw new Error(\"bbox must be an Array\");\n }\n if (bbox.length !== 4 && bbox.length !== 6) {\n throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n }\n bbox.forEach((num) => {\n if (!isNumber(num)) {\n throw new Error(\"bbox must only contain numbers\");\n }\n });\n}\n\n/**\n * Validate Id\n *\n * @private\n * @param {any} id Id to validate\n * @returns {void}\n * @throws {Error} if Id is not valid\n * @example\n * validateId([-180, -40, 110, 50])\n * //=Error\n * validateId([-180, -40])\n * //=Error\n * validateId('Foo')\n * //=OK\n * validateId(5)\n * //=OK\n * validateId(null)\n * //=Error\n * validateId(undefined)\n * //=Error\n */\nexport function validateId(id: any): void {\n if (!id) {\n throw new Error(\"id is required\");\n }\n if ([\"string\", \"number\"].indexOf(typeof id) === -1) {\n throw new Error(\"id must be a number or a string\");\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-helpers/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACuGO,IAAM,YAAA,EAAc,WAAA;AASpB,IAAM,QAAA,EAAiC;AAAA,EAC5C,WAAA,EAAa,YAAA,EAAc,GAAA;AAAA,EAC3B,WAAA,EAAa,YAAA,EAAc,GAAA;AAAA,EAC3B,OAAA,EAAS,IAAA,EAAA,CAAO,EAAA,EAAI,IAAA,CAAK,EAAA,CAAA;AAAA,EACzB,IAAA,EAAM,YAAA,EAAc,OAAA;AAAA,EACpB,MAAA,EAAQ,YAAA,EAAc,KAAA;AAAA,EACtB,UAAA,EAAY,YAAA,EAAc,GAAA;AAAA,EAC1B,UAAA,EAAY,YAAA,EAAc,GAAA;AAAA,EAC1B,MAAA,EAAQ,WAAA;AAAA,EACR,MAAA,EAAQ,WAAA;AAAA,EACR,KAAA,EAAO,YAAA,EAAc,QA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AAA,EAC3D;AACA,EAAA,IAAA,CAAK,OAAA,CAAQ,CAAC,GAAA,EAAA,GAAQ;AACpB,IAAA,GAAA,CAAI,CAAC,QAAA,CAAS,GAAG,CAAA,EAAG;AAClB,MAAA,MAAM,IAAI,KAAA,CAAM,gCAAgC,CAAA;AAAA,IAClD;AAAA,EACF,CAAC,CAAA;AACH;AAuBO,SAAS,UAAA,CAAW,EAAA,EAAe;AACxC,EAAA,GAAA,CAAI,CAAC,EAAA,EAAI;AACP,IAAA,MAAM,IAAI,KAAA,CAAM,gBAAgB,CAAA;AAAA,EAClC;AACA,EAAA,GAAA,CAAI,CAAC,QAAA,EAAU,QAAQ,CAAA,CAAE,OAAA,CAAQ,OAAO,EAAE,EAAA,IAAM,CAAA,CAAA,EAAI;AAClD,IAAA,MAAM,IAAI,KAAA,CAAM,iCAAiC,CAAA;AAAA,EACnD;AACF;ADhoBA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,2iCAAC","file":"/home/runner/work/turf/turf/packages/turf-helpers/dist/cjs/index.cjs","sourcesContent":[null,"import {\n BBox,\n Feature,\n FeatureCollection,\n Geometry,\n GeometryCollection,\n GeometryObject,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n Position,\n GeoJsonProperties,\n} from \"geojson\";\n\nimport { Id } from \"./lib/geojson.js\";\nexport * from \"./lib/geojson.js\";\n\n/**\n * @module helpers\n */\n\n// TurfJS Combined Types\nexport type Coord = Feature<Point> | Point | Position;\n\n/**\n * Linear measurement units.\n *\n * ⚠️ Warning. Be aware of the implications of using radian or degree units to\n * measure distance. The distance represented by a degree of longitude *varies*\n * depending on latitude.\n *\n * See https://www.thoughtco.com/degree-of-latitude-and-longitude-distance-4070616\n * for an illustration of this behaviour.\n *\n * @typedef\n */\nexport type Units =\n | \"meters\"\n | \"metres\"\n | \"millimeters\"\n | \"millimetres\"\n | \"centimeters\"\n | \"centimetres\"\n | \"kilometers\"\n | \"kilometres\"\n | \"miles\"\n | \"nauticalmiles\"\n | \"inches\"\n | \"yards\"\n | \"feet\"\n | \"radians\"\n | \"degrees\";\n\n/**\n * Area measurement units.\n *\n * @typedef\n */\nexport type AreaUnits =\n | Exclude<Units, \"radians\" | \"degrees\">\n | \"acres\"\n | \"hectares\";\n\n/**\n * Grid types.\n *\n * @typedef\n */\nexport type Grid = \"point\" | \"square\" | \"hex\" | \"triangle\";\n\n/**\n * Shorthand corner identifiers.\n *\n * @typedef\n */\nexport type Corners = \"sw\" | \"se\" | \"nw\" | \"ne\" | \"center\" | \"centroid\";\n\n/**\n * Geometries made up of lines i.e. lines and polygons.\n *\n * @typedef\n */\nexport type Lines = LineString | MultiLineString | Polygon | MultiPolygon;\n\n/**\n * Convenience type for all possible GeoJSON.\n *\n * @typedef\n */\nexport type AllGeoJSON =\n | Feature\n | FeatureCollection\n | Geometry\n | GeometryCollection;\n\n/**\n * The Earth radius in meters. Used by Turf modules that model the Earth as a sphere. The {@link https://en.wikipedia.org/wiki/Earth_radius#Arithmetic_mean_radius mean radius} was selected because it is {@link https://rosettacode.org/wiki/Haversine_formula#:~:text=This%20value%20is%20recommended recommended } by the Haversine formula (used by turf/distance) to reduce error.\n *\n * @constant\n */\nexport const earthRadius = 6371008.8;\n\n/**\n * Unit of measurement factors based on earthRadius.\n *\n * Keys are the name of the unit, values are the number of that unit in a single radian\n *\n * @constant\n */\nexport const factors: Record<Units, number> = {\n centimeters: earthRadius * 100,\n centimetres: earthRadius * 100,\n degrees: 360 / (2 * Math.PI),\n feet: earthRadius * 3.28084,\n inches: earthRadius * 39.37,\n kilometers: earthRadius / 1000,\n kilometres: earthRadius / 1000,\n meters: earthRadius,\n metres: earthRadius,\n miles: earthRadius / 1609.344,\n millimeters: earthRadius * 1000,\n millimetres: earthRadius * 1000,\n nauticalmiles: earthRadius / 1852,\n radians: 1,\n yards: earthRadius * 1.0936,\n};\n\n/**\n\n * Area of measurement factors based on 1 square meter.\n *\n * @constant\n */\nexport const areaFactors: Record<AreaUnits, number> = {\n acres: 0.000247105,\n centimeters: 10000,\n centimetres: 10000,\n feet: 10.763910417,\n hectares: 0.0001,\n inches: 1550.003100006,\n kilometers: 0.000001,\n kilometres: 0.000001,\n meters: 1,\n metres: 1,\n miles: 3.86e-7,\n nauticalmiles: 2.9155334959812285e-7,\n millimeters: 1000000,\n millimetres: 1000000,\n yards: 1.195990046,\n};\n\n/**\n * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.\n *\n * @function\n * @param {GeometryObject} geometry input geometry\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<GeometryObject, GeoJsonProperties>} a GeoJSON Feature\n * @example\n * var geometry = {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 50]\n * };\n *\n * var feature = turf.feature(geometry);\n *\n * //=feature\n */\nexport function feature<\n G extends GeometryObject = Geometry,\n P extends GeoJsonProperties = GeoJsonProperties,\n>(\n geom: G | null,\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<G, P> {\n const feat: any = { type: \"Feature\" };\n if (options.id === 0 || options.id) {\n feat.id = options.id;\n }\n if (options.bbox) {\n feat.bbox = options.bbox;\n }\n feat.properties = properties || {};\n feat.geometry = geom;\n return feat;\n}\n\n/**\n * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.\n * For GeometryCollection type use `helpers.geometryCollection`\n *\n * @function\n * @param {(\"Point\" | \"LineString\" | \"Polygon\" | \"MultiPoint\" | \"MultiLineString\" | \"MultiPolygon\")} type Geometry Type\n * @param {Array<any>} coordinates Coordinates\n * @param {Object} [options={}] Optional Parameters\n * @returns {Geometry} a GeoJSON Geometry\n * @example\n * var type = \"Point\";\n * var coordinates = [110, 50];\n * var geometry = turf.geometry(type, coordinates);\n * // => geometry\n */\nexport function geometry<\n T extends\n | \"Point\"\n | \"LineString\"\n | \"Polygon\"\n | \"MultiPoint\"\n | \"MultiLineString\"\n | \"MultiPolygon\",\n>(\n type: T,\n coordinates: any[],\n _options: Record<string, never> = {}\n): Extract<Geometry, { type: T }> {\n switch (type) {\n case \"Point\":\n return point(coordinates).geometry as Extract<Geometry, { type: T }>;\n case \"LineString\":\n return lineString(coordinates).geometry as Extract<Geometry, { type: T }>;\n case \"Polygon\":\n return polygon(coordinates).geometry as Extract<Geometry, { type: T }>;\n case \"MultiPoint\":\n return multiPoint(coordinates).geometry as Extract<Geometry, { type: T }>;\n case \"MultiLineString\":\n return multiLineString(coordinates).geometry as Extract<\n Geometry,\n { type: T }\n >;\n case \"MultiPolygon\":\n return multiPolygon(coordinates).geometry as Extract<\n Geometry,\n { type: T }\n >;\n default:\n throw new Error(type + \" is invalid\");\n }\n}\n\n/**\n * Creates a {@link Point} {@link Feature} from a Position.\n *\n * @function\n * @param {Position} coordinates longitude, latitude position (each in decimal degrees)\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<Point, GeoJsonProperties>} a Point feature\n * @example\n * var point = turf.point([-75.343, 39.984]);\n *\n * //=point\n */\nexport function point<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position,\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<Point, P> {\n if (!coordinates) {\n throw new Error(\"coordinates is required\");\n }\n if (!Array.isArray(coordinates)) {\n throw new Error(\"coordinates must be an Array\");\n }\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be at least 2 numbers long\");\n }\n if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {\n throw new Error(\"coordinates must contain numbers\");\n }\n\n const geom: Point = {\n type: \"Point\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.\n *\n * @function\n * @param {Position[]} coordinates an array of Points\n * @param {GeoJsonProperties} [properties={}] Translate these properties to each Feature\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {Id} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Point>} Point Feature\n * @example\n * var points = turf.points([\n * [-75, 39],\n * [-80, 45],\n * [-78, 50]\n * ]);\n *\n * //=points\n */\nexport function points<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<Point, P> {\n return featureCollection(\n coordinates.map((coords) => {\n return point(coords, properties);\n }),\n options\n );\n}\n\n/**\n * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.\n *\n * @function\n * @param {Position[][]} coordinates an array of LinearRings\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<Polygon, GeoJsonProperties>} Polygon Feature\n * @example\n * var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' });\n *\n * //=polygon\n */\nexport function polygon<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<Polygon, P> {\n for (const ring of coordinates) {\n if (ring.length < 4) {\n throw new Error(\n \"Each LinearRing of a Polygon must have 4 or more Positions.\"\n );\n }\n\n if (ring[ring.length - 1].length !== ring[0].length) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n\n for (let j = 0; j < ring[ring.length - 1].length; j++) {\n // Check if first point of Polygon contains two numbers\n if (ring[ring.length - 1][j] !== ring[0][j]) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n }\n }\n const geom: Polygon = {\n type: \"Polygon\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.\n *\n * @function\n * @param {Position[][][]} coordinates an array of Polygon coordinates\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Polygon, GeoJsonProperties>} Polygon FeatureCollection\n * @example\n * var polygons = turf.polygons([\n * [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],\n * [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]],\n * ]);\n *\n * //=polygons\n */\nexport function polygons<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[][][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<Polygon, P> {\n return featureCollection(\n coordinates.map((coords) => {\n return polygon(coords, properties);\n }),\n options\n );\n}\n\n/**\n * Creates a {@link LineString} {@link Feature} from an Array of Positions.\n *\n * @function\n * @param {Position[]} coordinates an array of Positions\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<LineString, GeoJsonProperties>} LineString Feature\n * @example\n * var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});\n * var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});\n *\n * //=linestring1\n * //=linestring2\n */\nexport function lineString<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<LineString, P> {\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be an array of two or more positions\");\n }\n const geom: LineString = {\n type: \"LineString\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.\n *\n * @function\n * @param {Position[][]} coordinates an array of LinearRings\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {Id} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<LineString, GeoJsonProperties>} LineString FeatureCollection\n * @example\n * var linestrings = turf.lineStrings([\n * [[-24, 63], [-23, 60], [-25, 65], [-20, 69]],\n * [[-14, 43], [-13, 40], [-15, 45], [-10, 49]]\n * ]);\n *\n * //=linestrings\n */\nexport function lineStrings<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<LineString, P> {\n return featureCollection(\n coordinates.map((coords) => {\n return lineString(coords, properties);\n }),\n options\n );\n}\n\n/**\n * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.\n *\n * @function\n * @param {Array<Feature<GeometryObject, GeoJsonProperties>>} features input features\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {FeatureCollection<GeometryObject, GeoJsonProperties>} FeatureCollection of Features\n * @example\n * var locationA = turf.point([-75.343, 39.984], {name: 'Location A'});\n * var locationB = turf.point([-75.833, 39.284], {name: 'Location B'});\n * var locationC = turf.point([-75.534, 39.123], {name: 'Location C'});\n *\n * var collection = turf.featureCollection([\n * locationA,\n * locationB,\n * locationC\n * ]);\n *\n * //=collection\n */\nexport function featureCollection<\n G extends GeometryObject = Geometry,\n P extends GeoJsonProperties = GeoJsonProperties,\n>(\n features: Array<Feature<G, P>>,\n options: { bbox?: BBox; id?: Id } = {}\n): FeatureCollection<G, P> {\n const fc: any = { type: \"FeatureCollection\" };\n if (options.id) {\n fc.id = options.id;\n }\n if (options.bbox) {\n fc.bbox = options.bbox;\n }\n fc.features = features;\n return fc;\n}\n\n/**\n * Creates a {@link Feature}<{@link MultiLineString}> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Position[][]} coordinates an array of LineStrings\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiLineString, GeoJsonProperties>} a MultiLineString feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiLine = turf.multiLineString([[[0,0],[10,10]]]);\n *\n * //=multiLine\n */\nexport function multiLineString<\n P extends GeoJsonProperties = GeoJsonProperties,\n>(\n coordinates: Position[][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<MultiLineString, P> {\n const geom: MultiLineString = {\n type: \"MultiLineString\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Feature}<{@link MultiPoint}> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Position[]} coordinates an array of Positions\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPoint, GeoJsonProperties>} a MultiPoint feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPt = turf.multiPoint([[0,0],[10,10]]);\n *\n * //=multiPt\n */\nexport function multiPoint<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<MultiPoint, P> {\n const geom: MultiPoint = {\n type: \"MultiPoint\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a {@link Feature}<{@link MultiPolygon}> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Position[][][]} coordinates an array of Polygons\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPolygon, GeoJsonProperties>} a multipolygon feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);\n *\n * //=multiPoly\n *\n */\nexport function multiPolygon<P extends GeoJsonProperties = GeoJsonProperties>(\n coordinates: Position[][][],\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<MultiPolygon, P> {\n const geom: MultiPolygon = {\n type: \"MultiPolygon\",\n coordinates,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Creates a Feature<GeometryCollection> based on a\n * coordinate array. Properties can be added optionally.\n *\n * @function\n * @param {Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>} geometries an array of GeoJSON Geometries\n * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {Id} [options.id] Identifier associated with the Feature\n * @returns {Feature<GeometryCollection, GeoJsonProperties>} a GeoJSON GeometryCollection Feature\n * @example\n * var pt = turf.geometry(\"Point\", [100, 0]);\n * var line = turf.geometry(\"LineString\", [[101, 0], [102, 1]]);\n * var collection = turf.geometryCollection([pt, line]);\n *\n * // => collection\n */\nexport function geometryCollection<\n G extends\n | Point\n | LineString\n | Polygon\n | MultiPoint\n | MultiLineString\n | MultiPolygon,\n P extends GeoJsonProperties = GeoJsonProperties,\n>(\n geometries: Array<G>,\n properties?: P,\n options: { bbox?: BBox; id?: Id } = {}\n): Feature<GeometryCollection<G>, P> {\n const geom: GeometryCollection<G> = {\n type: \"GeometryCollection\",\n geometries,\n };\n return feature(geom, properties, options);\n}\n\n/**\n * Round number to precision\n *\n * @function\n * @param {number} num Number\n * @param {number} [precision=0] Precision\n * @returns {number} rounded number\n * @example\n * turf.round(120.4321)\n * //=120\n *\n * turf.round(120.4321, 2)\n * //=120.43\n */\nexport function round(num: number, precision = 0): number {\n if (precision && !(precision >= 0)) {\n throw new Error(\"precision must be a positive number\");\n }\n const multiplier = Math.pow(10, precision || 0);\n return Math.round(num * multiplier) / multiplier;\n}\n\n/**\n * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @function\n * @param {number} radians in radians across the sphere\n * @param {Units} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} distance\n */\nexport function radiansToLength(\n radians: number,\n units: Units = \"kilometers\"\n): number {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return radians * factor;\n}\n\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @function\n * @param {number} distance in real units\n * @param {Units} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} radians\n */\nexport function lengthToRadians(\n distance: number,\n units: Units = \"kilometers\"\n): number {\n const factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return distance / factor;\n}\n\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet\n *\n * @function\n * @param {number} distance in real units\n * @param {Units} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} degrees\n */\nexport function lengthToDegrees(distance: number, units?: Units): number {\n return radiansToDegrees(lengthToRadians(distance, units));\n}\n\n/**\n * Converts any bearing angle from the north line direction (positive clockwise)\n * and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line\n *\n * @function\n * @param {number} bearing angle, between -180 and +180 degrees\n * @returns {number} angle between 0 and 360 degrees\n */\nexport function bearingToAzimuth(bearing: number): number {\n let angle = bearing % 360;\n if (angle < 0) {\n angle += 360;\n }\n return angle;\n}\n\n/**\n * Converts any azimuth angle from the north line direction (positive clockwise)\n * and returns an angle between -180 and +180 degrees (positive clockwise), 0 being the north line\n *\n * @function\n * @param {number} angle between 0 and 360 degrees\n * @returns {number} bearing between -180 and +180 degrees\n */\nexport function azimuthToBearing(angle: number): number {\n // Ignore full revolutions (multiples of 360)\n angle = angle % 360;\n\n if (angle > 180) {\n return angle - 360;\n } else if (angle < -180) {\n return angle + 360;\n }\n\n return angle;\n}\n\n/**\n * Converts an angle in radians to degrees\n *\n * @function\n * @param {number} radians angle in radians\n * @returns {number} degrees between 0 and 360 degrees\n */\nexport function radiansToDegrees(radians: number): number {\n // % (2 * Math.PI) radians in case someone passes value > 2π\n const normalisedRadians = radians % (2 * Math.PI);\n return (normalisedRadians * 180) / Math.PI;\n}\n\n/**\n * Converts an angle in degrees to radians\n *\n * @function\n * @param {number} degrees angle between 0 and 360 degrees\n * @returns {number} angle in radians\n */\nexport function degreesToRadians(degrees: number): number {\n // % 360 degrees in case someone passes value > 360\n const normalisedDegrees = degrees % 360;\n return (normalisedDegrees * Math.PI) / 180;\n}\n\n/**\n * Converts a length from one unit to another.\n *\n * @function\n * @param {number} length Length to be converted\n * @param {Units} [originalUnit=\"kilometers\"] Input length unit\n * @param {Units} [finalUnit=\"kilometers\"] Returned length unit\n * @returns {number} The converted length\n */\nexport function convertLength(\n length: number,\n originalUnit: Units = \"kilometers\",\n finalUnit: Units = \"kilometers\"\n): number {\n if (!(length >= 0)) {\n throw new Error(\"length must be a positive number\");\n }\n return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);\n}\n\n/**\n * Converts an area from one unit to another.\n *\n * @function\n * @param {number} area Area to be converted\n * @param {AreaUnits} [originalUnit=\"meters\"] Input area unit\n * @param {AreaUnits} [finalUnit=\"kilometers\"] Returned area unit\n * @returns {number} The converted length\n */\nexport function convertArea(\n area: number,\n originalUnit: AreaUnits = \"meters\",\n finalUnit: AreaUnits = \"kilometers\"\n): number {\n if (!(area >= 0)) {\n throw new Error(\"area must be a positive number\");\n }\n\n const startFactor = areaFactors[originalUnit];\n if (!startFactor) {\n throw new Error(\"invalid original units\");\n }\n\n const finalFactor = areaFactors[finalUnit];\n if (!finalFactor) {\n throw new Error(\"invalid final units\");\n }\n\n return (area / startFactor) * finalFactor;\n}\n\n/**\n * isNumber\n *\n * @function\n * @param {any} num Number to validate\n * @returns {boolean} true/false\n * @example\n * turf.isNumber(123)\n * //=true\n * turf.isNumber('foo')\n * //=false\n */\nexport function isNumber(num: any): boolean {\n return !isNaN(num) && num !== null && !Array.isArray(num);\n}\n\n/**\n * isObject\n *\n * @function\n * @param {any} input variable to validate\n * @returns {boolean} true/false, including false for Arrays and Functions\n * @example\n * turf.isObject({elevation: 10})\n * //=true\n * turf.isObject('foo')\n * //=false\n */\nexport function isObject(input: any): boolean {\n return input !== null && typeof input === \"object\" && !Array.isArray(input);\n}\n\n/**\n * Validate BBox\n *\n * @private\n * @param {any} bbox BBox to validate\n * @returns {void}\n * @throws {Error} if BBox is not valid\n * @example\n * validateBBox([-180, -40, 110, 50])\n * //=OK\n * validateBBox([-180, -40])\n * //=Error\n * validateBBox('Foo')\n * //=Error\n * validateBBox(5)\n * //=Error\n * validateBBox(null)\n * //=Error\n * validateBBox(undefined)\n * //=Error\n */\nexport function validateBBox(bbox: any): void {\n if (!bbox) {\n throw new Error(\"bbox is required\");\n }\n if (!Array.isArray(bbox)) {\n throw new Error(\"bbox must be an Array\");\n }\n if (bbox.length !== 4 && bbox.length !== 6) {\n throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n }\n bbox.forEach((num) => {\n if (!isNumber(num)) {\n throw new Error(\"bbox must only contain numbers\");\n }\n });\n}\n\n/**\n * Validate Id\n *\n * @private\n * @param {any} id Id to validate\n * @returns {void}\n * @throws {Error} if Id is not valid\n * @example\n * validateId([-180, -40, 110, 50])\n * //=Error\n * validateId([-180, -40])\n * //=Error\n * validateId('Foo')\n * //=OK\n * validateId(5)\n * //=OK\n * validateId(null)\n * //=Error\n * validateId(undefined)\n * //=Error\n */\nexport function validateId(id: any): void {\n if (!id) {\n throw new Error(\"id is required\");\n }\n if ([\"string\", \"number\"].indexOf(typeof id) === -1) {\n throw new Error(\"id must be a number or a string\");\n }\n}\n"]}
@@ -59,7 +59,7 @@ type Lines = LineString | MultiLineString | Polygon | MultiPolygon;
59
59
  */
60
60
  type AllGeoJSON = Feature | FeatureCollection | Geometry | GeometryCollection;
61
61
  /**
62
- * The Earth radius in kilometers. Used by Turf modules that model the Earth as a sphere. The {@link https://en.wikipedia.org/wiki/Earth_radius#Arithmetic_mean_radius mean radius} was selected because it is {@link https://rosettacode.org/wiki/Haversine_formula#:~:text=This%20value%20is%20recommended recommended } by the Haversine formula (used by turf/distance) to reduce error.
62
+ * The Earth radius in meters. Used by Turf modules that model the Earth as a sphere. The {@link https://en.wikipedia.org/wiki/Earth_radius#Arithmetic_mean_radius mean radius} was selected because it is {@link https://rosettacode.org/wiki/Haversine_formula#:~:text=This%20value%20is%20recommended recommended } by the Haversine formula (used by turf/distance) to reduce error.
63
63
  *
64
64
  * @constant
65
65
  */
@@ -118,7 +118,9 @@ declare function feature<G extends GeometryObject = Geometry, P extends GeoJsonP
118
118
  * var geometry = turf.geometry(type, coordinates);
119
119
  * // => geometry
120
120
  */
121
- declare function geometry(type: "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon", coordinates: any[], _options?: Record<string, never>): Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon;
121
+ declare function geometry<T extends "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon">(type: T, coordinates: any[], _options?: Record<string, never>): Extract<Geometry, {
122
+ type: T;
123
+ }>;
122
124
  /**
123
125
  * Creates a {@link Point} {@link Feature} from a Position.
124
126
  *
@@ -355,10 +357,10 @@ declare function multiPolygon<P extends GeoJsonProperties = GeoJsonProperties>(c
355
357
  *
356
358
  * // => collection
357
359
  */
358
- declare function geometryCollection<P extends GeoJsonProperties = GeoJsonProperties>(geometries: Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>, properties?: P, options?: {
360
+ declare function geometryCollection<G extends Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon, P extends GeoJsonProperties = GeoJsonProperties>(geometries: Array<G>, properties?: P, options?: {
359
361
  bbox?: BBox;
360
362
  id?: Id;
361
- }): Feature<GeometryCollection, P>;
363
+ }): Feature<GeometryCollection<G>, P>;
362
364
  /**
363
365
  * Round number to precision
364
366
  *
@@ -59,7 +59,7 @@ type Lines = LineString | MultiLineString | Polygon | MultiPolygon;
59
59
  */
60
60
  type AllGeoJSON = Feature | FeatureCollection | Geometry | GeometryCollection;
61
61
  /**
62
- * The Earth radius in kilometers. Used by Turf modules that model the Earth as a sphere. The {@link https://en.wikipedia.org/wiki/Earth_radius#Arithmetic_mean_radius mean radius} was selected because it is {@link https://rosettacode.org/wiki/Haversine_formula#:~:text=This%20value%20is%20recommended recommended } by the Haversine formula (used by turf/distance) to reduce error.
62
+ * The Earth radius in meters. Used by Turf modules that model the Earth as a sphere. The {@link https://en.wikipedia.org/wiki/Earth_radius#Arithmetic_mean_radius mean radius} was selected because it is {@link https://rosettacode.org/wiki/Haversine_formula#:~:text=This%20value%20is%20recommended recommended } by the Haversine formula (used by turf/distance) to reduce error.
63
63
  *
64
64
  * @constant
65
65
  */
@@ -118,7 +118,9 @@ declare function feature<G extends GeometryObject = Geometry, P extends GeoJsonP
118
118
  * var geometry = turf.geometry(type, coordinates);
119
119
  * // => geometry
120
120
  */
121
- declare function geometry(type: "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon", coordinates: any[], _options?: Record<string, never>): Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon;
121
+ declare function geometry<T extends "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon">(type: T, coordinates: any[], _options?: Record<string, never>): Extract<Geometry, {
122
+ type: T;
123
+ }>;
122
124
  /**
123
125
  * Creates a {@link Point} {@link Feature} from a Position.
124
126
  *
@@ -355,10 +357,10 @@ declare function multiPolygon<P extends GeoJsonProperties = GeoJsonProperties>(c
355
357
  *
356
358
  * // => collection
357
359
  */
358
- declare function geometryCollection<P extends GeoJsonProperties = GeoJsonProperties>(geometries: Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>, properties?: P, options?: {
360
+ declare function geometryCollection<G extends Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon, P extends GeoJsonProperties = GeoJsonProperties>(geometries: Array<G>, properties?: P, options?: {
359
361
  bbox?: BBox;
360
362
  id?: Id;
361
- }): Feature<GeometryCollection, P>;
363
+ }): Feature<GeometryCollection<G>, P>;
362
364
  /**
363
365
  * Round number to precision
364
366
  *