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

geolib

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geolib - npm Package Compare versions

Comparing version 3.2.2 to 3.3.0

80

CHANGELOG.md

@@ -1,81 +0,15 @@

# Changelog
## [3.3.0](https://github.com/manuelbieh/geolib/compare/v3.2.2...v3.3.0) (2020-05-24)
## Breaking Changes in 3.0.0 and migration from 2.x.x
In version 3.0.0 I'm trying to get a little bit _back to the roots_. **Geolib** was once started because I needed a handful of methods to perform very specific geo related tasks like getting the distance or the direction between two points. Since it was one of the very first libraries on npm back then to do these kind of things in a very simple way it became very popular (with more than 300k downloads per month as of April 2019!) and as a consequence got a lot of contributions over the years. Many of which I just merged as long as they had accompanying tests, without looking at consistency, conventions, complexity, coding style or even the overall quality of the functions that I sometimes didn't even fully understand.
### 🧩 Features
I have now cleaned up the codebase completely, rebuilt the entire library "from scratch", unified all the function arguments, removed a few functions where I wasn't sure if they should be in here (feel free to add them back of you're using them!) or if they were even used (did a few searches on GitHub for the function names, turned out there are zero results).
* re-export constants so they can be used by library consumers ([1a5e214](https://github.com/manuelbieh/geolib/commit/1a5e214b78f15ef9783d0fda5c22c97c39c71a13))
Elevation support was dropped, as well as a few functions that unnecessarily made the library really large in size (e.g. `isPointInsideRobust` alone was over 700[!] lines of code and was basically taken from a [different library](https://github.com/mikolalysenko/robust-point-in-polygon)).
I removed Grunt from the build process, added "modern" tools like ESLint and Prettier. I switched from Travis CI to Circle CI and I am in the process of further automating the release process of new versions using `semantic-release` and `conventional-commits`. I also switched from pure JavaScript to TypeScript because I think it does have some benefits.
### 💉 Improvements
- All functions are pure functions now. No input data is mutated anymore. You give the same input, you get the same output. No side effects or whatsoever.
- I changed the default `getDistance` function from being the slow, accurate one to being the fast, slightly inaccurate one. The old `getDistance` function is now named `getPreciseDistance` while the old `getDistanceSimple` function is now the default `getDistance` function. You can, however, pass `getPreciseDistance` as argument to any function that uses distance calculation internally.
- Artificial limitation to 8 decimal places in decimal coordinates was removed
- `getBoundsOfDistance()` now returns the _exact_ coordinates due to the removal of the artificial 8 decimal place limitation
- `getCompassDirection()` does no longer return an object with an _exact_ and a _rough_ direction but only the exact direction as string
- third argument to `getCompassDirection()` is no longer a string ("circle", "line") but a function to determine the bearing (you can pass `getRhumbLineBearing` or `getGreatCircleBearing`). The function receives the origin and the destination as first and second argument. If no 3rd argument was given, `getRhumbLineBearing(origin, dest)` is used by default.
- There is now a new helper function `roughCompassDirection(exact)` if you _really_ only need a very rough (and potentially inaccurate or inappropriate) direction. Better don't use it.
- `orderByDistance()` does no longer modify its input so does not add a `distance` and `key` property to the returned coordinates.
- The result of `getSpeed()` is now always returned as **meters per second**. It can be converted using the new convenience function `convertSpeed(mps, targetUnit)`
- Relevant value (usually point or distance) is now consistently the **first** argument for each function (it wasn't before, how confusing is that?)
- `findNearest()` does no longer take `offset` and `limit` arguments. It's only a convenience method to get the single one nearest point from a set of coordinates. If you need more than one, have a look at the implementation and implement your own logic using `orderByDistance`
- Whereever distances are involved, they are returned as meters or meters per second. No more inconsistent defaults like kilometers or kilometers per hour.
- The method how sexagesimal is formatted differs a little bit. It may now potentially return ugly float point units like `52° 46' 21.0004"` in rare cases but it is also more accurate than it was before.
- Dropped support for Meteor (feel free to add it back if you like)
* update all deps and make release workflow work with external config ([2cf5513](https://github.com/manuelbieh/geolib/commit/2cf5513992ba431414212596d6858cf6765cf8c5))
* update node image during ci ([17c821f](https://github.com/manuelbieh/geolib/commit/17c821f0104f75af1e37d90bd92e7eee2065fb71))
* use external release-config to publish new releases with automated CHANGELOG.md ([81b4bce](https://github.com/manuelbieh/geolib/commit/81b4bce833abea83fecd538126c348f27eee1810))
### ✅ Functions with the same name
- `computeDestinationPoint`
- `getBounds`
- `getBoundsOfDistance`
- `getCenter`
- `getCenterOfBounds`
- `getCompassDirection`
- `getDistanceFromLine`
- `getPathLength`
- `getRhumbLineBearing`
- `getSpeed`
- `isDecimal`
- `isPointInLine`
- `isPointNearLine`
- `isSexagesimal`
- `orderByDistance`
### ❗ Renamed functions
- `getKeys` renamed to `getCoordinateKeys`
- `validate` renamed to `isValidCoordinate`
- `getLat` renamed to `getLatitude`
- `getLon` renamed to `getLongitude`
- `latitude` -> renamed to `getLatitude`
- `longitude` -> renamed to `getLongitude`
- `convertUnit` -> remamed to convertDistance, because name was too ambiguous
- `useDecimal` renamed to `toDecimal`
- `decimal2sexagesimal` renamed to `decimalToSexagesimal`
- `sexagesimal2decimal` renamed to `sexagesimalToDecimal`
- `getDistance` renamed to `getPreciseDistance`
- `getDistanceSimple` renamed to `getDistance`
- `isPointInside` renamed to `isPointInPolygon`
- `isPointInCircle` renamed to `isPointWithinRadius`
- `getBearing` renamed to `getGreatCircleBearing` to be more explicit
### 🗑 Removed functions
- `getElev` -> removed
- `elevation` -> removed
- `coords` -> removed (might be re-added as getCoordinate or getNormalizedCoordinate)
- `ll` -> removed (because wtf?)
- `preparePolygonForIsPointInsideOptimized` -> removed due to missing documentation and missing tests
- `isPointInsideWithPreparedPolygon` -> removed due to missing documentation
- `isInside` alias -> removed (too ambiguous) - use `isPointInPolygon` or `isPointWithinRadius`
- `withinRadius` -> removed, use `isPointWithinRadius`
- `getDirection` alias -> removed (unnecessary clutter) - use `getCompassDirection`
### 🆕 Added functions
- `getAreaOfPolygon` to calculate the area of a polygon
- `getCoordinateKey` to get a property name (e.g. `lat` or `lng` of an object based on an array of possible names)
## v2.0.24

@@ -82,0 +16,0 @@

2

es/decimalToSexagesimal.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(arr,i){if(!(Symbol.iterator in Object(arr)||Object.prototype.toString.call(arr)==="[object Arguments]")){return}var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}var imprecise=function imprecise(number){var factor=Math.pow(10,12);return Math.round(number*factor)/factor};var decimal2sexagesimal=function decimal2sexagesimal(decimal){var _decimal$toString$spl=decimal.toString().split("."),_decimal$toString$spl2=_slicedToArray(_decimal$toString$spl,2),pre=_decimal$toString$spl2[0],post=_decimal$toString$spl2[1];var deg=Math.abs(Number(pre));var minFull=imprecise(Number("0."+(post||0))*60);var min=Math.floor(minFull);var sec=imprecise((minFull%min||0)*60);return deg+"\xB0 "+Number(min.toFixed(6)).toString().split(".").map(function(v,i){return i===0?v.padStart(2,"0"):v}).join(".")+"' "+Number(sec.toFixed(4)).toString().split(".").map(function(v,i){return i===0?v.padStart(2,"0"):v}).join(".")+"\""};var _default=decimal2sexagesimal;exports.default=_default;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i]}return arr2}function _iterableToArrayLimit(arr,i){if(typeof Symbol==="undefined"||!(Symbol.iterator in Object(arr)))return;var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}var imprecise=function imprecise(number){var factor=Math.pow(10,12);return Math.round(number*factor)/factor};var decimal2sexagesimal=function decimal2sexagesimal(decimal){var _decimal$toString$spl=decimal.toString().split("."),_decimal$toString$spl2=_slicedToArray(_decimal$toString$spl,2),pre=_decimal$toString$spl2[0],post=_decimal$toString$spl2[1];var deg=Math.abs(Number(pre));var minFull=imprecise(Number("0."+(post||0))*60);var min=Math.floor(minFull);var sec=imprecise((minFull%min||0)*60);return deg+"\xB0 "+Number(min.toFixed(6)).toString().split(".").map(function(v,i){return i===0?v.padStart(2,"0"):v}).join(".")+"' "+Number(sec.toFixed(4)).toString().split(".").map(function(v,i){return i===0?v.padStart(2,"0"):v}).join(".")+"\""};var _default=decimal2sexagesimal;exports.default=_default;

@@ -7,9 +7,6 @@ import { GeolibInputCoordinates, LatitudeKeys, LongitudeKeys, AltitudeKeys } from './types';

}) => {
altitude: AltitudeKeys;
altitude?: AltitudeKeys;
latitude: "lat" | "latitude" | 1 | undefined;
longitude: 0 | "lng" | "lon" | "longitude" | undefined;
} | {
latitude: "lat" | "latitude" | 1 | undefined;
longitude: 0 | "lng" | "lon" | "longitude" | undefined;
};
export default getCoordinateKeys;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _getDistance=_interopRequireDefault(require("./getDistance"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}var getPathLength=function getPathLength(points){var distanceFn=arguments.length>1&&arguments[1]!==undefined?arguments[1]:_getDistance.default;return points.reduce(function(acc,point){if(_typeof(acc)==="object"&&acc.last!==null){acc.distance+=distanceFn(point,acc.last)}acc.last=point;return acc},{last:null,distance:0}).distance};var _default=getPathLength;exports.default=_default;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _getDistance=_interopRequireDefault(require("./getDistance"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}var getPathLength=function getPathLength(points){var distanceFn=arguments.length>1&&arguments[1]!==undefined?arguments[1]:_getDistance.default;return points.reduce(function(acc,point){if(_typeof(acc)==="object"&&acc.last!==null){acc.distance+=distanceFn(point,acc.last)}acc.last=point;return acc},{last:null,distance:0}).distance};var _default=getPathLength;exports.default=_default;

@@ -39,1 +39,2 @@ export { default as computeDestinationPoint } from './computeDestinationPoint';

export { default as toDeg } from './toDeg';
export * from './constants';

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

"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"computeDestinationPoint",{enumerable:true,get:function get(){return _computeDestinationPoint.default}});Object.defineProperty(exports,"convertArea",{enumerable:true,get:function get(){return _convertArea.default}});Object.defineProperty(exports,"convertDistance",{enumerable:true,get:function get(){return _convertDistance.default}});Object.defineProperty(exports,"convertSpeed",{enumerable:true,get:function get(){return _convertSpeed.default}});Object.defineProperty(exports,"decimalToSexagesimal",{enumerable:true,get:function get(){return _decimalToSexagesimal.default}});Object.defineProperty(exports,"findNearest",{enumerable:true,get:function get(){return _findNearest.default}});Object.defineProperty(exports,"getAreaOfPolygon",{enumerable:true,get:function get(){return _getAreaOfPolygon.default}});Object.defineProperty(exports,"getBounds",{enumerable:true,get:function get(){return _getBounds.default}});Object.defineProperty(exports,"getBoundsOfDistance",{enumerable:true,get:function get(){return _getBoundsOfDistance.default}});Object.defineProperty(exports,"getCenter",{enumerable:true,get:function get(){return _getCenter.default}});Object.defineProperty(exports,"getCenterOfBounds",{enumerable:true,get:function get(){return _getCenterOfBounds.default}});Object.defineProperty(exports,"getCompassDirection",{enumerable:true,get:function get(){return _getCompassDirection.default}});Object.defineProperty(exports,"getCoordinateKey",{enumerable:true,get:function get(){return _getCoordinateKey.default}});Object.defineProperty(exports,"getCoordinateKeys",{enumerable:true,get:function get(){return _getCoordinateKeys.default}});Object.defineProperty(exports,"getDistance",{enumerable:true,get:function get(){return _getDistance.default}});Object.defineProperty(exports,"getDistanceFromLine",{enumerable:true,get:function get(){return _getDistanceFromLine.default}});Object.defineProperty(exports,"getGreatCircleBearing",{enumerable:true,get:function get(){return _getGreatCircleBearing.default}});Object.defineProperty(exports,"getLatitude",{enumerable:true,get:function get(){return _getLatitude.default}});Object.defineProperty(exports,"getLongitude",{enumerable:true,get:function get(){return _getLongitude.default}});Object.defineProperty(exports,"getPathLength",{enumerable:true,get:function get(){return _getPathLength.default}});Object.defineProperty(exports,"getPreciseDistance",{enumerable:true,get:function get(){return _getPreciseDistance.default}});Object.defineProperty(exports,"getRhumbLineBearing",{enumerable:true,get:function get(){return _getRhumbLineBearing.default}});Object.defineProperty(exports,"getRoughCompassDirection",{enumerable:true,get:function get(){return _getRoughCompassDirection.default}});Object.defineProperty(exports,"getSpeed",{enumerable:true,get:function get(){return _getSpeed.default}});Object.defineProperty(exports,"isDecimal",{enumerable:true,get:function get(){return _isDecimal.default}});Object.defineProperty(exports,"isPointInLine",{enumerable:true,get:function get(){return _isPointInLine.default}});Object.defineProperty(exports,"isPointInPolygon",{enumerable:true,get:function get(){return _isPointInPolygon.default}});Object.defineProperty(exports,"isPointNearLine",{enumerable:true,get:function get(){return _isPointNearLine.default}});Object.defineProperty(exports,"isPointWithinRadius",{enumerable:true,get:function get(){return _isPointWithinRadius.default}});Object.defineProperty(exports,"isSexagesimal",{enumerable:true,get:function get(){return _isSexagesimal.default}});Object.defineProperty(exports,"isValidCoordinate",{enumerable:true,get:function get(){return _isValidCoordinate.default}});Object.defineProperty(exports,"isValidLatitude",{enumerable:true,get:function get(){return _isValidLatitude.default}});Object.defineProperty(exports,"isValidLongitude",{enumerable:true,get:function get(){return _isValidLongitude.default}});Object.defineProperty(exports,"orderByDistance",{enumerable:true,get:function get(){return _orderByDistance.default}});Object.defineProperty(exports,"sexagesimalToDecimal",{enumerable:true,get:function get(){return _sexagesimalToDecimal.default}});Object.defineProperty(exports,"toDecimal",{enumerable:true,get:function get(){return _toDecimal.default}});Object.defineProperty(exports,"toRad",{enumerable:true,get:function get(){return _toRad.default}});Object.defineProperty(exports,"toDeg",{enumerable:true,get:function get(){return _toDeg.default}});var _computeDestinationPoint=_interopRequireDefault(require("./computeDestinationPoint"));var _convertArea=_interopRequireDefault(require("./convertArea"));var _convertDistance=_interopRequireDefault(require("./convertDistance"));var _convertSpeed=_interopRequireDefault(require("./convertSpeed"));var _decimalToSexagesimal=_interopRequireDefault(require("./decimalToSexagesimal"));var _findNearest=_interopRequireDefault(require("./findNearest"));var _getAreaOfPolygon=_interopRequireDefault(require("./getAreaOfPolygon"));var _getBounds=_interopRequireDefault(require("./getBounds"));var _getBoundsOfDistance=_interopRequireDefault(require("./getBoundsOfDistance"));var _getCenter=_interopRequireDefault(require("./getCenter"));var _getCenterOfBounds=_interopRequireDefault(require("./getCenterOfBounds"));var _getCompassDirection=_interopRequireDefault(require("./getCompassDirection"));var _getCoordinateKey=_interopRequireDefault(require("./getCoordinateKey"));var _getCoordinateKeys=_interopRequireDefault(require("./getCoordinateKeys"));var _getDistance=_interopRequireDefault(require("./getDistance"));var _getDistanceFromLine=_interopRequireDefault(require("./getDistanceFromLine"));var _getGreatCircleBearing=_interopRequireDefault(require("./getGreatCircleBearing"));var _getLatitude=_interopRequireDefault(require("./getLatitude"));var _getLongitude=_interopRequireDefault(require("./getLongitude"));var _getPathLength=_interopRequireDefault(require("./getPathLength"));var _getPreciseDistance=_interopRequireDefault(require("./getPreciseDistance"));var _getRhumbLineBearing=_interopRequireDefault(require("./getRhumbLineBearing"));var _getRoughCompassDirection=_interopRequireDefault(require("./getRoughCompassDirection"));var _getSpeed=_interopRequireDefault(require("./getSpeed"));var _isDecimal=_interopRequireDefault(require("./isDecimal"));var _isPointInLine=_interopRequireDefault(require("./isPointInLine"));var _isPointInPolygon=_interopRequireDefault(require("./isPointInPolygon"));var _isPointNearLine=_interopRequireDefault(require("./isPointNearLine"));var _isPointWithinRadius=_interopRequireDefault(require("./isPointWithinRadius"));var _isSexagesimal=_interopRequireDefault(require("./isSexagesimal"));var _isValidCoordinate=_interopRequireDefault(require("./isValidCoordinate"));var _isValidLatitude=_interopRequireDefault(require("./isValidLatitude"));var _isValidLongitude=_interopRequireDefault(require("./isValidLongitude"));var _orderByDistance=_interopRequireDefault(require("./orderByDistance"));var _sexagesimalToDecimal=_interopRequireDefault(require("./sexagesimalToDecimal"));var _toDecimal=_interopRequireDefault(require("./toDecimal"));var _toRad=_interopRequireDefault(require("./toRad"));var _toDeg=_interopRequireDefault(require("./toDeg"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={computeDestinationPoint:true,convertArea:true,convertDistance:true,convertSpeed:true,decimalToSexagesimal:true,findNearest:true,getAreaOfPolygon:true,getBounds:true,getBoundsOfDistance:true,getCenter:true,getCenterOfBounds:true,getCompassDirection:true,getCoordinateKey:true,getCoordinateKeys:true,getDistance:true,getDistanceFromLine:true,getGreatCircleBearing:true,getLatitude:true,getLongitude:true,getPathLength:true,getPreciseDistance:true,getRhumbLineBearing:true,getRoughCompassDirection:true,getSpeed:true,isDecimal:true,isPointInLine:true,isPointInPolygon:true,isPointNearLine:true,isPointWithinRadius:true,isSexagesimal:true,isValidCoordinate:true,isValidLatitude:true,isValidLongitude:true,orderByDistance:true,sexagesimalToDecimal:true,toDecimal:true,toRad:true,toDeg:true};Object.defineProperty(exports,"computeDestinationPoint",{enumerable:true,get:function get(){return _computeDestinationPoint.default}});Object.defineProperty(exports,"convertArea",{enumerable:true,get:function get(){return _convertArea.default}});Object.defineProperty(exports,"convertDistance",{enumerable:true,get:function get(){return _convertDistance.default}});Object.defineProperty(exports,"convertSpeed",{enumerable:true,get:function get(){return _convertSpeed.default}});Object.defineProperty(exports,"decimalToSexagesimal",{enumerable:true,get:function get(){return _decimalToSexagesimal.default}});Object.defineProperty(exports,"findNearest",{enumerable:true,get:function get(){return _findNearest.default}});Object.defineProperty(exports,"getAreaOfPolygon",{enumerable:true,get:function get(){return _getAreaOfPolygon.default}});Object.defineProperty(exports,"getBounds",{enumerable:true,get:function get(){return _getBounds.default}});Object.defineProperty(exports,"getBoundsOfDistance",{enumerable:true,get:function get(){return _getBoundsOfDistance.default}});Object.defineProperty(exports,"getCenter",{enumerable:true,get:function get(){return _getCenter.default}});Object.defineProperty(exports,"getCenterOfBounds",{enumerable:true,get:function get(){return _getCenterOfBounds.default}});Object.defineProperty(exports,"getCompassDirection",{enumerable:true,get:function get(){return _getCompassDirection.default}});Object.defineProperty(exports,"getCoordinateKey",{enumerable:true,get:function get(){return _getCoordinateKey.default}});Object.defineProperty(exports,"getCoordinateKeys",{enumerable:true,get:function get(){return _getCoordinateKeys.default}});Object.defineProperty(exports,"getDistance",{enumerable:true,get:function get(){return _getDistance.default}});Object.defineProperty(exports,"getDistanceFromLine",{enumerable:true,get:function get(){return _getDistanceFromLine.default}});Object.defineProperty(exports,"getGreatCircleBearing",{enumerable:true,get:function get(){return _getGreatCircleBearing.default}});Object.defineProperty(exports,"getLatitude",{enumerable:true,get:function get(){return _getLatitude.default}});Object.defineProperty(exports,"getLongitude",{enumerable:true,get:function get(){return _getLongitude.default}});Object.defineProperty(exports,"getPathLength",{enumerable:true,get:function get(){return _getPathLength.default}});Object.defineProperty(exports,"getPreciseDistance",{enumerable:true,get:function get(){return _getPreciseDistance.default}});Object.defineProperty(exports,"getRhumbLineBearing",{enumerable:true,get:function get(){return _getRhumbLineBearing.default}});Object.defineProperty(exports,"getRoughCompassDirection",{enumerable:true,get:function get(){return _getRoughCompassDirection.default}});Object.defineProperty(exports,"getSpeed",{enumerable:true,get:function get(){return _getSpeed.default}});Object.defineProperty(exports,"isDecimal",{enumerable:true,get:function get(){return _isDecimal.default}});Object.defineProperty(exports,"isPointInLine",{enumerable:true,get:function get(){return _isPointInLine.default}});Object.defineProperty(exports,"isPointInPolygon",{enumerable:true,get:function get(){return _isPointInPolygon.default}});Object.defineProperty(exports,"isPointNearLine",{enumerable:true,get:function get(){return _isPointNearLine.default}});Object.defineProperty(exports,"isPointWithinRadius",{enumerable:true,get:function get(){return _isPointWithinRadius.default}});Object.defineProperty(exports,"isSexagesimal",{enumerable:true,get:function get(){return _isSexagesimal.default}});Object.defineProperty(exports,"isValidCoordinate",{enumerable:true,get:function get(){return _isValidCoordinate.default}});Object.defineProperty(exports,"isValidLatitude",{enumerable:true,get:function get(){return _isValidLatitude.default}});Object.defineProperty(exports,"isValidLongitude",{enumerable:true,get:function get(){return _isValidLongitude.default}});Object.defineProperty(exports,"orderByDistance",{enumerable:true,get:function get(){return _orderByDistance.default}});Object.defineProperty(exports,"sexagesimalToDecimal",{enumerable:true,get:function get(){return _sexagesimalToDecimal.default}});Object.defineProperty(exports,"toDecimal",{enumerable:true,get:function get(){return _toDecimal.default}});Object.defineProperty(exports,"toRad",{enumerable:true,get:function get(){return _toRad.default}});Object.defineProperty(exports,"toDeg",{enumerable:true,get:function get(){return _toDeg.default}});var _computeDestinationPoint=_interopRequireDefault(require("./computeDestinationPoint"));var _convertArea=_interopRequireDefault(require("./convertArea"));var _convertDistance=_interopRequireDefault(require("./convertDistance"));var _convertSpeed=_interopRequireDefault(require("./convertSpeed"));var _decimalToSexagesimal=_interopRequireDefault(require("./decimalToSexagesimal"));var _findNearest=_interopRequireDefault(require("./findNearest"));var _getAreaOfPolygon=_interopRequireDefault(require("./getAreaOfPolygon"));var _getBounds=_interopRequireDefault(require("./getBounds"));var _getBoundsOfDistance=_interopRequireDefault(require("./getBoundsOfDistance"));var _getCenter=_interopRequireDefault(require("./getCenter"));var _getCenterOfBounds=_interopRequireDefault(require("./getCenterOfBounds"));var _getCompassDirection=_interopRequireDefault(require("./getCompassDirection"));var _getCoordinateKey=_interopRequireDefault(require("./getCoordinateKey"));var _getCoordinateKeys=_interopRequireDefault(require("./getCoordinateKeys"));var _getDistance=_interopRequireDefault(require("./getDistance"));var _getDistanceFromLine=_interopRequireDefault(require("./getDistanceFromLine"));var _getGreatCircleBearing=_interopRequireDefault(require("./getGreatCircleBearing"));var _getLatitude=_interopRequireDefault(require("./getLatitude"));var _getLongitude=_interopRequireDefault(require("./getLongitude"));var _getPathLength=_interopRequireDefault(require("./getPathLength"));var _getPreciseDistance=_interopRequireDefault(require("./getPreciseDistance"));var _getRhumbLineBearing=_interopRequireDefault(require("./getRhumbLineBearing"));var _getRoughCompassDirection=_interopRequireDefault(require("./getRoughCompassDirection"));var _getSpeed=_interopRequireDefault(require("./getSpeed"));var _isDecimal=_interopRequireDefault(require("./isDecimal"));var _isPointInLine=_interopRequireDefault(require("./isPointInLine"));var _isPointInPolygon=_interopRequireDefault(require("./isPointInPolygon"));var _isPointNearLine=_interopRequireDefault(require("./isPointNearLine"));var _isPointWithinRadius=_interopRequireDefault(require("./isPointWithinRadius"));var _isSexagesimal=_interopRequireDefault(require("./isSexagesimal"));var _isValidCoordinate=_interopRequireDefault(require("./isValidCoordinate"));var _isValidLatitude=_interopRequireDefault(require("./isValidLatitude"));var _isValidLongitude=_interopRequireDefault(require("./isValidLongitude"));var _orderByDistance=_interopRequireDefault(require("./orderByDistance"));var _sexagesimalToDecimal=_interopRequireDefault(require("./sexagesimalToDecimal"));var _toDecimal=_interopRequireDefault(require("./toDecimal"));var _toRad=_interopRequireDefault(require("./toRad"));var _toDeg=_interopRequireDefault(require("./toDeg"));var _constants=require("./constants");Object.keys(_constants).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _constants[key]}})});function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}

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

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _isDecimal=_interopRequireDefault(require("./isDecimal"));var _isSexagesimal=_interopRequireDefault(require("./isSexagesimal"));var _sexagesimalToDecimal=_interopRequireDefault(require("./sexagesimalToDecimal"));var _isValidCoordinate=_interopRequireDefault(require("./isValidCoordinate"));var _getCoordinateKeys=_interopRequireDefault(require("./getCoordinateKeys"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}}return target}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}var toDecimal=function toDecimal(value){if((0,_isDecimal.default)(value)){return Number(value)}if((0,_isSexagesimal.default)(value)){return(0,_sexagesimalToDecimal.default)(value)}if((0,_isValidCoordinate.default)(value)){var keys=(0,_getCoordinateKeys.default)(value);if(Array.isArray(value)){return value.map(function(v,index){return[0,1].includes(index)?toDecimal(v):v})}return _objectSpread({},value,{},keys.latitude&&_defineProperty({},keys.latitude,toDecimal(value[keys.latitude])),{},keys.longitude&&_defineProperty({},keys.longitude,toDecimal(value[keys.longitude])))}if(Array.isArray(value)){return value.map(function(point){return(0,_isValidCoordinate.default)(point)?toDecimal(point):point})}return value};var _default=toDecimal;exports.default=_default;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _isDecimal=_interopRequireDefault(require("./isDecimal"));var _isSexagesimal=_interopRequireDefault(require("./isSexagesimal"));var _sexagesimalToDecimal=_interopRequireDefault(require("./sexagesimalToDecimal"));var _isValidCoordinate=_interopRequireDefault(require("./isValidCoordinate"));var _getCoordinateKeys=_interopRequireDefault(require("./getCoordinateKeys"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}}return target}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}var toDecimal=function toDecimal(value){if((0,_isDecimal.default)(value)){return Number(value)}if((0,_isSexagesimal.default)(value)){return(0,_sexagesimalToDecimal.default)(value)}if((0,_isValidCoordinate.default)(value)){var keys=(0,_getCoordinateKeys.default)(value);if(Array.isArray(value)){return value.map(function(v,index){return[0,1].includes(index)?toDecimal(v):v})}return _objectSpread(_objectSpread(_objectSpread({},value),keys.latitude&&_defineProperty({},keys.latitude,toDecimal(value[keys.latitude]))),keys.longitude&&_defineProperty({},keys.longitude,toDecimal(value[keys.longitude])))}if(Array.isArray(value)){return value.map(function(point){return(0,_isValidCoordinate.default)(point)?toDecimal(point):point})}return value};var _default=toDecimal;exports.default=_default;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(arr,i){if(!(Symbol.iterator in Object(arr)||Object.prototype.toString.call(arr)==="[object Arguments]")){return}var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}var wktToPolygon=function wktToPolygon(wkt){if(!wkt.startsWith("POLYGON")){throw new Error("Invalid wkt.")}var coordsText=wkt.slice(wkt.indexOf("(")+2,wkt.indexOf(")")).split(", ");var polygon=coordsText.map(function(coordText){var _coordText$split=coordText.split(" "),_coordText$split2=_slicedToArray(_coordText$split,2),longitude=_coordText$split2[0],latitude=_coordText$split2[1];return{longitude:parseFloat(longitude),latitude:parseFloat(latitude)}});return polygon};var _default=wktToPolygon;exports.default=_default;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i]}return arr2}function _iterableToArrayLimit(arr,i){if(typeof Symbol==="undefined"||!(Symbol.iterator in Object(arr)))return;var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}var wktToPolygon=function wktToPolygon(wkt){if(!wkt.startsWith("POLYGON")){throw new Error("Invalid wkt.")}var coordsText=wkt.slice(wkt.indexOf("(")+2,wkt.indexOf(")")).split(", ");var polygon=coordsText.map(function(coordText){var _coordText$split=coordText.split(" "),_coordText$split2=_slicedToArray(_coordText$split,2),longitude=_coordText$split2[0],latitude=_coordText$split2[1];return{longitude:parseFloat(longitude),latitude:parseFloat(latitude)}});return polygon};var _default=wktToPolygon;exports.default=_default;

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

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.geolib=n():t.geolib=n()}("undefined"!=typeof self?self:this,(function(){return function(t){var n={};function r(e){if(n[e])return n[e].exports;var i=n[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)r.d(e,i,function(n){return t[n]}.bind(null,i));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=0)}([function(t,n,r){"use strict";r.r(n);var e=/^([0-9]{1,3})°\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['′]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["″]\s*)?([NEOSW]?)$/,i=["lng","lon","longitude",0],o=["lat","latitude",1],a=["alt","altitude","elevation","elev",2],u={m:1,km:.001,cm:100,mm:1e3,mi:1/1609.344,sm:1/1852.216,ft:100/30.48,in:100/2.54,yd:1/.9144},c=3600,f={m2:1,km2:1e-6,ha:1e-4,a:.01,ft2:10.763911,yd2:1.19599,in2:1550.0031};f.sqm=f.m2,f.sqkm=f.km2,f.sqft=f.ft2,f.sqyd=f.yd2,f.sqin=f.in2;var s=function(t,n){return n.reduce((function(n,r){if(null==t)throw new Error("'".concat(t,"' is no valid coordinate."));return Object.prototype.hasOwnProperty.call(t,r)&&void 0!==r&&void 0===n?(n=r,r):n}),void 0)},l=function(t){var n=t.toString().trim();return!isNaN(parseFloat(n))&&parseFloat(n)===Number(n)},d=function(t){return e.test(t.toString().trim())},h=function(t){var n=new RegExp(e).exec(t);if(null==n)throw new Error("Given value is not in sexagesimal format");var r=Number(n[2])/60||0,i=Number(n[4])/3600||0,o=parseFloat(n[1])+r+i;return["S","W"].includes(n[7])?-o:o};function g(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,e)}return r}function v(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?g(Object(r),!0).forEach((function(n){m(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))}))}return t}function m(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var p=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{longitude:i,latitude:o,altitude:a},r=s(t,n.longitude),e=s(t,n.latitude),u=s(t,n.altitude);return v({latitude:e,longitude:r},u?{altitude:u}:{})},M=function t(n){return l(n)?!(parseFloat(n)>90||n<-90):!!d(n)&&t(h(n))},y=function t(n){return l(n)?!(parseFloat(n)>180||n<-180):!!d(n)&&t(h(n))},b=function(t){var n=p(t),r=n.latitude,e=n.longitude;if(Array.isArray(t)&&t.length>=2)return y(t[0])&&M(t[1]);if(void 0===r||void 0===e)return!1;var i=t[e],o=t[r];return void 0!==o&&void 0!==i&&(!1!==M(o)&&!1!==y(i))};function O(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,e)}return r}function S(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var P=function t(n){if(l(n))return Number(n);if(d(n))return h(n);if(b(n)){var r=p(n);return Array.isArray(n)?n.map((function(n,r){return[0,1].includes(r)?t(n):n})):function(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?O(Object(r),!0).forEach((function(n){S(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))}))}return t}({},n,{},r.latitude&&S({},r.latitude,t(n[r.latitude])),{},r.longitude&&S({},r.longitude,t(n[r.longitude])))}return Array.isArray(n)?n.map((function(n){return b(n)?t(n):n})):n},N=function(t,n){var r=s(t,o);if(null!=r){var e=t[r];return!0===n?e:P(e)}},j=function(t,n){var r=s(t,i);if(null!=r){var e=t[r];return!0===n?e:P(e)}},w=function(t){return t*Math.PI/180},E=function(t){return 180*t/Math.PI},x=function(t,n,r){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6371e3,i=N(t),o=j(t),a=n/e,u=w(r),c=w(i),f=w(o),s=Math.asin(Math.sin(c)*Math.cos(a)+Math.cos(c)*Math.sin(a)*Math.cos(u)),l=f+Math.atan2(Math.sin(u)*Math.sin(a)*Math.cos(c),Math.cos(a)-Math.sin(c)*Math.sin(s)),d=E(l);return(d<-180||d>180)&&(l=(l+3*Math.PI)%(2*Math.PI)-Math.PI,d=E(l)),{latitude:E(s),longitude:d}},L=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",r=f[n];if(r)return t*r;throw new Error("Invalid unit used for area conversion.")},W=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",r=u[n];if(r)return t*r;throw new Error("Invalid unit used for distance conversion.")},D=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kmh";switch(n){case"kmh":return t*c*u.km;case"mph":return t*c*u.mi;default:return t}};function I(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var r=[],e=!0,i=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(e=(a=u.next()).done)&&(r.push(a.value),!n||r.length!==n);e=!0);}catch(t){i=!0,o=t}finally{try{e||null==u.return||u.return()}finally{if(i)throw o}}return r}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var A=function(t){var n=Math.pow(10,12);return Math.round(t*n)/n},F=function(t){var n=I(t.toString().split("."),2),r=n[0],e=n[1],i=Math.abs(Number(r)),o=A(60*Number("0."+(e||0))),a=Math.floor(o),u=A(60*(o%a||0));return i+"° "+Number(a.toFixed(6)).toString().split(".").map((function(t,n){return 0===n?t.padStart(2,"0"):t})).join(".")+"' "+Number(u.toFixed(4)).toString().split(".").map((function(t,n){return 0===n?t.padStart(2,"0"):t})).join(".")+'"'},k=function(t){return t>1?1:t<-1?-1:t},C=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;r=void 0===r||isNaN(r)?1:r;var e=N(t),i=j(t),o=N(n),a=j(n),u=6378137*Math.acos(k(Math.sin(w(o))*Math.sin(w(e))+Math.cos(w(o))*Math.cos(w(e))*Math.cos(w(i)-w(a))));return Math.round(u/r)*r},q=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C;return r="function"==typeof r?r:C,n.slice().sort((function(n,e){return r(t,n)-r(t,e)}))},B=function(t,n){return q(t,n)[0]},_=function(t){var n=0;if(t.length>2){for(var r,e,i,o=0;o<t.length;o++){o===t.length-2?(r=t.length-2,e=t.length-1,i=0):o===t.length-1?(r=t.length-1,e=0,i=1):(r=o,e=o+1,i=o+2);var a=j(t[r]),u=N(t[e]),c=j(t[i]);n+=(w(c)-w(a))*Math.sin(w(u))}n=6378137*n*6378137/2}return Math.abs(n)},R=function(t){if(!1===Array.isArray(t)||0===t.length)throw new Error("No points were given.");return t.reduce((function(t,n){var r=N(n),e=j(n);return{maxLat:Math.max(r,t.maxLat),minLat:Math.min(r,t.minLat),maxLng:Math.max(e,t.maxLng),minLng:Math.min(e,t.minLng)}}),{maxLat:-1/0,minLat:1/0,maxLng:-1/0,minLng:1/0})},T=function(t,n){var r,e,i=N(t),o=j(t),a=w(i),u=w(o),c=n/6378137,f=a-c,s=a+c,l=w(90),d=w(-90),h=w(180),g=w(-180);if(f>d&&s<l){var v=Math.asin(Math.sin(c)/Math.cos(a));(r=u-v)<g&&(r+=2*Math.PI),(e=u+v)>h&&(e-=2*Math.PI)}else f=Math.max(f,d),s=Math.min(s,l),r=g,e=h;return[{latitude:E(f),longitude:E(r)},{latitude:E(s),longitude:E(e)}]},$=function(t){if(!1===Array.isArray(t)||0===t.length)return!1;var n=t.length,r=t.reduce((function(t,n){var r=w(N(n)),e=w(j(n));return{X:t.X+Math.cos(r)*Math.cos(e),Y:t.Y+Math.cos(r)*Math.sin(e),Z:t.Z+Math.sin(r)}}),{X:0,Y:0,Z:0}),e=r.X/n,i=r.Y/n,o=r.Z/n;return{longitude:E(Math.atan2(i,e)),latitude:E(Math.atan2(o,Math.sqrt(e*e+i*i)))}},X=function(t){var n=R(t),r=n.minLat+(n.maxLat-n.minLat)/2,e=n.minLng+(n.maxLng-n.minLng)/2;return{latitude:parseFloat(r.toFixed(6)),longitude:parseFloat(e.toFixed(6))}},Y=function(t,n){var r=w(j(n))-w(j(t)),e=Math.log(Math.tan(w(N(n))/2+Math.PI/4)/Math.tan(w(N(t))/2+Math.PI/4));return Math.abs(r)>Math.PI&&(r=r>0?-1*(2*Math.PI-r):2*Math.PI+r),(E(Math.atan2(r,e))+360)%360},Z=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Y,e="function"==typeof r?r(t,n):Y(t,n);if(isNaN(e))throw new Error("Could not calculate bearing for given points. Check your bearing function");switch(Math.round(e/22.5)){case 1:return"NNE";case 2:return"NE";case 3:return"ENE";case 4:return"E";case 5:return"ESE";case 6:return"SE";case 7:return"SSE";case 8:return"S";case 9:return"SSW";case 10:return"SW";case 11:return"WSW";case 12:return"W";case 13:return"WNW";case 14:return"NW";case 15:return"NNW";default:return"N"}},V=function(t,n,r){var e=C(n,t),i=C(t,r),o=C(n,r),a=Math.acos(k((e*e+o*o-i*i)/(2*e*o))),u=Math.acos(k((i*i+o*o-e*e)/(2*i*o)));return a>Math.PI/2?e:u>Math.PI/2?i:Math.sin(a)*e},G=function(t,n){var r=N(n),e=j(n),i=N(t),o=j(t);return(E(Math.atan2(Math.sin(w(e)-w(o))*Math.cos(w(r)),Math.cos(w(i))*Math.sin(w(r))-Math.sin(w(i))*Math.cos(w(r))*Math.cos(w(e)-w(o))))+360)%360};function K(t){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var z=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C;return t.reduce((function(t,r){return"object"===K(t)&&null!==t.last&&(t.distance+=n(r,t.last)),t.last=r,t}),{last:null,distance:0}).distance},H=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;r=void 0===r||isNaN(r)?1:r;var e,i,o,a,u,c,f,s=N(t),l=j(t),d=N(n),h=j(n),g=6356752.314245,v=1/298.257223563,m=w(h-l),p=Math.atan((1-v)*Math.tan(w(parseFloat(s)))),M=Math.atan((1-v)*Math.tan(w(parseFloat(d)))),y=Math.sin(p),b=Math.cos(p),O=Math.sin(M),S=Math.cos(M),P=m,E=100;do{var x=Math.sin(P),L=Math.cos(P);if(0===(c=Math.sqrt(S*x*(S*x)+(b*O-y*S*L)*(b*O-y*S*L))))return 0;e=y*O+b*S*L,i=Math.atan2(c,e),u=e-2*y*O/(a=1-(o=b*S*x/c)*o),isNaN(u)&&(u=0);var W=v/16*a*(4+v*(4-3*a));f=P,P=m+(1-W)*v*o*(i+W*c*(u+W*e*(2*u*u-1)))}while(Math.abs(P-f)>1e-12&&--E>0);if(0===E)return NaN;var D=a*(40680631590769-g*g)/(g*g),I=1+D/16384*(4096+D*(D*(320-175*D)-768)),A=D/1024*(256+D*(D*(74-47*D)-128)),F=A*c*(u+A/4*(e*(2*u*u-1)-A/6*u*(4*c*c-3)*(4*u*u-3))),k=g*I*(i-F);return Math.round(k/r)*r},J=function(t){return/^NNE|NE|NNW|N$/.test(t)?"N":/^ENE|E|ESE|SE$/.test(t)?"E":/^SSE|S|SSW|SW$/.test(t)?"S":/^WSW|W|WNW|NW$/.test(t)?"W":void 0},Q=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C,e=r(t,n),i=Number(n.time)-Number(t.time),o=e/i*1e3;return o},U=function(t,n,r){return C(n,t)+C(t,r)===C(n,r)},tt=function(t,n){for(var r=!1,e=n.length,i=-1,o=e-1;++i<e;o=i)(j(n[i])<=j(t)&&j(t)<j(n[o])||j(n[o])<=j(t)&&j(t)<j(n[i]))&&N(t)<(N(n[o])-N(n[i]))*(j(t)-j(n[i]))/(j(n[o])-j(n[i]))+N(n[i])&&(r=!r);return r},nt=function(t,n,r,e){return V(t,n,r)<e},rt=function(t,n,r){return C(t,n)<r};r.d(n,"computeDestinationPoint",(function(){return x})),r.d(n,"convertArea",(function(){return L})),r.d(n,"convertDistance",(function(){return W})),r.d(n,"convertSpeed",(function(){return D})),r.d(n,"decimalToSexagesimal",(function(){return F})),r.d(n,"findNearest",(function(){return B})),r.d(n,"getAreaOfPolygon",(function(){return _})),r.d(n,"getBounds",(function(){return R})),r.d(n,"getBoundsOfDistance",(function(){return T})),r.d(n,"getCenter",(function(){return $})),r.d(n,"getCenterOfBounds",(function(){return X})),r.d(n,"getCompassDirection",(function(){return Z})),r.d(n,"getCoordinateKey",(function(){return s})),r.d(n,"getCoordinateKeys",(function(){return p})),r.d(n,"getDistance",(function(){return C})),r.d(n,"getDistanceFromLine",(function(){return V})),r.d(n,"getGreatCircleBearing",(function(){return G})),r.d(n,"getLatitude",(function(){return N})),r.d(n,"getLongitude",(function(){return j})),r.d(n,"getPathLength",(function(){return z})),r.d(n,"getPreciseDistance",(function(){return H})),r.d(n,"getRhumbLineBearing",(function(){return Y})),r.d(n,"getRoughCompassDirection",(function(){return J})),r.d(n,"getSpeed",(function(){return Q})),r.d(n,"isDecimal",(function(){return l})),r.d(n,"isPointInLine",(function(){return U})),r.d(n,"isPointInPolygon",(function(){return tt})),r.d(n,"isPointNearLine",(function(){return nt})),r.d(n,"isPointWithinRadius",(function(){return rt})),r.d(n,"isSexagesimal",(function(){return d})),r.d(n,"isValidCoordinate",(function(){return b})),r.d(n,"isValidLatitude",(function(){return M})),r.d(n,"isValidLongitude",(function(){return y})),r.d(n,"orderByDistance",(function(){return q})),r.d(n,"sexagesimalToDecimal",(function(){return h})),r.d(n,"toDecimal",(function(){return P})),r.d(n,"toRad",(function(){return w})),r.d(n,"toDeg",(function(){return E}))}])}));
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.geolib=n():t.geolib=n()}("undefined"!=typeof self?self:this,(function(){return function(t){var n={};function r(e){if(n[e])return n[e].exports;var i=n[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)r.d(e,i,function(n){return t[n]}.bind(null,i));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=0)}([function(t,n,r){"use strict";r.r(n),r.d(n,"computeDestinationPoint",(function(){return C})),r.d(n,"convertArea",(function(){return F})),r.d(n,"convertDistance",(function(){return k})),r.d(n,"convertSpeed",(function(){return q})),r.d(n,"decimalToSexagesimal",(function(){return X})),r.d(n,"findNearest",(function(){return Y})),r.d(n,"getAreaOfPolygon",(function(){return Z})),r.d(n,"getBounds",(function(){return V})),r.d(n,"getBoundsOfDistance",(function(){return G})),r.d(n,"getCenter",(function(){return U})),r.d(n,"getCenterOfBounds",(function(){return z})),r.d(n,"getCompassDirection",(function(){return J})),r.d(n,"getCoordinateKey",(function(){return m})),r.d(n,"getCoordinateKeys",(function(){return S})),r.d(n,"getDistance",(function(){return _})),r.d(n,"getDistanceFromLine",(function(){return Q})),r.d(n,"getGreatCircleBearing",(function(){return tt})),r.d(n,"getLatitude",(function(){return I})),r.d(n,"getLongitude",(function(){return A})),r.d(n,"getPathLength",(function(){return rt})),r.d(n,"getPreciseDistance",(function(){return et})),r.d(n,"getRhumbLineBearing",(function(){return H})),r.d(n,"getRoughCompassDirection",(function(){return it})),r.d(n,"getSpeed",(function(){return ot})),r.d(n,"isDecimal",(function(){return v})),r.d(n,"isPointInLine",(function(){return ut})),r.d(n,"isPointInPolygon",(function(){return at})),r.d(n,"isPointNearLine",(function(){return ct})),r.d(n,"isPointWithinRadius",(function(){return ft})),r.d(n,"isSexagesimal",(function(){return p})),r.d(n,"isValidCoordinate",(function(){return j})),r.d(n,"isValidLatitude",(function(){return N})),r.d(n,"isValidLongitude",(function(){return P})),r.d(n,"orderByDistance",(function(){return K})),r.d(n,"sexagesimalToDecimal",(function(){return y})),r.d(n,"toDecimal",(function(){return L})),r.d(n,"toRad",(function(){return W})),r.d(n,"toDeg",(function(){return D})),r.d(n,"sexagesimalPattern",(function(){return e})),r.d(n,"earthRadius",(function(){return i})),r.d(n,"MINLAT",(function(){return o})),r.d(n,"MAXLAT",(function(){return u})),r.d(n,"MINLON",(function(){return a})),r.d(n,"MAXLON",(function(){return c})),r.d(n,"longitudeKeys",(function(){return f})),r.d(n,"latitudeKeys",(function(){return s})),r.d(n,"altitudeKeys",(function(){return l})),r.d(n,"distanceConversion",(function(){return d})),r.d(n,"timeConversion",(function(){return h})),r.d(n,"areaConversion",(function(){return g}));var e=/^([0-9]{1,3})°\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['′]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["″]\s*)?([NEOSW]?)$/,i=6378137,o=-90,u=90,a=-180,c=180,f=["lng","lon","longitude",0],s=["lat","latitude",1],l=["alt","altitude","elevation","elev",2],d={m:1,km:.001,cm:100,mm:1e3,mi:1/1609.344,sm:1/1852.216,ft:100/30.48,in:100/2.54,yd:1/.9144},h={m:60,h:3600,d:86400},g={m2:1,km2:1e-6,ha:1e-4,a:.01,ft2:10.763911,yd2:1.19599,in2:1550.0031};g.sqm=g.m2,g.sqkm=g.km2,g.sqft=g.ft2,g.sqyd=g.yd2,g.sqin=g.in2;var m=function(t,n){return n.reduce((function(n,r){if(null==t)throw new Error("'".concat(t,"' is no valid coordinate."));return Object.prototype.hasOwnProperty.call(t,r)&&void 0!==r&&void 0===n?(n=r,r):n}),void 0)},v=function(t){var n=t.toString().trim();return!isNaN(parseFloat(n))&&parseFloat(n)===Number(n)},p=function(t){return e.test(t.toString().trim())},y=function(t){var n=new RegExp(e).exec(t);if(null==n)throw new Error("Given value is not in sexagesimal format");var r=Number(n[2])/60||0,i=Number(n[4])/3600||0,o=parseFloat(n[1])+r+i;return["S","W"].includes(n[7])?-o:o};function M(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,e)}return r}function b(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?M(Object(r),!0).forEach((function(n){O(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))}))}return t}function O(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var S=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{longitude:f,latitude:s,altitude:l},r=m(t,n.longitude),e=m(t,n.latitude),i=m(t,n.altitude);return b({latitude:e,longitude:r},i?{altitude:i}:{})},N=function t(n){return v(n)?!(parseFloat(n)>u||n<o):!!p(n)&&t(y(n))},P=function t(n){return v(n)?!(parseFloat(n)>c||n<a):!!p(n)&&t(y(n))},j=function(t){var n=S(t),r=n.latitude,e=n.longitude;if(Array.isArray(t)&&t.length>=2)return P(t[0])&&N(t[1]);if(void 0===r||void 0===e)return!1;var i=t[e],o=t[r];return void 0!==o&&void 0!==i&&(!1!==N(o)&&!1!==P(i))};function w(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,e)}return r}function x(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?w(Object(r),!0).forEach((function(n){E(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))}))}return t}function E(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var L=function t(n){if(v(n))return Number(n);if(p(n))return y(n);if(j(n)){var r=S(n);return Array.isArray(n)?n.map((function(n,r){return[0,1].includes(r)?t(n):n})):x(x(x({},n),r.latitude&&E({},r.latitude,t(n[r.latitude]))),r.longitude&&E({},r.longitude,t(n[r.longitude])))}return Array.isArray(n)?n.map((function(n){return j(n)?t(n):n})):n},I=function(t,n){var r=m(t,s);if(null!=r){var e=t[r];return!0===n?e:L(e)}},A=function(t,n){var r=m(t,f);if(null!=r){var e=t[r];return!0===n?e:L(e)}},W=function(t){return t*Math.PI/180},D=function(t){return 180*t/Math.PI},C=function(t,n,r){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6371e3,i=I(t),o=A(t),u=n/e,f=W(r),s=W(i),l=W(o),d=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(f)),h=l+Math.atan2(Math.sin(f)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(d)),g=D(h);return(g<a||g>c)&&(h=(h+3*Math.PI)%(2*Math.PI)-Math.PI,g=D(h)),{latitude:D(d),longitude:g}},F=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",r=g[n];if(r)return t*r;throw new Error("Invalid unit used for area conversion.")},k=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m",r=d[n];if(r)return t*r;throw new Error("Invalid unit used for distance conversion.")},q=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kmh";switch(n){case"kmh":return t*h.h*d.km;case"mph":return t*h.h*d.mi;default:return t}};function T(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],e=!0,i=!1,o=void 0;try{for(var u,a=t[Symbol.iterator]();!(e=(u=a.next()).done)&&(r.push(u.value),!n||r.length!==n);e=!0);}catch(t){i=!0,o=t}finally{try{e||null==a.return||a.return()}finally{if(i)throw o}}return r}(t,n)||function(t,n){if(!t)return;if("string"==typeof t)return B(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(t,n)}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}var R=function(t){var n=Math.pow(10,12);return Math.round(t*n)/n},X=function(t){var n=T(t.toString().split("."),2),r=n[0],e=n[1],i=Math.abs(Number(r)),o=R(60*Number("0."+(e||0))),u=Math.floor(o),a=R(60*(o%u||0));return i+"° "+Number(u.toFixed(6)).toString().split(".").map((function(t,n){return 0===n?t.padStart(2,"0"):t})).join(".")+"' "+Number(a.toFixed(4)).toString().split(".").map((function(t,n){return 0===n?t.padStart(2,"0"):t})).join(".")+'"'},$=function(t){return t>1?1:t<-1?-1:t},_=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;r=void 0===r||isNaN(r)?1:r;var e=I(t),o=A(t),u=I(n),a=A(n),c=Math.acos($(Math.sin(W(u))*Math.sin(W(e))+Math.cos(W(u))*Math.cos(W(e))*Math.cos(W(o)-W(a))))*i;return Math.round(c/r)*r},K=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_;return r="function"==typeof r?r:_,n.slice().sort((function(n,e){return r(t,n)-r(t,e)}))},Y=function(t,n){return K(t,n)[0]},Z=function(t){var n=0;if(t.length>2){for(var r,e,o,u=0;u<t.length;u++){u===t.length-2?(r=t.length-2,e=t.length-1,o=0):u===t.length-1?(r=t.length-1,e=0,o=1):(r=u,e=u+1,o=u+2);var a=A(t[r]),c=I(t[e]),f=A(t[o]);n+=(W(f)-W(a))*Math.sin(W(c))}n=n*i*i/2}return Math.abs(n)},V=function(t){if(!1===Array.isArray(t)||0===t.length)throw new Error("No points were given.");return t.reduce((function(t,n){var r=I(n),e=A(n);return{maxLat:Math.max(r,t.maxLat),minLat:Math.min(r,t.minLat),maxLng:Math.max(e,t.maxLng),minLng:Math.min(e,t.minLng)}}),{maxLat:-1/0,minLat:1/0,maxLng:-1/0,minLng:1/0})},G=function(t,n){var r,e,f=I(t),s=A(t),l=W(f),d=W(s),h=n/i,g=l-h,m=l+h,v=W(u),p=W(o),y=W(c),M=W(a);if(g>p&&m<v){var b=Math.asin(Math.sin(h)/Math.cos(l));(r=d-b)<M&&(r+=2*Math.PI),(e=d+b)>y&&(e-=2*Math.PI)}else g=Math.max(g,p),m=Math.min(m,v),r=M,e=y;return[{latitude:D(g),longitude:D(r)},{latitude:D(m),longitude:D(e)}]},U=function(t){if(!1===Array.isArray(t)||0===t.length)return!1;var n=t.length,r=t.reduce((function(t,n){var r=W(I(n)),e=W(A(n));return{X:t.X+Math.cos(r)*Math.cos(e),Y:t.Y+Math.cos(r)*Math.sin(e),Z:t.Z+Math.sin(r)}}),{X:0,Y:0,Z:0}),e=r.X/n,i=r.Y/n,o=r.Z/n;return{longitude:D(Math.atan2(i,e)),latitude:D(Math.atan2(o,Math.sqrt(e*e+i*i)))}},z=function(t){var n=V(t),r=n.minLat+(n.maxLat-n.minLat)/2,e=n.minLng+(n.maxLng-n.minLng)/2;return{latitude:parseFloat(r.toFixed(6)),longitude:parseFloat(e.toFixed(6))}},H=function(t,n){var r=W(A(n))-W(A(t)),e=Math.log(Math.tan(W(I(n))/2+Math.PI/4)/Math.tan(W(I(t))/2+Math.PI/4));return Math.abs(r)>Math.PI&&(r=r>0?-1*(2*Math.PI-r):2*Math.PI+r),(D(Math.atan2(r,e))+360)%360},J=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:H,e="function"==typeof r?r(t,n):H(t,n);if(isNaN(e))throw new Error("Could not calculate bearing for given points. Check your bearing function");switch(Math.round(e/22.5)){case 1:return"NNE";case 2:return"NE";case 3:return"ENE";case 4:return"E";case 5:return"ESE";case 6:return"SE";case 7:return"SSE";case 8:return"S";case 9:return"SSW";case 10:return"SW";case 11:return"WSW";case 12:return"W";case 13:return"WNW";case 14:return"NW";case 15:return"NNW";default:return"N"}},Q=function(t,n,r){var e=_(n,t),i=_(t,r),o=_(n,r),u=Math.acos($((e*e+o*o-i*i)/(2*e*o))),a=Math.acos($((i*i+o*o-e*e)/(2*i*o)));return u>Math.PI/2?e:a>Math.PI/2?i:Math.sin(u)*e},tt=function(t,n){var r=I(n),e=A(n),i=I(t),o=A(t);return(D(Math.atan2(Math.sin(W(e)-W(o))*Math.cos(W(r)),Math.cos(W(i))*Math.sin(W(r))-Math.sin(W(i))*Math.cos(W(r))*Math.cos(W(e)-W(o))))+360)%360};function nt(t){return(nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var rt=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_;return t.reduce((function(t,r){return"object"===nt(t)&&null!==t.last&&(t.distance+=n(r,t.last)),t.last=r,t}),{last:null,distance:0}).distance},et=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;r=void 0===r||isNaN(r)?1:r;var e,o,u,a,c,f,s,l=I(t),d=A(t),h=I(n),g=A(n),m=6356752.314245,v=1/298.257223563,p=W(g-d),y=Math.atan((1-v)*Math.tan(W(parseFloat(l)))),M=Math.atan((1-v)*Math.tan(W(parseFloat(h)))),b=Math.sin(y),O=Math.cos(y),S=Math.sin(M),N=Math.cos(M),P=p,j=100;do{var w=Math.sin(P),x=Math.cos(P);if(0===(f=Math.sqrt(N*w*(N*w)+(O*S-b*N*x)*(O*S-b*N*x))))return 0;e=b*S+O*N*x,o=Math.atan2(f,e),c=e-2*b*S/(a=1-(u=O*N*w/f)*u),isNaN(c)&&(c=0);var E=v/16*a*(4+v*(4-3*a));s=P,P=p+(1-E)*v*u*(o+E*f*(c+E*e*(2*c*c-1)))}while(Math.abs(P-s)>1e-12&&--j>0);if(0===j)return NaN;var L=a*(i*i-m*m)/(m*m),D=1+L/16384*(4096+L*(L*(320-175*L)-768)),C=L/1024*(256+L*(L*(74-47*L)-128)),F=C*f*(c+C/4*(e*(2*c*c-1)-C/6*c*(4*f*f-3)*(4*c*c-3))),k=m*D*(o-F);return Math.round(k/r)*r},it=function(t){return/^NNE|NE|NNW|N$/.test(t)?"N":/^ENE|E|ESE|SE$/.test(t)?"E":/^SSE|S|SSW|SW$/.test(t)?"S":/^WSW|W|WNW|NW$/.test(t)?"W":void 0},ot=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_,e=r(t,n),i=Number(n.time)-Number(t.time),o=e/i*1e3;return o},ut=function(t,n,r){return _(n,t)+_(t,r)===_(n,r)},at=function(t,n){for(var r=!1,e=n.length,i=-1,o=e-1;++i<e;o=i)(A(n[i])<=A(t)&&A(t)<A(n[o])||A(n[o])<=A(t)&&A(t)<A(n[i]))&&I(t)<(I(n[o])-I(n[i]))*(A(t)-A(n[i]))/(A(n[o])-A(n[i]))+I(n[i])&&(r=!r);return r},ct=function(t,n,r,e){return Q(t,n,r)<e},ft=function(t,n,r){return _(t,n)<r}}])}));
{
"name": "geolib",
"version": "3.2.2",
"version": "3.3.0",
"description": "",

@@ -31,3 +31,2 @@ "main": "lib/index.js",

"release": "semantic-release",
"postrelease": "git pull origin master && git push origin master --follow-tags",
"test": "jest",

@@ -38,39 +37,41 @@ "typecheck": "tsc --noEmit"

"devDependencies": {
"@babel/cli": "^7.7.7",
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"@babel/preset-typescript": "^7.7.7",
"@semantic-release/git": "^7.0.18",
"@semantic-release/npm": "^5.3.5",
"@types/jest": "^24.0.25",
"@types/node": "^13.1.2",
"@typescript-eslint/eslint-plugin": "^2.14.0",
"@typescript-eslint/parser": "^2.14.0",
"@werkzeugkiste/eslint-config": "1.0.6",
"babel-eslint": "10.0.3",
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/preset-typescript": "^7.9.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@semantic-release/npm": "^7.0.5",
"@types/jest": "^25.2.3",
"@types/node": "^14.0.5",
"@typescript-eslint/eslint-plugin": "^3.0.0",
"@typescript-eslint/parser": "^3.0.0",
"@werkzeugkiste/eslint-config": "^2.0.0",
"@werkzeugkiste/release-config": "^1.1.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.0.1",
"babel-loader": "^8.1.0",
"confusing-browser-globals": "1.0.9",
"eslint": "6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-import-resolver-typescript": "2.0.0",
"eslint-plugin-babel": "5.3.0",
"eslint-plugin-import": "2.19.1",
"eslint-plugin-prettier": "3.1.2",
"eslint-plugin-react": "7.17.0",
"eslint-plugin-react-hooks": "2.3.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.2",
"eslint-plugin-security": "1.4.0",
"eslint-plugin-unicorn": "15.0.1",
"husky": "^3.1.0",
"eslint-plugin-unicorn": "^20.0.0",
"husky": "^4.2.5",
"install-deps-postmerge": "^1.0.5",
"jest": "^24.9.0",
"lint-staged": "^9.5.0",
"prettier": "1.19.1",
"rimraf": "^3.0.0",
"semantic-release": "^15.14.0",
"jest": "^26.0.1",
"lint-staged": "^10.2.6",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"semantic-release": "^17.0.7",
"semantic-release-conventional-commits": "^2.0.1",
"typescript": "3.7.4",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
"typescript": "^3.9.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
}
}
# Geolib
Library to provide basic geospatial operations like distance calculation, conversion of decimal coordinates to sexagesimal and vice versa, etc. This library is currently **2D**, meaning that altitude/elevation is not yet supported by any of its functions!
[![CircleCI](https://circleci.com/gh/manuelbieh/geolib/tree/master.svg?style=svg)](https://circleci.com/gh/manuelbieh/geolib/tree/master)

@@ -9,4 +11,2 @@ ![](https://badgen.net/bundlephobia/minzip/geolib)

Library to provide basic geospatial operations like distance calculation, conversion of decimal coordinates to sexagesimal and vice versa, etc. This library is currently **2D**, meaning that altitude/elevation is not yet supported by any of its functions!
## Changelog

@@ -568,1 +568,79 @@

Returns the array of coordinates.
## Breaking Changes in 3.0.0 and migration from 2.x.x
In version 3.0.0 I'm trying to get a little bit _back to the roots_. **Geolib** was once started because I needed a handful of methods to perform very specific geo related tasks like getting the distance or the direction between two points. Since it was one of the very first libraries on npm back then to do these kind of things in a very simple way it became very popular (with more than 300k downloads per month as of April 2019!) and as a consequence got a lot of contributions over the years. Many of which I just merged as long as they had accompanying tests, without looking at consistency, conventions, complexity, coding style or even the overall quality of the functions that I sometimes didn't even fully understand.
I have now cleaned up the codebase completely, rebuilt the entire library "from scratch", unified all the function arguments, removed a few functions where I wasn't sure if they should be in here (feel free to add them back of you're using them!) or if they were even used (did a few searches on GitHub for the function names, turned out there are zero results).
Elevation support was dropped, as well as a few functions that unnecessarily made the library really large in size (e.g. `isPointInsideRobust` alone was over 700[!] lines of code and was basically taken from a [different library](https://github.com/mikolalysenko/robust-point-in-polygon)).
I removed Grunt from the build process, added "modern" tools like ESLint and Prettier. I switched from Travis CI to Circle CI and I am in the process of further automating the release process of new versions using `semantic-release` and `conventional-commits`. I also switched from pure JavaScript to TypeScript because I think it does have some benefits.
- All functions are pure functions now. No input data is mutated anymore. You give the same input, you get the same output. No side effects or whatsoever.
- I changed the default `getDistance` function from being the slow, accurate one to being the fast, slightly inaccurate one. The old `getDistance` function is now named `getPreciseDistance` while the old `getDistanceSimple` function is now the default `getDistance` function. You can, however, pass `getPreciseDistance` as argument to any function that uses distance calculation internally.
- Artificial limitation to 8 decimal places in decimal coordinates was removed
- `getBoundsOfDistance()` now returns the _exact_ coordinates due to the removal of the artificial 8 decimal place limitation
- `getCompassDirection()` does no longer return an object with an _exact_ and a _rough_ direction but only the exact direction as string
- third argument to `getCompassDirection()` is no longer a string ("circle", "line") but a function to determine the bearing (you can pass `getRhumbLineBearing` or `getGreatCircleBearing`). The function receives the origin and the destination as first and second argument. If no 3rd argument was given, `getRhumbLineBearing(origin, dest)` is used by default.
- There is now a new helper function `roughCompassDirection(exact)` if you _really_ only need a very rough (and potentially inaccurate or inappropriate) direction. Better don't use it.
- `orderByDistance()` does no longer modify its input so does not add a `distance` and `key` property to the returned coordinates.
- The result of `getSpeed()` is now always returned as **meters per second**. It can be converted using the new convenience function `convertSpeed(mps, targetUnit)`
- Relevant value (usually point or distance) is now consistently the **first** argument for each function (it wasn't before, how confusing is that?)
- `findNearest()` does no longer take `offset` and `limit` arguments. It's only a convenience method to get the single one nearest point from a set of coordinates. If you need more than one, have a look at the implementation and implement your own logic using `orderByDistance`
- Whereever distances are involved, they are returned as meters or meters per second. No more inconsistent defaults like kilometers or kilometers per hour.
- The method how sexagesimal is formatted differs a little bit. It may now potentially return ugly float point units like `52° 46' 21.0004"` in rare cases but it is also more accurate than it was before.
- Dropped support for Meteor (feel free to add it back if you like)
### ✅ Functions with the same name
- `computeDestinationPoint`
- `getBounds`
- `getBoundsOfDistance`
- `getCenter`
- `getCenterOfBounds`
- `getCompassDirection`
- `getDistanceFromLine`
- `getPathLength`
- `getRhumbLineBearing`
- `getSpeed`
- `isDecimal`
- `isPointInLine`
- `isPointNearLine`
- `isSexagesimal`
- `orderByDistance`
### ❗ Renamed functions
- `getKeys` renamed to `getCoordinateKeys`
- `validate` renamed to `isValidCoordinate`
- `getLat` renamed to `getLatitude`
- `getLon` renamed to `getLongitude`
- `latitude` -> renamed to `getLatitude`
- `longitude` -> renamed to `getLongitude`
- `convertUnit` -> remamed to convertDistance, because name was too ambiguous
- `useDecimal` renamed to `toDecimal`
- `decimal2sexagesimal` renamed to `decimalToSexagesimal`
- `sexagesimal2decimal` renamed to `sexagesimalToDecimal`
- `getDistance` renamed to `getPreciseDistance`
- `getDistanceSimple` renamed to `getDistance`
- `isPointInside` renamed to `isPointInPolygon`
- `isPointInCircle` renamed to `isPointWithinRadius`
- `getBearing` renamed to `getGreatCircleBearing` to be more explicit
### 🗑 Removed functions
- `getElev` -> removed
- `elevation` -> removed
- `coords` -> removed (might be re-added as getCoordinate or getNormalizedCoordinate)
- `ll` -> removed (because wtf?)
- `preparePolygonForIsPointInsideOptimized` -> removed due to missing documentation and missing tests
- `isPointInsideWithPreparedPolygon` -> removed due to missing documentation
- `isInside` alias -> removed (too ambiguous) - use `isPointInPolygon` or `isPointWithinRadius`
- `withinRadius` -> removed, use `isPointWithinRadius`
- `getDirection` alias -> removed (unnecessary clutter) - use `getCompassDirection`
### 🆕 Added functions
- `getAreaOfPolygon` to calculate the area of a polygon
- `getCoordinateKey` to get a property name (e.g. `lat` or `lng` of an object based on an array of possible names)
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