@turf/rhumb-distance
Advanced tools
Comparing version 6.2.0-alpha.2 to 6.2.0-alpha.3
@@ -32,3 +32,8 @@ // https://en.wikipedia.org/wiki/Rhumb_line | ||
// solution from https://github.com/mapbox/mapbox-gl-js/issues/3250#issuecomment-294887678 | ||
destination[0] += (destination[0] - origin[0] > 180) ? -360 : (origin[0] - destination[0] > 180) ? 360 : 0; | ||
destination[0] += | ||
destination[0] - origin[0] > 180 | ||
? -360 | ||
: origin[0] - destination[0] > 180 | ||
? 360 | ||
: 0; | ||
var distanceInMeters = calculateRhumbDistance(origin, destination); | ||
@@ -60,9 +65,9 @@ var distance = convertLength(distanceInMeters, "meters", options.units); | ||
// θ => theta | ||
radius = (radius === undefined) ? earthRadius : Number(radius); | ||
radius = radius === undefined ? earthRadius : Number(radius); | ||
// see www.edwilliams.org/avform.htm#Rhumb | ||
var R = radius; | ||
var phi1 = origin[1] * Math.PI / 180; | ||
var phi2 = destination[1] * Math.PI / 180; | ||
var phi1 = (origin[1] * Math.PI) / 180; | ||
var phi2 = (destination[1] * Math.PI) / 180; | ||
var DeltaPhi = phi2 - phi1; | ||
var DeltaLambda = Math.abs(destination[0] - origin[0]) * Math.PI / 180; | ||
var DeltaLambda = (Math.abs(destination[0] - origin[0]) * Math.PI) / 180; | ||
// if dLon over 180° take shorter rhumb line across the anti-meridian: | ||
@@ -69,0 +74,0 @@ if (DeltaLambda > Math.PI) { |
@@ -34,3 +34,8 @@ "use strict"; | ||
// solution from https://github.com/mapbox/mapbox-gl-js/issues/3250#issuecomment-294887678 | ||
destination[0] += (destination[0] - origin[0] > 180) ? -360 : (origin[0] - destination[0] > 180) ? 360 : 0; | ||
destination[0] += | ||
destination[0] - origin[0] > 180 | ||
? -360 | ||
: origin[0] - destination[0] > 180 | ||
? 360 | ||
: 0; | ||
var distanceInMeters = calculateRhumbDistance(origin, destination); | ||
@@ -62,9 +67,9 @@ var distance = helpers_1.convertLength(distanceInMeters, "meters", options.units); | ||
// θ => theta | ||
radius = (radius === undefined) ? helpers_1.earthRadius : Number(radius); | ||
radius = radius === undefined ? helpers_1.earthRadius : Number(radius); | ||
// see www.edwilliams.org/avform.htm#Rhumb | ||
var R = radius; | ||
var phi1 = origin[1] * Math.PI / 180; | ||
var phi2 = destination[1] * Math.PI / 180; | ||
var phi1 = (origin[1] * Math.PI) / 180; | ||
var phi2 = (destination[1] * Math.PI) / 180; | ||
var DeltaPhi = phi2 - phi1; | ||
var DeltaLambda = Math.abs(destination[0] - origin[0]) * Math.PI / 180; | ||
var DeltaLambda = (Math.abs(destination[0] - origin[0]) * Math.PI) / 180; | ||
// if dLon over 180° take shorter rhumb line across the anti-meridian: | ||
@@ -71,0 +76,0 @@ if (DeltaLambda > Math.PI) { |
{ | ||
"name": "@turf/rhumb-distance", | ||
"version": "6.2.0-alpha.2", | ||
"version": "6.2.0-alpha.3", | ||
"description": "turf rhumb-distance module", | ||
@@ -34,2 +34,6 @@ "author": "Turf Authors", | ||
"module": "dist/es/index.js", | ||
"exports": { | ||
"import": "./dist/es/index.js", | ||
"require": "./dist/js/index.js" | ||
}, | ||
"types": "dist/js/index.d.ts", | ||
@@ -41,13 +45,12 @@ "sideEffects": false, | ||
"scripts": { | ||
"bench": "npm-run-all prepare bench:run", | ||
"bench:run": "node bench.js", | ||
"bench": "ts-node bench.js", | ||
"build": "npm-run-all build:*", | ||
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", | ||
"build:js": "tsc", | ||
"docs": "node ../../scripts/generate-readmes", | ||
"prepare": "npm-run-all prepare:*", | ||
"prepare:es": "tsc --outDir dist/es --module esnext --declaration false", | ||
"prepare:js": "tsc", | ||
"test": "npm-run-all prepare test:*", | ||
"test:tape": "node -r esm test.js" | ||
"test": "npm-run-all test:*", | ||
"test:tape": "ts-node -r esm test.js" | ||
}, | ||
"devDependencies": { | ||
"@turf/distance": "^6.2.0-alpha.2", | ||
"@turf/distance": "^6.2.0-alpha.3", | ||
"@types/tape": "*", | ||
@@ -58,2 +61,3 @@ "benchmark": "*", | ||
"tape": "*", | ||
"ts-node": "*", | ||
"tslint": "*", | ||
@@ -64,6 +68,6 @@ "typescript": "*", | ||
"dependencies": { | ||
"@turf/helpers": "^6.2.0-alpha.2", | ||
"@turf/invariant": "^6.2.0-alpha.2" | ||
"@turf/helpers": "^6.2.0-alpha.3", | ||
"@turf/invariant": "^6.2.0-alpha.3" | ||
}, | ||
"gitHead": "23d5cb91d77e0c1e2e903a2252f525797f1d0d09" | ||
"gitHead": "dce9edfc705352e8cb9e0083c9330ba0e8d77409" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12825
7
197
10