Comparing version 3.2.1 to 3.2.2
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _getLatitude=_interopRequireDefault(require("./getLatitude"));var _getLongitude=_interopRequireDefault(require("./getLongitude"));var _toRad=_interopRequireDefault(require("./toRad"));var _constants=require("./constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var normalizeACosArg=function normalizeACosArg(val){if(val>1){return 1}if(val<-1){return-1}return val};var getDistance=function getDistance(from,to){var accuracy=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;accuracy=typeof accuracy!=="undefined"&&!isNaN(accuracy)?accuracy:1;var fromLat=(0,_getLatitude.default)(from);var fromLon=(0,_getLongitude.default)(from);var toLat=(0,_getLatitude.default)(to);var toLon=(0,_getLongitude.default)(to);var distance=Math.acos(normalizeACosArg(Math.sin((0,_toRad.default)(toLat))*Math.sin((0,_toRad.default)(fromLat))+Math.cos((0,_toRad.default)(toLat))*Math.cos((0,_toRad.default)(fromLat))*Math.cos((0,_toRad.default)(fromLon)-(0,_toRad.default)(toLon))))*_constants.earthRadius;return Math.round(distance/accuracy)*accuracy};var _default=getDistance;exports.default=_default; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _getLatitude=_interopRequireDefault(require("./getLatitude"));var _getLongitude=_interopRequireDefault(require("./getLongitude"));var _toRad=_interopRequireDefault(require("./toRad"));var _robustAcos=_interopRequireDefault(require("./robustAcos"));var _constants=require("./constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var getDistance=function getDistance(from,to){var accuracy=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;accuracy=typeof accuracy!=="undefined"&&!isNaN(accuracy)?accuracy:1;var fromLat=(0,_getLatitude.default)(from);var fromLon=(0,_getLongitude.default)(from);var toLat=(0,_getLatitude.default)(to);var toLon=(0,_getLongitude.default)(to);var distance=Math.acos((0,_robustAcos.default)(Math.sin((0,_toRad.default)(toLat))*Math.sin((0,_toRad.default)(fromLat))+Math.cos((0,_toRad.default)(toLat))*Math.cos((0,_toRad.default)(fromLat))*Math.cos((0,_toRad.default)(fromLon)-(0,_toRad.default)(toLon))))*_constants.earthRadius;return Math.round(distance/accuracy)*accuracy};var _default=getDistance;exports.default=_default; |
@@ -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}}var getDistanceFromLine=function getDistanceFromLine(point,lineStart,lineEnd){var d1=(0,_getDistance.default)(lineStart,point);var d2=(0,_getDistance.default)(point,lineEnd);var d3=(0,_getDistance.default)(lineStart,lineEnd);var alpha=Math.acos((d1*d1+d3*d3-d2*d2)/(2*d1*d3));var beta=Math.acos((d2*d2+d3*d3-d1*d1)/(2*d2*d3));if(alpha>Math.PI/2){return d1}if(beta>Math.PI/2){return d2}return Math.sin(alpha)*d1};var _default=getDistanceFromLine;exports.default=_default; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _getDistance=_interopRequireDefault(require("./getDistance"));var _robustAcos=_interopRequireDefault(require("./robustAcos"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var getDistanceFromLine=function getDistanceFromLine(point,lineStart,lineEnd){var d1=(0,_getDistance.default)(lineStart,point);var d2=(0,_getDistance.default)(point,lineEnd);var d3=(0,_getDistance.default)(lineStart,lineEnd);var alpha=Math.acos((0,_robustAcos.default)((d1*d1+d3*d3-d2*d2)/(2*d1*d3)));var beta=Math.acos((0,_robustAcos.default)((d2*d2+d3*d3-d1*d1)/(2*d2*d3)));if(alpha>Math.PI/2){return d1}if(beta>Math.PI/2){return d2}return Math.sin(alpha)*d1};var _default=getDistanceFromLine;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((e*e+o*o-i*i)/(2*e*o)),u=Math.acos((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);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}))}])})); |
{ | ||
"name": "geolib", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -87,3 +87,3 @@ # Geolib | ||
navigator.geolocation.getCurrentPosition( | ||
function(position) { | ||
(position) => { | ||
console.log( | ||
@@ -551,3 +551,2 @@ 'You are ', | ||
### `wktToPolygon(wkt)` | ||
@@ -570,2 +569,1 @@ | ||
Returns the array of coordinates. | ||
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
96427
91
235
0
567