+4
-4
@@ -367,3 +367,3 @@ /*! geolib 2.0.21 by Manuel Bieh | ||
| return this.distance = parseFloat((Math.round(distance / accuracy) * accuracy).toFixed(precision)); | ||
| return this.distance = Math.round(distance * Math.pow(10, precision) / accuracy) * accuracy / Math.pow(10, precision); | ||
@@ -950,3 +950,3 @@ /* | ||
| var distance = this.getDistance(latlng, coords[coord]); | ||
| var augmentedCoord = Object(coords[coord]); | ||
| var augmentedCoord = Object.create(coords[coord]); | ||
| augmentedCoord.distance = distance; | ||
@@ -975,3 +975,3 @@ augmentedCoord.key = coord; | ||
| return this.getDistance(start, point, 1, 3)+this.getDistance(point, end, 1, 3)==this.getDistance(start, end, 1, 3); | ||
| return (this.getDistance(start, point, 1, 3)+this.getDistance(point, end, 1, 3)).toFixed(3)==this.getDistance(start, end, 1, 3); | ||
| }, | ||
@@ -1023,3 +1023,3 @@ | ||
| else { | ||
| distance = Math.sin(alpha)/d1; | ||
| distance = Math.sin(alpha) * d1; | ||
| } | ||
@@ -1026,0 +1026,0 @@ |
+1
-1
@@ -50,4 +50,4 @@ { | ||
| }, | ||
| "version": "2.0.21", | ||
| "version": "2.0.22", | ||
| "main": "dist/geolib.js" | ||
| } |
+88
-2
@@ -16,3 +16,3 @@ # Geolib v2.0.21 | ||
| Return value is always an float and represents the distance in meters. | ||
| Return value is always float and represents the distance in meters. | ||
@@ -47,2 +47,17 @@ <h4>Examples</h4> | ||
| <h3>geolib.getDistanceSimple(object start, object end[, int accuracy])</h3> | ||
| Calculates the distance between two geo coordinates but this method is far more inaccurate as compared to getDistance. | ||
| It can take up 2 to 3 arguments. start, end and accuracy can be defined in the same as in getDistance. | ||
| Return value is always float that represents the distance in meters. | ||
| <h4>Examples</h4> | ||
| <pre>geolib.getDistanceSimple( | ||
| {latitude: 51.5103, longitude: 7.49347}, | ||
| {latitude: "51° 31' N", longitude: "7° 28' E"} | ||
| );</pre> | ||
| <h3>geolib.getCenter(array coords)</h3> | ||
@@ -93,2 +108,24 @@ | ||
| <h3>geolib.getBounds(array coords)</h3> | ||
| Calculates the bounds of geo coordinates. | ||
| It returns maximum and minimum, latitude, longitude, and elevation (if provided) in form of an object of form: | ||
| <pre>{ | ||
| "minLat": minimumLatitude, | ||
| "maxLat": maximumLatitude, | ||
| "minLng": minimumLongitude, | ||
| "maxLng": maximumLongitude, | ||
| "minElev": minimumElevation, | ||
| "maxElev": maximumElevation | ||
| }</pre> | ||
| <h4>Example</h4> | ||
| <pre>geolib.getCenter([ | ||
| {latitude: 52.516272, longitude: 13.377722}, | ||
| {latitude: 51.515, longitude: 7.453619}, | ||
| {latitude: 51.503333, longitude: -0.119722} | ||
| ]);</pre> | ||
| <h3>geolib.isPointInside(object latlng, array polygon)</h3> | ||
@@ -129,2 +166,51 @@ | ||
| <h3>geolib.getRhumbLineBearing(object originLL, object destLL)</h3> | ||
| Gets rhumb line bearing of two points. Find out about the difference between rhumb line and | ||
| great circle bearing on Wikipedia. Rhumb line should be fine in most cases: | ||
| http://en.wikipedia.org/wiki/Rhumb_line#General_and_mathematical_description | ||
| Function is heavily based on Doug Vanderweide's great PHP version (licensed under GPL 3.0) | ||
| http://www.dougv.com/2009/07/13/calculating-the-bearing-and-compass-rose-direction-between-two-latitude-longitude-coordinates-in-php/ | ||
| Returns calculated bearing as integer. | ||
| <h4>Example</h4> | ||
| <pre>geolib.getRhumbLineBearing( | ||
| {latitude: 52.518611, longitude: 13.408056}, | ||
| {latitude: 51.519475, longitude: 7.46694444} | ||
| );</pre> | ||
| <h3>geolib.getBearing(object originLL, object destLL)</h3> | ||
| Gets great circle bearing of two points. See description of getRhumbLineBearing for more information. | ||
| Returns calculated bearing as integer. | ||
| <h4>Example</h4> | ||
| <pre>geolib.getBearing( | ||
| {latitude: 52.518611, longitude: 13.408056}, | ||
| {latitude: 51.519475, longitude: 7.46694444} | ||
| );</pre> | ||
| <h3>geolib.getCompassDirection(object originLL, object destLL, string bearingMode (optional))</h3> | ||
| Gets the compass direction from an origin coordinate (originLL) to a destination coordinate (destLL). | ||
| Bearing mode. Can be either circle or rhumbline (default). | ||
| Returns an object with a rough (NESW) and an exact direction (NNE, NE, ENE, E, ESE, etc). | ||
| <h4>Example</h4> | ||
| <pre>geolib.getCompassDirection( | ||
| {latitude: 52.518611, longitude: 13.408056}, | ||
| {latitude: 51.519475, longitude: 7.46694444} | ||
| ); | ||
| //Output | ||
| { | ||
| rough: 'W', | ||
| exact: 'WSW' | ||
| }</pre> | ||
| <h3>geolib.orderByDistance(object latlng, mixed coords)</h3> | ||
@@ -307,3 +393,3 @@ | ||
| geolib.computeDestinationPoint(initialPoint.lat, initialPoint.lon, dist, bearing); | ||
| geolib.computeDestinationPoint(initialPoint, dist, bearing); | ||
| // -> {"latitude":51.52411853234181,"longitude":0.4668623365950795} | ||
@@ -310,0 +396,0 @@ </pre> |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
66396
4.42%404
27.04%