@turf/destination 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/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/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-destination/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACGA;AAEE;AACA;AACA;AACA;AAAA,wCAEK;AACP,4CAAyB;AA4BzB,SAAS,WAAA,CACP,MAAA,EACA,QAAA,EACA,OAAA,EACA,QAAA,EAGI,CAAC,CAAA,EACc;AAEnB,EAAA,MAAM,aAAA,EAAe,iCAAA,MAAe,CAAA;AACpC,EAAA,MAAM,WAAA,EAAa,uCAAA,YAAiB,CAAa,CAAC,CAAC,CAAA;AACnD,EAAA,MAAM,UAAA,EAAY,uCAAA,YAAiB,CAAa,CAAC,CAAC,CAAA;AAClD,EAAA,MAAM,WAAA,EAAa,uCAAA,OAAwB,CAAA;AAC3C,EAAA,MAAM,QAAA,EAAU,sCAAA,QAAgB,EAAU,OAAA,CAAQ,KAAK,CAAA;AAGvD,EAAA,MAAM,UAAA,EAAY,IAAA,CAAK,IAAA;AAAA,IACrB,IAAA,CAAK,GAAA,CAAI,SAAS,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,OAAO,EAAA,EACpC,IAAA,CAAK,GAAA,CAAI,SAAS,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,OAAO,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,UAAU;AAAA,EACjE,CAAA;AACA,EAAA,MAAM,WAAA,EACJ,WAAA,EACA,IAAA,CAAK,KAAA;AAAA,IACH,IAAA,CAAK,GAAA,CAAI,UAAU,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,OAAO,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,SAAS,CAAA;AAAA,IAC7D,IAAA,CAAK,GAAA,CAAI,OAAO,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,SAAS,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,SAAS;AAAA,EAC9D,CAAA;AACF,EAAA,MAAM,IAAA,EAAM,uCAAA,UAA2B,CAAA;AACvC,EAAA,MAAM,IAAA,EAAM,uCAAA,SAA0B,CAAA;AAEtC,EAAA,OAAO,4BAAA,CAAO,GAAA,EAAK,GAAG,CAAA,EAAG,OAAA,CAAQ,UAAU,CAAA;AAC7C;AAGA,IAAO,yBAAA,EAAQ,WAAA;AD/Cf;AACE;AACA;AACF,8EAAC","file":"/home/runner/work/turf/turf/packages/turf-destination/dist/cjs/index.cjs","sourcesContent":[null,"// http://en.wikipedia.org/wiki/Haversine_formula\n// http://www.movable-type.co.uk/scripts/latlong.html\nimport { Feature, Point, GeoJsonProperties } from \"geojson\";\nimport {\n Coord,\n degreesToRadians,\n lengthToRadians,\n point,\n radiansToDegrees,\n Units,\n} from \"@turf/helpers\";\nimport { getCoord } from \"@turf/invariant\";\n\n/**\n * Takes a {@link Point} and calculates the location of a destination point given a distance in\n * degrees, radians, miles, or kilometers; and bearing in degrees.\n * This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.\n *\n * @function\n * @param {Coord} origin starting point\n * @param {number} distance distance from the origin point\n * @param {number} bearing ranging from -180 to 180\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians\n * @param {Object} [options.properties={}] Translate properties to Point\n * @returns {Feature<Point>} destination point\n * @example\n * var point = turf.point([-75.343, 39.984]);\n * var distance = 50;\n * var bearing = 90;\n * var options = {units: 'miles'};\n *\n * var destination = turf.destination(point, distance, bearing, options);\n *\n * //addToMap\n * var addToMap = [point, destination]\n * destination.properties['marker-color'] = '#f00';\n * point.properties['marker-color'] = '#0f0';\n */\nfunction destination<P extends GeoJsonProperties = GeoJsonProperties>(\n origin: Coord,\n distance: number,\n bearing: number,\n options: {\n units?: Units;\n properties?: P;\n } = {}\n): Feature<Point, P> {\n // Handle input\n const coordinates1 = getCoord(origin);\n const longitude1 = degreesToRadians(coordinates1[0]);\n const latitude1 = degreesToRadians(coordinates1[1]);\n const bearingRad = degreesToRadians(bearing);\n const radians = lengthToRadians(distance, options.units);\n\n // Main\n const latitude2 = Math.asin(\n Math.sin(latitude1) * Math.cos(radians) +\n Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad)\n );\n const longitude2 =\n longitude1 +\n Math.atan2(\n Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1),\n Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2)\n );\n const lng = radiansToDegrees(longitude2);\n const lat = radiansToDegrees(latitude2);\n\n return point([lng, lat], options.properties);\n}\n\nexport { destination };\nexport default destination;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ import { Coord, Units } from '@turf/helpers';
|
|
|
6
6
|
* degrees, radians, miles, or kilometers; and bearing in degrees.
|
|
7
7
|
* This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
9
|
+
* @function
|
|
10
10
|
* @param {Coord} origin starting point
|
|
11
11
|
* @param {number} distance distance from the origin point
|
|
12
12
|
* @param {number} bearing ranging from -180 to 180
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Coord, Units } from '@turf/helpers';
|
|
|
6
6
|
* degrees, radians, miles, or kilometers; and bearing in degrees.
|
|
7
7
|
* This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
9
|
+
* @function
|
|
10
10
|
* @param {Coord} origin starting point
|
|
11
11
|
* @param {number} distance distance from the origin point
|
|
12
12
|
* @param {number} bearing ranging from -180 to 180
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["// http://en.wikipedia.org/wiki/Haversine_formula\n// http://www.movable-type.co.uk/scripts/latlong.html\nimport { Feature, Point, GeoJsonProperties } from \"geojson\";\nimport {\n Coord,\n degreesToRadians,\n lengthToRadians,\n point,\n radiansToDegrees,\n Units,\n} from \"@turf/helpers\";\nimport { getCoord } from \"@turf/invariant\";\n\n/**\n * Takes a {@link Point} and calculates the location of a destination point given a distance in\n * degrees, radians, miles, or kilometers; and bearing in degrees.\n * This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.\n *\n * @
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["// http://en.wikipedia.org/wiki/Haversine_formula\n// http://www.movable-type.co.uk/scripts/latlong.html\nimport { Feature, Point, GeoJsonProperties } from \"geojson\";\nimport {\n Coord,\n degreesToRadians,\n lengthToRadians,\n point,\n radiansToDegrees,\n Units,\n} from \"@turf/helpers\";\nimport { getCoord } from \"@turf/invariant\";\n\n/**\n * Takes a {@link Point} and calculates the location of a destination point given a distance in\n * degrees, radians, miles, or kilometers; and bearing in degrees.\n * This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.\n *\n * @function\n * @param {Coord} origin starting point\n * @param {number} distance distance from the origin point\n * @param {number} bearing ranging from -180 to 180\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians\n * @param {Object} [options.properties={}] Translate properties to Point\n * @returns {Feature<Point>} destination point\n * @example\n * var point = turf.point([-75.343, 39.984]);\n * var distance = 50;\n * var bearing = 90;\n * var options = {units: 'miles'};\n *\n * var destination = turf.destination(point, distance, bearing, options);\n *\n * //addToMap\n * var addToMap = [point, destination]\n * destination.properties['marker-color'] = '#f00';\n * point.properties['marker-color'] = '#0f0';\n */\nfunction destination<P extends GeoJsonProperties = GeoJsonProperties>(\n origin: Coord,\n distance: number,\n bearing: number,\n options: {\n units?: Units;\n properties?: P;\n } = {}\n): Feature<Point, P> {\n // Handle input\n const coordinates1 = getCoord(origin);\n const longitude1 = degreesToRadians(coordinates1[0]);\n const latitude1 = degreesToRadians(coordinates1[1]);\n const bearingRad = degreesToRadians(bearing);\n const radians = lengthToRadians(distance, options.units);\n\n // Main\n const latitude2 = Math.asin(\n Math.sin(latitude1) * Math.cos(radians) +\n Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad)\n );\n const longitude2 =\n longitude1 +\n Math.atan2(\n Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1),\n Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2)\n );\n const lng = radiansToDegrees(longitude2);\n const lat = radiansToDegrees(latitude2);\n\n return point([lng, lat], options.properties);\n}\n\nexport { destination };\nexport default destination;\n"],"mappings":";AAGA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,gBAAgB;AA4BzB,SAAS,YACP,QACA,UACA,SACA,UAGI,CAAC,GACc;AAEnB,QAAM,eAAe,SAAS,MAAM;AACpC,QAAM,aAAa,iBAAiB,aAAa,CAAC,CAAC;AACnD,QAAM,YAAY,iBAAiB,aAAa,CAAC,CAAC;AAClD,QAAM,aAAa,iBAAiB,OAAO;AAC3C,QAAM,UAAU,gBAAgB,UAAU,QAAQ,KAAK;AAGvD,QAAM,YAAY,KAAK;AAAA,IACrB,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,IACpC,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,IAAI,UAAU;AAAA,EACjE;AACA,QAAM,aACJ,aACA,KAAK;AAAA,IACH,KAAK,IAAI,UAAU,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,IAAI,SAAS;AAAA,IAC7D,KAAK,IAAI,OAAO,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,SAAS;AAAA,EAC9D;AACF,QAAM,MAAM,iBAAiB,UAAU;AACvC,QAAM,MAAM,iBAAiB,SAAS;AAEtC,SAAO,MAAM,CAAC,KAAK,GAAG,GAAG,QAAQ,UAAU;AAC7C;AAGA,IAAO,2BAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/destination",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "turf destination module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,24 +53,24 @@
|
|
|
53
53
|
"test:tape": "tsx test.ts"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@turf/truncate": "^7.
|
|
56
|
+
"@turf/truncate": "^7.2.0",
|
|
57
57
|
"@types/benchmark": "^2.1.5",
|
|
58
|
-
"@types/tape": "^4.
|
|
58
|
+
"@types/tape": "^4.13.4",
|
|
59
59
|
"benchmark": "^2.1.4",
|
|
60
60
|
"glob": "^10.3.10",
|
|
61
61
|
"load-json-file": "^7.0.1",
|
|
62
62
|
"npm-run-all": "^4.1.5",
|
|
63
|
-
"tape": "^5.
|
|
64
|
-
"tsup": "^8.
|
|
65
|
-
"tsx": "^4.
|
|
66
|
-
"typescript": "^5.
|
|
63
|
+
"tape": "^5.9.0",
|
|
64
|
+
"tsup": "^8.3.5",
|
|
65
|
+
"tsx": "^4.19.2",
|
|
66
|
+
"typescript": "^5.5.4",
|
|
67
67
|
"write-json-file": "^5.0.0"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@turf/helpers": "^7.
|
|
71
|
-
"@turf/invariant": "^7.
|
|
70
|
+
"@turf/helpers": "^7.2.0",
|
|
71
|
+
"@turf/invariant": "^7.2.0",
|
|
72
72
|
"@types/geojson": "^7946.0.10",
|
|
73
|
-
"tslib": "^2.
|
|
73
|
+
"tslib": "^2.8.1"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
|
|
76
76
|
}
|