@turf/rhumb-bearing 7.1.0 → 7.2.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 +1 -1
- 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 +11 -11
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ i.e. the angle measured in degrees start the north line (0 degrees)
|
|
|
11
11
|
|
|
12
12
|
* `start` **[Coord][2]** starting Point
|
|
13
13
|
* `end` **[Coord][2]** ending Point
|
|
14
|
-
* `options` **[Object][3]?** Optional parameters
|
|
14
|
+
* `options` **[Object][3]?** Optional parameters (optional, default `{}`)
|
|
15
15
|
|
|
16
16
|
* `options.final` **[boolean][4]** calculates the final bearing if true (optional, default `false`)
|
|
17
17
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-rhumb-bearing/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,wCAA0D;AAC1D,4CAAyB;AAuBzB,SAAS,YAAA,CACP,KAAA,EACA,GAAA,EACA,QAAA,EAA+B,CAAC,CAAA,EACxB;AACR,EAAA,IAAI,OAAA;AACJ,EAAA,GAAA,CAAI,OAAA,CAAQ,KAAA,EAAO;AACjB,IAAA,QAAA,EAAU,qBAAA,CAAsB,iCAAA,GAAY,CAAA,EAAG,iCAAA,KAAc,CAAC,CAAA;AAAA,EAChE,EAAA,KAAO;AACL,IAAA,QAAA,EAAU,qBAAA,CAAsB,iCAAA,KAAc,CAAA,EAAG,iCAAA,GAAY,CAAC,CAAA;AAAA,EAChE;AAEA,EAAA,MAAM,QAAA,EAAU,QAAA,EAAU,IAAA,EAAM,CAAA,CAAE,IAAA,EAAM,OAAA,EAAA,EAAW,OAAA;AAEnD,EAAA,OAAO,OAAA;AACT;AAeA,SAAS,qBAAA,CAAsB,IAAA,EAAgB,EAAA,EAAc;AAK3D,EAAA,MAAM,KAAA,EAAO,uCAAA,IAAiB,CAAK,CAAC,CAAC,CAAA;AACrC,EAAA,MAAM,KAAA,EAAO,uCAAA,EAAiB,CAAG,CAAC,CAAC,CAAA;AACnC,EAAA,IAAI,YAAA,EAAc,uCAAA,EAAiB,CAAG,CAAC,EAAA,EAAI,IAAA,CAAK,CAAC,CAAC,CAAA;AAElD,EAAA,GAAA,CAAI,YAAA,EAAc,IAAA,CAAK,EAAA,EAAI;AACzB,IAAA,YAAA,GAAe,EAAA,EAAI,IAAA,CAAK,EAAA;AAAA,EAC1B;AACA,EAAA,GAAA,CAAI,YAAA,EAAc,CAAC,IAAA,CAAK,EAAA,EAAI;AAC1B,IAAA,YAAA,GAAe,EAAA,EAAI,IAAA,CAAK,EAAA;AAAA,EAC1B;AAEA,EAAA,MAAM,SAAA,EAAW,IAAA,CAAK,GAAA;AAAA,IACpB,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,EAAA,EAAI,IAAA,CAAK,GAAA,EAAK,CAAC,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,EAAA,EAAI,IAAA,CAAK,GAAA,EAAK,CAAC;AAAA,EACpE,CAAA;AAEA,EAAA,MAAM,MAAA,EAAQ,IAAA,CAAK,KAAA,CAAM,WAAA,EAAa,QAAQ,CAAA;AAE9C,EAAA,OAAA,CAAQ,uCAAA,KAAsB,EAAA,EAAI,GAAA,EAAA,EAAO,GAAA;AAC3C;AAGA,IAAO,2BAAA,EAAQ,YAAA;ADnDf;AACE;AACA;AACF,kFAAC","file":"/home/runner/work/turf/turf/packages/turf-rhumb-bearing/dist/cjs/index.cjs","sourcesContent":[null,"// https://en.wikipedia.org/wiki/Rhumb_line\nimport { Coord, degreesToRadians, radiansToDegrees } from \"@turf/helpers\";\nimport { getCoord } from \"@turf/invariant\";\n\n/**\n * Takes two {@link Point|points} and finds the bearing angle between them along a Rhumb line\n * i.e. the angle measured in degrees start the north line (0 degrees)\n *\n * @function\n * @param {Coord} start starting Point\n * @param {Coord} end ending Point\n * @param {Object} [options] Optional parameters\n * @param {boolean} [options.final=false] calculates the final bearing if true\n * @returns {number} bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise)\n * @example\n * var point1 = turf.point([-75.343, 39.984], {\"marker-color\": \"#F00\"});\n * var point2 = turf.point([-75.534, 39.123], {\"marker-color\": \"#00F\"});\n *\n * var bearing = turf.rhumbBearing(point1, point2);\n *\n * //addToMap\n * var addToMap = [point1, point2];\n * point1.properties.bearing = bearing;\n * point2.properties.bearing = bearing;\n */\nfunction rhumbBearing(\n start: Coord,\n end: Coord,\n options: { final?: boolean } = {}\n): number {\n let bear360;\n if (options.final) {\n bear360 = calculateRhumbBearing(getCoord(end), getCoord(start));\n } else {\n bear360 = calculateRhumbBearing(getCoord(start), getCoord(end));\n }\n\n const bear180 = bear360 > 180 ? -(360 - bear360) : bear360;\n\n return bear180;\n}\n\n/**\n * Returns the bearing from ‘this’ point to destination point along a rhumb line.\n * Adapted from Geodesy: https://github.com/chrisveness/geodesy/blob/master/latlon-spherical.js\n *\n * @private\n * @param {Array<number>} from - origin point.\n * @param {Array<number>} to - destination point.\n * @returns {number} Bearing in degrees from north.\n * @example\n * var p1 = new LatLon(51.127, 1.338);\n * var p2 = new LatLon(50.964, 1.853);\n * var d = p1.rhumbBearingTo(p2); // 116.7 m\n */\nfunction calculateRhumbBearing(from: number[], to: number[]) {\n // φ => phi\n // Δλ => deltaLambda\n // Δψ => deltaPsi\n // θ => theta\n const phi1 = degreesToRadians(from[1]);\n const phi2 = degreesToRadians(to[1]);\n let deltaLambda = degreesToRadians(to[0] - from[0]);\n // if deltaLambdaon over 180° take shorter rhumb line across the anti-meridian:\n if (deltaLambda > Math.PI) {\n deltaLambda -= 2 * Math.PI;\n }\n if (deltaLambda < -Math.PI) {\n deltaLambda += 2 * Math.PI;\n }\n\n const deltaPsi = Math.log(\n Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4)\n );\n\n const theta = Math.atan2(deltaLambda, deltaPsi);\n\n return (radiansToDegrees(theta) + 360) % 360;\n}\n\nexport { rhumbBearing };\nexport default rhumbBearing;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { Coord } from '@turf/helpers';
|
|
|
4
4
|
* Takes two {@link Point|points} and finds the bearing angle between them along a Rhumb line
|
|
5
5
|
* i.e. the angle measured in degrees start the north line (0 degrees)
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @function
|
|
8
8
|
* @param {Coord} start starting Point
|
|
9
9
|
* @param {Coord} end ending Point
|
|
10
10
|
* @param {Object} [options] Optional parameters
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Coord } from '@turf/helpers';
|
|
|
4
4
|
* Takes two {@link Point|points} and finds the bearing angle between them along a Rhumb line
|
|
5
5
|
* i.e. the angle measured in degrees start the north line (0 degrees)
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @function
|
|
8
8
|
* @param {Coord} start starting Point
|
|
9
9
|
* @param {Coord} end ending Point
|
|
10
10
|
* @param {Object} [options] Optional parameters
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["// https://en.wikipedia.org/wiki/Rhumb_line\nimport { Coord, degreesToRadians, radiansToDegrees } from \"@turf/helpers\";\nimport { getCoord } from \"@turf/invariant\";\n\n/**\n * Takes two {@link Point|points} and finds the bearing angle between them along a Rhumb line\n * i.e. the angle measured in degrees start the north line (0 degrees)\n *\n * @
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["// https://en.wikipedia.org/wiki/Rhumb_line\nimport { Coord, degreesToRadians, radiansToDegrees } from \"@turf/helpers\";\nimport { getCoord } from \"@turf/invariant\";\n\n/**\n * Takes two {@link Point|points} and finds the bearing angle between them along a Rhumb line\n * i.e. the angle measured in degrees start the north line (0 degrees)\n *\n * @function\n * @param {Coord} start starting Point\n * @param {Coord} end ending Point\n * @param {Object} [options] Optional parameters\n * @param {boolean} [options.final=false] calculates the final bearing if true\n * @returns {number} bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise)\n * @example\n * var point1 = turf.point([-75.343, 39.984], {\"marker-color\": \"#F00\"});\n * var point2 = turf.point([-75.534, 39.123], {\"marker-color\": \"#00F\"});\n *\n * var bearing = turf.rhumbBearing(point1, point2);\n *\n * //addToMap\n * var addToMap = [point1, point2];\n * point1.properties.bearing = bearing;\n * point2.properties.bearing = bearing;\n */\nfunction rhumbBearing(\n start: Coord,\n end: Coord,\n options: { final?: boolean } = {}\n): number {\n let bear360;\n if (options.final) {\n bear360 = calculateRhumbBearing(getCoord(end), getCoord(start));\n } else {\n bear360 = calculateRhumbBearing(getCoord(start), getCoord(end));\n }\n\n const bear180 = bear360 > 180 ? -(360 - bear360) : bear360;\n\n return bear180;\n}\n\n/**\n * Returns the bearing from ‘this’ point to destination point along a rhumb line.\n * Adapted from Geodesy: https://github.com/chrisveness/geodesy/blob/master/latlon-spherical.js\n *\n * @private\n * @param {Array<number>} from - origin point.\n * @param {Array<number>} to - destination point.\n * @returns {number} Bearing in degrees from north.\n * @example\n * var p1 = new LatLon(51.127, 1.338);\n * var p2 = new LatLon(50.964, 1.853);\n * var d = p1.rhumbBearingTo(p2); // 116.7 m\n */\nfunction calculateRhumbBearing(from: number[], to: number[]) {\n // φ => phi\n // Δλ => deltaLambda\n // Δψ => deltaPsi\n // θ => theta\n const phi1 = degreesToRadians(from[1]);\n const phi2 = degreesToRadians(to[1]);\n let deltaLambda = degreesToRadians(to[0] - from[0]);\n // if deltaLambdaon over 180° take shorter rhumb line across the anti-meridian:\n if (deltaLambda > Math.PI) {\n deltaLambda -= 2 * Math.PI;\n }\n if (deltaLambda < -Math.PI) {\n deltaLambda += 2 * Math.PI;\n }\n\n const deltaPsi = Math.log(\n Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4)\n );\n\n const theta = Math.atan2(deltaLambda, deltaPsi);\n\n return (radiansToDegrees(theta) + 360) % 360;\n}\n\nexport { rhumbBearing };\nexport default rhumbBearing;\n"],"mappings":";AACA,SAAgB,kBAAkB,wBAAwB;AAC1D,SAAS,gBAAgB;AAuBzB,SAAS,aACP,OACA,KACA,UAA+B,CAAC,GACxB;AACR,MAAI;AACJ,MAAI,QAAQ,OAAO;AACjB,cAAU,sBAAsB,SAAS,GAAG,GAAG,SAAS,KAAK,CAAC;AAAA,EAChE,OAAO;AACL,cAAU,sBAAsB,SAAS,KAAK,GAAG,SAAS,GAAG,CAAC;AAAA,EAChE;AAEA,QAAM,UAAU,UAAU,MAAM,EAAE,MAAM,WAAW;AAEnD,SAAO;AACT;AAeA,SAAS,sBAAsB,MAAgB,IAAc;AAK3D,QAAM,OAAO,iBAAiB,KAAK,CAAC,CAAC;AACrC,QAAM,OAAO,iBAAiB,GAAG,CAAC,CAAC;AACnC,MAAI,cAAc,iBAAiB,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC;AAElD,MAAI,cAAc,KAAK,IAAI;AACzB,mBAAe,IAAI,KAAK;AAAA,EAC1B;AACA,MAAI,cAAc,CAAC,KAAK,IAAI;AAC1B,mBAAe,IAAI,KAAK;AAAA,EAC1B;AAEA,QAAM,WAAW,KAAK;AAAA,IACpB,KAAK,IAAI,OAAO,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,KAAK,CAAC;AAAA,EACpE;AAEA,QAAM,QAAQ,KAAK,MAAM,aAAa,QAAQ;AAE9C,UAAQ,iBAAiB,KAAK,IAAI,OAAO;AAC3C;AAGA,IAAO,6BAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/rhumb-bearing",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "turf rhumb-bearing module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -57,22 +57,22 @@
|
|
|
57
57
|
"test:tape": "tsx test.ts"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@turf/destination": "^7.
|
|
60
|
+
"@turf/destination": "^7.2.0",
|
|
61
61
|
"@types/benchmark": "^2.1.5",
|
|
62
|
-
"@types/tape": "^4.
|
|
62
|
+
"@types/tape": "^4.13.4",
|
|
63
63
|
"benchmark": "^2.1.4",
|
|
64
64
|
"npm-run-all": "^4.1.5",
|
|
65
|
-
"tape": "^5.
|
|
66
|
-
"tsup": "^8.
|
|
67
|
-
"tsx": "^4.
|
|
68
|
-
"typescript": "^5.
|
|
65
|
+
"tape": "^5.9.0",
|
|
66
|
+
"tsup": "^8.3.5",
|
|
67
|
+
"tsx": "^4.19.2",
|
|
68
|
+
"typescript": "^5.5.4",
|
|
69
69
|
"write-json-file": "^5.0.0"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@turf/helpers": "^7.
|
|
73
|
-
"@turf/invariant": "^7.
|
|
72
|
+
"@turf/helpers": "^7.2.0",
|
|
73
|
+
"@turf/invariant": "^7.2.0",
|
|
74
74
|
"@types/geojson": "^7946.0.10",
|
|
75
|
-
"tslib": "^2.
|
|
75
|
+
"tslib": "^2.8.1"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
|
|
78
78
|
}
|