Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turf-destination

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-destination - npm Package Compare versions

Comparing version 0.0.5 to 1.0.0

.travis.yml

26

index.js
//http://en.wikipedia.org/wiki/Haversine_formula
//http://www.movable-type.co.uk/scripts/latlong.html
var point = require('turf-point')
var point = require('turf-point');
module.exports = function (point1, distance, bearing, units) {
var coordinates1 = point1.geometry.coordinates
var longitude1 = toRad(coordinates1[0])
var latitude1 = toRad(coordinates1[1])
var bearing_rad = toRad(bearing)
var coordinates1 = point1.geometry.coordinates;
var longitude1 = toRad(coordinates1[0]);
var latitude1 = toRad(coordinates1[1]);
var bearing_rad = toRad(bearing);
var R = 0
var R = 0;
switch (units) {
case 'miles':
R = 3960
R = 3960;
break
case 'kilometers':
R = 6373
R = 6373;
break
case 'degrees':
R = 57.2957795
R = 57.2957795;
break
case 'radians':
R = 1
R = 1;
break

@@ -32,11 +32,11 @@ }

return point(toDeg(longitude2), toDeg(latitude2))
return point(toDeg(longitude2), toDeg(latitude2));
};
function toRad(degree) {
return degree * Math.PI / 180
return degree * Math.PI / 180;
}
function toDeg(rad) {
return rad * 180 / Math.PI
return rad * 180 / Math.PI;
}
{
"name": "turf-destination",
"version": "0.0.5",
"version": "1.0.0",
"description": "turf destination module",

@@ -28,8 +28,9 @@ "main": "index.js",

"devDependencies": {
"tape": "^2.13.3",
"turf-distance": "^0.1.4"
"benchmark": "^1.0.0",
"tape": "^3.0.3",
"turf-distance": "^0.1.5"
},
"dependencies": {
"turf-point": "^0.1.1"
"turf-point": "^1.2.0"
}
}
turf-destination
=============
[![build status](https://secure.travis-ci.org/Turfjs/turf-destination.png)](http://travis-ci.org/Turfjs/turf-destination)

@@ -17,3 +18,3 @@ Calculates the destination point given one point feature, distance in degrees, radians, miles, or kilometers, and bearing in degrees. This uses the haversine formula to account for global curvature.

|point1|point feature|
|distance|point feature|
|distance|distance units|
|bearing|number (-180 - 180)|

@@ -20,0 +21,0 @@ |units|'miles' or 'kilometers'|

@@ -1,4 +0,4 @@

var test = require('tape')
var distance = require('turf-distance')
var destination = require('./')
var test = require('tape');
var distance = require('turf-distance');
var destination = require('./');

@@ -9,9 +9,9 @@ test('destination', function(t){

"geometry": {"type": "Point", "coordinates": [-75.0, 39.0]}
}
var dist = 100
var bear = 180
};
var dist = 100;
var bear = 180;
var pt2 = destination(pt1, dist, bear, 'kilometers')
t.ok(pt2, 'should return a point')
t.end()
})
var pt2 = destination(pt1, dist, bear, 'kilometers');
t.ok(pt2, 'should return a point');
t.end();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc