Socket
Socket
Sign inDemoInstall

geo-point

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geo-point - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

13

lib/geo-point.js

@@ -103,8 +103,11 @@ 'use strict';

static calculateBearing(point1, point2) {
const dLongitude = point2.longitude - point1.longitude;
const y = (cos(point1.latitude) * sin(point2.latitude)) - (sin(point1.latitude) * cos(point2.latitude) * cos(dLongitude));
const x = sin(dLongitude) * cos(point2.latitude);
const bearing = deg2rad(atan2(x, y));
const φ1 = deg2rad(point1.latitude), φ2 = deg2rad(point2.latitude);
const Δλ = deg2rad(point2.longitude - point1.longitude);
return 360 - (bearing + 360) % 360;
// see http://mathforum.org/library/drmath/view/55417.html
const y = sin(Δλ) * cos(φ2);
const x = cos(φ1) * sin(φ2) - sin(φ1) * cos(φ2) * cos(Δλ);
const θ = atan2(y, x);
return (rad2deg(θ) + 360) % 360;
}

@@ -111,0 +114,0 @@

{
"name": "geo-point",
"version": "1.1.1",
"version": "1.1.2",
"description": "geo point",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -65,3 +65,3 @@ 'use strict';

new GeoPoint(51.5, 1.15)
)).should.equals(360);
)).should.equals(89);

@@ -71,3 +71,8 @@ GeoPoint.calculateBearing(

new GeoPoint(52, 0)
).should.equals(360);
).should.equals(0);
Math.round(GeoPoint.calculateBearing(
new GeoPoint(-6.231624, 106.802569),
new GeoPoint(-6.22063, 106.61694)
)).should.equals(273);
});

@@ -74,0 +79,0 @@

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