@turf/point-to-line-distance 7.1.0-alpha.7 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -14
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@ minimum distance between the point and any segment of the `LineString`.
|
|
|
9
9
|
|
|
10
10
|
### Parameters
|
|
11
11
|
|
|
12
|
-
* `pt` **([Feature][3]<[Point][
|
|
13
|
-
* `line` **[Feature][3]<[LineString][
|
|
14
|
-
* `options` **[Object][
|
|
12
|
+
* `pt` **([Feature][3]<[Point][1]> | [Array][4]<[number][5]>)** Feature or Geometry
|
|
13
|
+
* `line` **[Feature][3]<[LineString][2]>** GeoJSON Feature or Geometry
|
|
14
|
+
* `options` **[Object][6]** Optional parameters (optional, default `{}`)
|
|
15
15
|
|
|
16
|
-
* `options.units` **[string][
|
|
16
|
+
* `options.units` **[string][7]** can be anything supported by turf/convertLength
|
|
17
17
|
(ex: degrees, radians, miles, or kilometers) (optional, default `"kilometers"`)
|
|
18
|
-
* `options.method` **[string][
|
|
18
|
+
* `options.method` **[string][7]** whether to calculate the distance based on geodesic (spheroid) or
|
|
19
19
|
planar (flat) method. Valid options are 'geodesic' or 'planar'. (optional, default `"geodesic"`)
|
|
20
20
|
|
|
21
21
|
### Examples
|
|
@@ -28,7 +28,7 @@ var distance = turf.pointToLineDistance(pt, line, {units: 'miles'});
|
|
|
28
28
|
//=69.11854715938406
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
Returns **[number][
|
|
31
|
+
Returns **[number][5]** distance between point and line
|
|
32
32
|
|
|
33
33
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
34
34
|
|
|
@@ -36,17 +36,13 @@ Returns **[number][6]** distance between point and line
|
|
|
36
36
|
|
|
37
37
|
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
38
38
|
|
|
39
|
-
[4]: https://
|
|
39
|
+
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
40
40
|
|
|
41
|
-
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
41
|
+
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
42
42
|
|
|
43
|
-
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
43
|
+
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
44
44
|
|
|
45
|
-
[7]: https://
|
|
46
|
-
|
|
47
|
-
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
48
|
-
|
|
49
|
-
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
45
|
+
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
50
46
|
|
|
51
47
|
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
|
|
52
48
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AAEA,SAAS,YAAY,mBAAmB;AACxC;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,yBAAyB;AAsBnD,SAAS,oBACP,IACA,MACA,UAGI,CAAC,GACG;AAER,MAAI,CAAC,QAAQ,QAAQ;AACnB,YAAQ,SAAS;AAAA,EACnB;AACA,MAAI,CAAC,QAAQ,OAAO;AAClB,YAAQ,QAAQ;AAAA,EAClB;AAGA,MAAI,CAAC,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M,IAAI;AACZ,WAAO,aAAa,GAAG,GAAG,EAAE,QAAQ,QAAQ,QAAQ,OAAO,UAAU,CAAC;AAAA,EACxE;AACA,QAAM,KAAK,KAAK;AAChB,QAAM,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;AAC9C,SAAO,aAAa,GAAG,IAAI,EAAE,QAAQ,QAAQ,QAAQ,OAAO,UAAU,CAAC;AACzE;AAEA,SAAS,IAAI,GAAa,GAAa;AACrC,SAAO,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;AACjC;AAEA,SAAS,aAAa,GAAa,GAAa,SAAc;AAC5D,SAAO,QAAQ,WAAW,WACtB,kBAAkB,GAAG,GAAG,OAAO,IAC/B,YAAY,GAAG,GAAG,OAAO;AAC/B;AAGA,IAAO,sCAAQ","sourcesContent":["// Taken from http://geomalgorithms.com/a02-_lines.html\nimport { Feature, LineString } from \"geojson\";\nimport { distance as getDistance } from \"@turf/distance\";\nimport {\n convertLength,\n Coord,\n feature,\n lineString,\n point,\n Units,\n} from \"@turf/helpers\";\nimport { featureOf } from \"@turf/invariant\";\nimport { segmentEach } from \"@turf/meta\";\nimport { rhumbDistance as getPlanarDistance } from \"@turf/rhumb-distance\";\n\n/**\n * Returns the minimum distance between a {@link Point} and a {@link LineString}, being the distance from a line the\n * minimum distance between the point and any segment of the `LineString`.\n *\n * @name pointToLineDistance\n * @param {Feature<Point>|Array<number>} pt Feature or Geometry\n * @param {Feature<LineString>} line GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units=\"kilometers\"] can be anything supported by turf/convertLength\n * (ex: degrees, radians, miles, or kilometers)\n * @param {string} [options.method=\"geodesic\"]
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AAEA,SAAS,YAAY,mBAAmB;AACxC;AAAA,EACE;AAAA,EAEA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;AACnC,QAAM,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AAEnC,QAAM,KAAK,IAAI,GAAG,CAAC;AACnB,MAAI,MAAM,GAAG;AACX,WAAO,aAAa,GAAG,GAAG,EAAE,QAAQ,QAAQ,QAAQ,OAAO,UAAU,CAAC;AAAA,EACxE;AACA,QAAM,KAAK,IAAI,GAAG,CAAC;AACnB,MAAI,MAAM,IAAI;AACZ,WAAO,aAAa,GAAG,GAAG,EAAE,QAAQ,QAAQ,QAAQ,OAAO,UAAU,CAAC;AAAA,EACxE;AACA,QAAM,KAAK,KAAK;AAChB,QAAM,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;AAC9C,SAAO,aAAa,GAAG,IAAI,EAAE,QAAQ,QAAQ,QAAQ,OAAO,UAAU,CAAC;AACzE;AAEA,SAAS,IAAI,GAAa,GAAa;AACrC,SAAO,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;AACjC;AAEA,SAAS,aAAa,GAAa,GAAa,SAAc;AAC5D,SAAO,QAAQ,WAAW,WACtB,kBAAkB,GAAG,GAAG,OAAO,IAC/B,YAAY,GAAG,GAAG,OAAO;AAC/B;AAGA,IAAO,sCAAQ","sourcesContent":["// Taken from http://geomalgorithms.com/a02-_lines.html\nimport { Feature, LineString } from \"geojson\";\nimport { distance as getDistance } from \"@turf/distance\";\nimport {\n convertLength,\n Coord,\n feature,\n lineString,\n point,\n Units,\n} from \"@turf/helpers\";\nimport { featureOf } from \"@turf/invariant\";\nimport { segmentEach } from \"@turf/meta\";\nimport { rhumbDistance as getPlanarDistance } from \"@turf/rhumb-distance\";\n\n/**\n * Returns the minimum distance between a {@link Point} and a {@link LineString}, being the distance from a line the\n * minimum distance between the point and any segment of the `LineString`.\n *\n * @name pointToLineDistance\n * @param {Feature<Point>|Array<number>} pt Feature or Geometry\n * @param {Feature<LineString>} line GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units=\"kilometers\"] can be anything supported by turf/convertLength\n * (ex: degrees, radians, miles, or kilometers)\n * @param {string} [options.method=\"geodesic\"] whether to calculate the distance based on geodesic (spheroid) or\n * planar (flat) method. Valid options are 'geodesic' or 'planar'.\n * @returns {number} distance between point and line\n * @example\n * var pt = turf.point([0, 0]);\n * var line = turf.lineString([[1, 1],[-1, 1]]);\n *\n * var distance = turf.pointToLineDistance(pt, line, {units: 'miles'});\n * //=69.11854715938406\n */\nfunction pointToLineDistance(\n pt: Coord,\n line: Feature<LineString> | LineString,\n options: {\n units?: Units;\n method?: \"geodesic\" | \"planar\";\n } = {}\n): number {\n // Optional parameters\n if (!options.method) {\n options.method = \"geodesic\";\n }\n if (!options.units) {\n options.units = \"kilometers\";\n }\n\n // validation\n if (!pt) {\n throw new Error(\"pt is required\");\n }\n if (Array.isArray(pt)) {\n pt = point(pt);\n } else if (pt.type === \"Point\") {\n pt = feature(pt);\n } else {\n featureOf(pt, \"Point\", \"point\");\n }\n\n if (!line) {\n throw new Error(\"line is required\");\n }\n if (Array.isArray(line)) {\n line = lineString(line);\n } else if (line.type === \"LineString\") {\n line = feature(line);\n } else {\n featureOf(line, \"LineString\", \"line\");\n }\n\n let distance = Infinity;\n const p = pt.geometry.coordinates;\n segmentEach(line, (segment) => {\n const a = segment!.geometry.coordinates[0];\n const b = segment!.geometry.coordinates[1];\n const d = distanceToSegment(p, a, b, options);\n if (d < distance) {\n distance = d;\n }\n });\n return convertLength(distance, \"degrees\", options.units);\n}\n\n/**\n * Returns the distance between a point P on a segment AB.\n *\n * @private\n * @param {Array<number>} p external point\n * @param {Array<number>} a first segment point\n * @param {Array<number>} b second segment point\n * @param {Object} [options={}] Optional parameters\n * @returns {number} distance\n */\nfunction distanceToSegment(\n p: number[],\n a: number[],\n b: number[],\n options: any\n) {\n const v = [b[0] - a[0], b[1] - a[1]];\n const w = [p[0] - a[0], p[1] - a[1]];\n\n const c1 = dot(w, v);\n if (c1 <= 0) {\n return calcDistance(p, a, { method: options.method, units: \"degrees\" });\n }\n const c2 = dot(v, v);\n if (c2 <= c1) {\n return calcDistance(p, b, { method: options.method, units: \"degrees\" });\n }\n const b2 = c1 / c2;\n const Pb = [a[0] + b2 * v[0], a[1] + b2 * v[1]];\n return calcDistance(p, Pb, { method: options.method, units: \"degrees\" });\n}\n\nfunction dot(u: number[], v: number[]) {\n return u[0] * v[0] + u[1] * v[1];\n}\n\nfunction calcDistance(a: number[], b: number[], options: any) {\n return options.method === \"planar\"\n ? getPlanarDistance(a, b, options)\n : getDistance(a, b, options);\n}\n\nexport { pointToLineDistance };\nexport default pointToLineDistance;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -11,7 +11,7 @@ import { Coord, Units } from '@turf/helpers';
|
|
|
11
11
|
* @param {Object} [options={}] Optional parameters
|
|
12
12
|
* @param {string} [options.units="kilometers"] can be anything supported by turf/convertLength
|
|
13
13
|
* (ex: degrees, radians, miles, or kilometers)
|
|
14
|
-
* @param {string} [options.method="geodesic"]
|
|
14
|
+
* @param {string} [options.method="geodesic"] whether to calculate the distance based on geodesic (spheroid) or
|
|
15
15
|
* planar (flat) method. Valid options are 'geodesic' or 'planar'.
|
|
16
16
|
* @returns {number} distance between point and line
|
|
17
17
|
* @example
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Coord, Units } from '@turf/helpers';
|
|
|
11
11
|
* @param {Object} [options={}] Optional parameters
|
|
12
12
|
* @param {string} [options.units="kilometers"] can be anything supported by turf/convertLength
|
|
13
13
|
* (ex: degrees, radians, miles, or kilometers)
|
|
14
|
-
* @param {string} [options.method="geodesic"]
|
|
14
|
+
* @param {string} [options.method="geodesic"] whether to calculate the distance based on geodesic (spheroid) or
|
|
15
15
|
* planar (flat) method. Valid options are 'geodesic' or 'planar'.
|
|
16
16
|
* @returns {number} distance between point and line
|
|
17
17
|
* @example
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["// Taken from http://geomalgorithms.com/a02-_lines.html\nimport { Feature, LineString } from \"geojson\";\nimport { distance as getDistance } from \"@turf/distance\";\nimport {\n convertLength,\n Coord,\n feature,\n lineString,\n point,\n Units,\n} from \"@turf/helpers\";\nimport { featureOf } from \"@turf/invariant\";\nimport { segmentEach } from \"@turf/meta\";\nimport { rhumbDistance as getPlanarDistance } from \"@turf/rhumb-distance\";\n\n/**\n * Returns the minimum distance between a {@link Point} and a {@link LineString}, being the distance from a line the\n * minimum distance between the point and any segment of the `LineString`.\n *\n * @name pointToLineDistance\n * @param {Feature<Point>|Array<number>} pt Feature or Geometry\n * @param {Feature<LineString>} line GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units=\"kilometers\"] can be anything supported by turf/convertLength\n * (ex: degrees, radians, miles, or kilometers)\n * @param {string} [options.method=\"geodesic\"]
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["// Taken from http://geomalgorithms.com/a02-_lines.html\nimport { Feature, LineString } from \"geojson\";\nimport { distance as getDistance } from \"@turf/distance\";\nimport {\n convertLength,\n Coord,\n feature,\n lineString,\n point,\n Units,\n} from \"@turf/helpers\";\nimport { featureOf } from \"@turf/invariant\";\nimport { segmentEach } from \"@turf/meta\";\nimport { rhumbDistance as getPlanarDistance } from \"@turf/rhumb-distance\";\n\n/**\n * Returns the minimum distance between a {@link Point} and a {@link LineString}, being the distance from a line the\n * minimum distance between the point and any segment of the `LineString`.\n *\n * @name pointToLineDistance\n * @param {Feature<Point>|Array<number>} pt Feature or Geometry\n * @param {Feature<LineString>} line GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units=\"kilometers\"] can be anything supported by turf/convertLength\n * (ex: degrees, radians, miles, or kilometers)\n * @param {string} [options.method=\"geodesic\"] whether to calculate the distance based on geodesic (spheroid) or\n * planar (flat) method. Valid options are 'geodesic' or 'planar'.\n * @returns {number} distance between point and line\n * @example\n * var pt = turf.point([0, 0]);\n * var line = turf.lineString([[1, 1],[-1, 1]]);\n *\n * var distance = turf.pointToLineDistance(pt, line, {units: 'miles'});\n * //=69.11854715938406\n */\nfunction pointToLineDistance(\n pt: Coord,\n line: Feature<LineString> | LineString,\n options: {\n units?: Units;\n method?: \"geodesic\" | \"planar\";\n } = {}\n): number {\n // Optional parameters\n if (!options.method) {\n options.method = \"geodesic\";\n }\n if (!options.units) {\n options.units = \"kilometers\";\n }\n\n // validation\n if (!pt) {\n throw new Error(\"pt is required\");\n }\n if (Array.isArray(pt)) {\n pt = point(pt);\n } else if (pt.type === \"Point\") {\n pt = feature(pt);\n } else {\n featureOf(pt, \"Point\", \"point\");\n }\n\n if (!line) {\n throw new Error(\"line is required\");\n }\n if (Array.isArray(line)) {\n line = lineString(line);\n } else if (line.type === \"LineString\") {\n line = feature(line);\n } else {\n featureOf(line, \"LineString\", \"line\");\n }\n\n let distance = Infinity;\n const p = pt.geometry.coordinates;\n segmentEach(line, (segment) => {\n const a = segment!.geometry.coordinates[0];\n const b = segment!.geometry.coordinates[1];\n const d = distanceToSegment(p, a, b, options);\n if (d < distance) {\n distance = d;\n }\n });\n return convertLength(distance, \"degrees\", options.units);\n}\n\n/**\n * Returns the distance between a point P on a segment AB.\n *\n * @private\n * @param {Array<number>} p external point\n * @param {Array<number>} a first segment point\n * @param {Array<number>} b second segment point\n * @param {Object} [options={}] Optional parameters\n * @returns {number} distance\n */\nfunction distanceToSegment(\n p: number[],\n a: number[],\n b: number[],\n options: any\n) {\n const v = [b[0] - a[0], b[1] - a[1]];\n const w = [p[0] - a[0], p[1] - a[1]];\n\n const c1 = dot(w, v);\n if (c1 <= 0) {\n return calcDistance(p, a, { method: options.method, units: \"degrees\" });\n }\n const c2 = dot(v, v);\n if (c2 <= c1) {\n return calcDistance(p, b, { method: options.method, units: \"degrees\" });\n }\n const b2 = c1 / c2;\n const Pb = [a[0] + b2 * v[0], a[1] + b2 * v[1]];\n return calcDistance(p, Pb, { method: options.method, units: \"degrees\" });\n}\n\nfunction dot(u: number[], v: number[]) {\n return u[0] * v[0] + u[1] * v[1];\n}\n\nfunction calcDistance(a: number[], b: number[], options: any) {\n return options.method === \"planar\"\n ? getPlanarDistance(a, b, options)\n : getDistance(a, b, options);\n}\n\nexport { pointToLineDistance };\nexport default pointToLineDistance;\n"],"mappings":";AAEA,SAAS,YAAY,mBAAmB;AACxC;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,yBAAyB;AAsBnD,SAAS,oBACP,IACA,MACA,UAGI,CAAC,GACG;AAER,MAAI,CAAC,QAAQ,QAAQ;AACnB,YAAQ,SAAS;AAAA,EACnB;AACA,MAAI,CAAC,QAAQ,OAAO;AAClB,YAAQ,QAAQ;AAAA,EAClB;AAGA,MAAI,CAAC,IAAI;AACP,UAAM,IAAI,MAAM,gBAAgB;AAAA,EAClC;AACA,MAAI,MAAM,QAAQ,EAAE,GAAG;AACrB,SAAK,MAAM,EAAE;AAAA,EACf,WAAW,GAAG,SAAS,SAAS;AAC9B,SAAK,QAAQ,EAAE;AAAA,EACjB,OAAO;AACL,cAAU,IAAI,SAAS,OAAO;AAAA,EAChC;AAEA,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,kBAAkB;AAAA,EACpC;AACA,MAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,WAAO,WAAW,IAAI;AAAA,EACxB,WAAW,KAAK,SAAS,cAAc;AACrC,WAAO,QAAQ,IAAI;AAAA,EACrB,OAAO;AACL,cAAU,MAAM,cAAc,MAAM;AAAA,EACtC;AAEA,MAAI,WAAW;AACf,QAAM,IAAI,GAAG,SAAS;AACtB,cAAY,MAAM,CAAC,YAA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AC/B;AAGA,IAAO,sCAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/point-to-line-distance",
|
|
3
|
-
"version": "7.1.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "turf point-to-line-distance module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@turf/circle": "^7.1.0
|
|
57
|
+
"@turf/circle": "^7.1.0",
|
|
58
58
|
"@types/benchmark": "^2.1.5",
|
|
59
59
|
"@types/tape": "^4.2.32",
|
|
60
60
|
"benchmark": "^2.1.4",
|
|
@@ -67,15 +67,16 @@
|
|
|
67
67
|
"write-json-file": "^5.0.0"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@turf/bearing": "^7.1.0
|
|
71
|
-
"@turf/distance": "^7.1.0
|
|
72
|
-
"@turf/helpers": "^7.1.0
|
|
73
|
-
"@turf/invariant": "^7.1.0
|
|
74
|
-
"@turf/meta": "^7.1.0
|
|
75
|
-
"@turf/projection": "^7.1.0
|
|
76
|
-
"@turf/rhumb-bearing": "^7.1.0
|
|
77
|
-
"@turf/rhumb-distance": "^7.1.0
|
|
70
|
+
"@turf/bearing": "^7.1.0",
|
|
71
|
+
"@turf/distance": "^7.1.0",
|
|
72
|
+
"@turf/helpers": "^7.1.0",
|
|
73
|
+
"@turf/invariant": "^7.1.0",
|
|
74
|
+
"@turf/meta": "^7.1.0",
|
|
75
|
+
"@turf/projection": "^7.1.0",
|
|
76
|
+
"@turf/rhumb-bearing": "^7.1.0",
|
|
77
|
+
"@turf/rhumb-distance": "^7.1.0",
|
|
78
|
+
"@types/geojson": "^7946.0.10",
|
|
78
79
|
"tslib": "^2.6.2"
|
|
79
80
|
},
|
|
80
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef"
|
|
81
82
|
}
|