New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

matrix-to-grid

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

matrix-to-grid - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

4

dist/matrix-to-grid.min.js

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

!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):r.matrixToGrid=e()}(this,function(){function r(r,e){if(!r)throw new Error("No geometry passed");return{type:"Feature",properties:e||{},geometry:r}}function e(e,t){if(!e)throw new Error("No coordinates passed");if(void 0===e.length)throw new Error("Coordinates must be an array");if(e.length<2)throw new Error("Coordinates must be at least 2 numbers long");if("number"!=typeof e[0]||"number"!=typeof e[1])throw new Error("Coordinates must numbers");return r({type:"Point",coordinates:e},t)}function t(e,t){if(!e)throw new Error("No coordinates passed");for(var o=0;o<e.length;o++){var n=e[o];if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var i=0;i<n[n.length-1].length;i++)if(n[n.length-1][i]!==n[0][i])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:e},t)}function o(e,t){if(!e)throw new Error("No coordinates passed");return r({type:"LineString",coordinates:e},t)}function n(r){if(!r)throw new Error("No features passed");return{type:"FeatureCollection",features:r}}function i(e,t){if(!e)throw new Error("No coordinates passed");return r({type:"MultiLineString",coordinates:e},t)}function a(e,t){if(!e)throw new Error("No coordinates passed");return r({type:"MultiPoint",coordinates:e},t)}function u(e,t){if(!e)throw new Error("No coordinates passed");return r({type:"MultiPolygon",coordinates:e},t)}function s(e,t){if(!e)throw new Error("No geometries passed");return r({type:"GeometryCollection",geometries:e},t)}function f(r,e){var t=er[e||"kilometers"];if(void 0===t)throw new Error("Invalid unit");return r*t}function l(r,e){var t=er[e||"kilometers"];if(void 0===t)throw new Error("Invalid unit");return r/t}function c(r,e){var t=er[e||"kilometers"];if(void 0===t)throw new Error("Invalid unit");return r/t*57.2958}function d(r,e,t){var o,n,i,a,u,s,f,l,c,h,g=0,p=0,w="FeatureCollection"===r.type,y="Feature"===r.type,m=w?r.features.length:1;for(o=0;m>o;o++)for(c=w?r.features[o].geometry:y?r.geometry:r,h="GeometryCollection"===c.type,f=h?c.geometries.length:1,a=0;f>a;a++)if(s=h?c.geometries[a]:c,l=s.coordinates,g=!t||"Polygon"!==s.type&&"MultiPolygon"!==s.type?0:1,"Point"===s.type)e(l,p),p++;else if("LineString"===s.type||"MultiPoint"===s.type)for(n=0;n<l.length;n++)e(l[n],p),p++;else if("Polygon"===s.type||"MultiLineString"===s.type)for(n=0;n<l.length;n++)for(i=0;i<l[n].length-g;i++)e(l[n][i],p),p++;else if("MultiPolygon"===s.type)for(n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)for(u=0;u<l[n][i].length-g;u++)e(l[n][i][u],p),p++;else{if("GeometryCollection"!==s.type)throw new Error("Unknown Geometry Type");for(n=0;n<s.geometries.length;n++)d(s.geometries[n],e,t)}}function h(r,e,t,o){var n=t;return d(r,function(r,o){n=0===o&&void 0===t?r:e(n,r,o)},o),n}function g(r,e){var t;switch(r.type){case"FeatureCollection":for(t=0;t<r.features.length;t++)e(r.features[t].properties,t);break;case"Feature":e(r.properties,0)}}function p(r,e,t){var o=t;return g(r,function(r,n){o=0===n&&void 0===t?r:e(o,r,n)}),o}function w(r,e){if("Feature"===r.type)e(r,0);else if("FeatureCollection"===r.type)for(var t=0;t<r.features.length;t++)e(r.features[t],t)}function y(r,e,t){var o=t;return w(r,function(r,n){o=0===n&&void 0===t?r:e(o,r,n)}),o}function m(r){var e=[];return d(r,function(r){e.push(r)}),e}function v(r,e){var t,o,n,i,a,u,s,f=0,l="FeatureCollection"===r.type,c="Feature"===r.type,d=l?r.features.length:1;for(t=0;d>t;t++)for(u=l?r.features[t].geometry:c?r.geometry:r,s="GeometryCollection"===u.type,a=s?u.geometries.length:1,n=0;a>n;n++)if(i=s?u.geometries[n]:u,"Point"===i.type||"LineString"===i.type||"MultiPoint"===i.type||"Polygon"===i.type||"MultiLineString"===i.type||"MultiPolygon"===i.type)e(i,f),f++;else{if("GeometryCollection"!==i.type)throw new Error("Unknown Geometry Type");for(o=0;o<i.geometries.length;o++)e(i.geometries[o],f),f++}}function E(r,e,t){var o=t;return v(r,function(r,n){o=0===n&&void 0===t?r:e(o,r,n)}),o}function b(r,e){if(!r)throw new Error("No geometry passed");return{type:"Feature",properties:e||{},geometry:r}}function M(r){if(!r)throw new Error("bbox is required");if(Array.isArray(r)||(r=gr(r)),4!==r.length)throw new Error("bbox must have 4 numbers");var e=r[0],t=r[1],o=r[2],n=r[3];return-180>e&&o>180&&(e=-180,o=180),-180>o&&e>180&&(e=-180,o=180),-90>t&&n>90&&(t=-90,n=90),-90>n&&t>90&&(t=-90,n=90),n>90&&(n=90),-90>t&&(t=-90),Math.abs(r[0]-r[2])>360&&(e=-180,o=180),Math.abs(r[1]-r[3])>180&&(t=-90,n=90),e=x(e),t=T(t),o=x(o),n=T(n),[e,t,o,n]}function P(r){var e;if(!r)throw new Error("center is required");if(Array.isArray(r))if(4===r.length){var t=r,o=t[0],n=t[1],i=t[2],a=t[3];e=[(o+i)/2,(n+a)/2]}else e=[r[0],r[1]];else e=Fr(r).geometry.coordinates;if(2!==e.length)throw new Error("center must have 2 numbers");var u=x(e[0]),s=T(e[1]);return[u,s]}function T(r){if(void 0===r||null===r)throw new Error("lat is required");return(r>90||-90>r)&&(r%=180,r>90&&(r=-180+r),-90>r&&(r=180+r),r===-0&&(r=0)),r}function x(r){if(void 0===r||void 0===r)throw new Error("lng is required");return(r>180||-180>r)&&(r%=360,r>180&&(r=-360+r),-180>r&&(r=360+r),r===-0&&(r=0)),r}function N(r){return r=r||256,2*Math.PI*6378137/r}function C(r){var e=r[0],t=r[1],o=r[2];return(1<<o)*((1<<o)+e)+t}function L(r){var e=r[0],t=r[1],o=r[2],n=r[3],i=(e-o)/2+o,a=(t-n)/2+n;return i=Number(i.toFixed(6)),a=Number(a.toFixed(6)),[i,a]}function k(r,e){r=X(r,e);var t=r[0],o=r[1],n=t*Sr/180,i=Math.log(Math.tan((90+o)*Math.PI/360))/(Math.PI/180);return i=i*Sr/180,n=Number(n.toFixed(1)),i=Number(i.toFixed(1)),[n,i]}function F(r){var e=r[0],t=r[1],o=e/Sr*180,n=t/Sr*180;return n=180/Math.PI*(2*Math.atan(Math.exp(n*Math.PI/180))-Math.PI/2),o=Number(o.toFixed(6)),n=Number(n.toFixed(6)),[o,n]}function q(r,e,t){var o=r[0],n=r[1],i=Y(e,t),a=(o+Sr)/i,u=(n+Sr)/i;return[a,u,e]}function I(r,e,t){r=X(r,t);var o=k(r),n=q(o,e);return B(n)}function G(r,e,t){if(r=X(r,t),0===e)return[0,0,0];var o=I(r,e);return U(o)}function S(r,e){if(0===e)return[0,0,0];var t=q(r,e);return B(t)}function A(r,e){var t=r[0],o=r[1],n=r[2],i=Y(n,e),a=t*i-Sr,u=o*i-Sr;return a=Number(a.toFixed(1)),u=Number(u.toFixed(1)),[a,u]}function B(r,e,t){e=e||256;var o=r[0],n=r[1],i=r[2];if(0===i)return[0,0,0];W(i,t);var a=Math.ceil(o/e)-1,u=Math.ceil(n/e)-1;return 0>a&&(a=0),0>u&&(u=0),[a,u,i]}function z(r,e,t){V(r,t),e=e||256;var o=r[0],n=r[1],i=r[2],a=A([o*e,n*e,i]),u=A([(o+1)*e,(n+1)*e,i]);return[a[0],a[1],u[0],u[1]]}function R(r,e){V(r,e);var t=r[0],o=r[1],n=r[2];if(0===n)return[-180,-85.051129,180,85.051129];var i=z([t,o,n]),a=i[0],u=i[1],s=i[2],f=i[3],l=F([a,u,n]),c=F([s,f,n]);return[l[0],l[1],c[0],c[1]]}function D(r){var e=j(r);return z(e)}function Q(r){var e=j(r);return R(e)}function U(r,e){V(r,e);var t=r[0],o=r[1],n=r[2];if(0===n)return[0,0,0];var i=t,a=Math.pow(2,n)-1-o;return[i,a,n]}function j(r){var e=r[0],t=r[1],o=r[2],n=e,i=Math.pow(2,o)-t-1;return[n,i,o]}function Z(r){var e=j(r);return H(e)}function H(r,e){V(r,e);var t=r[0],o=r[1],n=r[2];if(0===n)return"";var i="";return o=Math.pow(2,n)-1-o,$(n,0,-1).map(function(r){var e=0,n=1<<r-1;0!==(t&n)&&(e+=1),0!==(o&n)&&(e+=2),i=i.concat(e)}),i}function J(r){var e=K(r);return j(e)}function K(r){var e=0,t=0,o=r.length;return $(o,0,-1).map(function(n){var i=1<<n-1;switch(parseInt(r[o-n],0)){case 0:break;case 1:e+=i;break;case 2:t+=i;break;case 3:e+=i,t+=i;break;default:throw new Error("Invalid Quadkey digit sequence")}}),[e,t,o]}function O(r){var e=k([r[0],r[1]]),t=k([r[2],r[3]]);return[e[0],e[1],t[0],t[1]]}function V(r,e){var t=r[0],o=r[1],n=r[2];if(e===!1)return r;if(W(n),void 0===t||null===t)throw new Error("<x> is required");if(void 0===o||null===o)throw new Error("<y> is required");if(0>t)throw new Error("<x> must not be less than 0");if(0>o)throw new Error("<y> must not be less than 0");var i=Math.pow(2,n);if(t>=i||o>=i)throw new Error("Illegal parameters for tile");return r}function W(r){if(r===!1)return r;if(void 0===r||null===r)throw new Error("<zoom> is required");if(0>r)throw new Error("<zoom> cannot be less than 0");if(r>30)throw new Error("<zoom> cannot be greater than 30");return r}function X(r,e){if(e===!1)return r;var t=Gr(r[0]),o=Ir(r[1]);return o>85&&(o=85),-85>o&&(o=-85),[t,o]}function Y(r,e){return N(e)/Math.pow(2,r)}function $(r,e,t){null==e&&(e=r||0,r=0),t||(t=r>e?-1:1);for(var o=Math.max(Math.ceil((e-r)/t),0),n=Array(o),i=0;o>i;i++,r+=t)n[i]=r;return n}function _(r){if(r&&r[0]&&4===r.length&&void 0===r[0][0])return r;if(r&&r[0]&&void 0!==r[0][0]){var e=r[0][0],t=r[0][1],o=r[0][2],n=r[0][3];return r.map(function(r){r[0]<e&&(e=r[0]),r[1]<t&&(t=r[1]),r[2]>o&&(o=r[2]),r[3]>n&&(n=r[3])}),[e,t,o,n]}}function rr(r){try{return V(r),!0}catch(e){return!1}}var er={miles:3960,nauticalmiles:3441.145,degrees:57.2957795,radians:1,inches:250905600,yards:6969600,meters:6373e3,metres:6373e3,kilometers:6373,kilometres:6373,feet:20908792.65},tr={feature:r,featureCollection:n,geometryCollection:s,point:e,multiPoint:a,lineString:o,multiLineString:i,polygon:t,multiPolygon:u,radiansToDistance:f,distanceToRadians:l,distanceToDegrees:c},or=d,nr=h,ir=g,ar=p,ur=w,sr=y,fr=m,lr=v,cr=E,dr={coordEach:or,coordReduce:nr,propEach:ir,propReduce:ar,featureEach:ur,featureReduce:sr,coordAll:fr,geomEach:lr,geomReduce:cr},hr=dr.coordEach,gr=function(r){var e=[1/0,1/0,-(1/0),-(1/0)];return hr(r,function(r){e[0]>r[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]<r[0]&&(e[2]=r[0]),e[3]<r[1]&&(e[3]=r[1])}),e},pr=b,wr=function(r,e){if(!r)throw new Error("No coordinates passed");if(void 0===r.length)throw new Error("Coordinates must be an array");if(r.length<2)throw new Error("Coordinates must be at least 2 numbers long");if("number"!=typeof r[0]||"number"!=typeof r[1])throw new Error("Coordinates must numbers");return b({type:"Point",coordinates:r},e)},yr=function(r,e){if(!r)throw new Error("No coordinates passed");for(var t=0;t<r.length;t++){var o=r[t];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var n=0;n<o[o.length-1].length;n++)if(o[o.length-1][n]!==o[0][n])throw new Error("First and last Position are not equivalent.")}return b({type:"Polygon",coordinates:r},e)},mr=function(r,e){if(!r)throw new Error("No coordinates passed");return b({type:"LineString",coordinates:r},e)},vr=function(r){if(!r)throw new Error("No features passed");return{type:"FeatureCollection",features:r}},Er=function(r,e){if(!r)throw new Error("No coordinates passed");return b({type:"MultiLineString",coordinates:r},e)},br=function(r,e){if(!r)throw new Error("No coordinates passed");return b({type:"MultiPoint",coordinates:r},e)},Mr=function(r,e){if(!r)throw new Error("No coordinates passed");return b({type:"MultiPolygon",coordinates:r},e)},Pr=function(r,e){if(!r)throw new Error("No geometries passed");return b({type:"GeometryCollection",geometries:r},e)},Tr={miles:3960,nauticalmiles:3441.145,degrees:57.2957795,radians:1,inches:250905600,yards:6969600,meters:6373e3,metres:6373e3,kilometers:6373,kilometres:6373,feet:20908792.65},xr=function(r,e){var t=Tr[e||"kilometers"];if(void 0===t)throw new Error("Invalid unit");return r*t},Nr=function(r,e){var t=Tr[e||"kilometers"];if(void 0===t)throw new Error("Invalid unit");return r/t},Cr=function(r,e){var t=Tr[e||"kilometers"];if(void 0===t)throw new Error("Invalid unit");return r/t*57.2958},Lr={feature:pr,point:wr,polygon:yr,lineString:mr,featureCollection:vr,multiLineString:Er,multiPoint:br,multiPolygon:Mr,geometryCollection:Pr,radiansToDistance:xr,distanceToRadians:Nr,distanceToDegrees:Cr},kr=Lr.point,Fr=function(r){var e=gr(r),t=(e[0]+e[2])/2,o=(e[1]+e[3])/2;return kr([t,o])},qr={bbox:M,longitude:x,latitude:T,center:P},Ir=qr.latitude,Gr=qr.longitude,Sr=2*Math.PI*6378137/2,Ar={hash:C,bboxToCenter:L,lngLatToMeters:k,metersToLngLat:F,metersToPixels:q,lngLatToTile:I,lngLatToGoogle:G,metersToTile:S,pixelsToMeters:A,pixelsToTile:B,tileToBBoxMeters:z,tileToBBox:R,googleToBBoxMeters:D,googleToBBox:Q,tileToGoogle:U,googleToTile:j,googleToQuadkey:Z,tileToQuadkey:H,quadkeyToTile:J,quadkeyToGoogle:K,bboxToMeters:O,validateTile:V,validateZoom:W,validateLngLat:X,resolution:Y,range:$,maxBBox:_,validTile:rr},Br=tr.point,zr=tr.featureCollection,Rr=function(r,e,t,o){if(!r||!Array.isArray(r))throw new Error("matrix is required");if(!e)throw new Error("origin is required");Array.isArray(e)&&(e=Br(e));for(var n=r[0].length,i=r.length,a=1;i>a;a++)if(r[a].length!==n)throw new Error("matrix requires all rows of equal size");o=o||{},o.zProperty=o.zProperty||"elevation","miles"===o.units&&(t*=1.60934),t*=1e3;for(var u=Ar.lngLatToMeters(e.geometry.coordinates),s=u[0],f=u[1],l=[],c=0;i>c;c++){var d=[s,f+t*c],h=Br(Ar.metersToLngLat(d));h.properties[o.zProperty]=r[i-1-c][0];for(var g in o.properties)h.properties[g]=o.properties[g];l.push(h);for(var p=1;n>p;p++){var w=[s+t*p,d[1]],y=Br(Ar.metersToLngLat(w));for(var m in o.properties)y.properties[m]=o.properties[m];var v=r[i-1-c][p];y.properties[o.zProperty]=v,l.push(y)}}var E=zr(l);return E};return Rr});
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):t.matrixToGrid=r()}(this,function(){function t(t,r){if(!t)throw new Error("No geometry passed");return{type:"Feature",properties:r||{},geometry:t}}function r(r,o){if(!r)throw new Error("No coordinates passed");if(void 0===r.length)throw new Error("Coordinates must be an array");if(r.length<2)throw new Error("Coordinates must be at least 2 numbers long");if("number"!=typeof r[0]||"number"!=typeof r[1])throw new Error("Coordinates must numbers");return t({type:"Point",coordinates:r},o)}function o(r,o){if(!r)throw new Error("No coordinates passed");for(var a=0;a<r.length;a++){var e=r[a];if(e.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var n=0;n<e[e.length-1].length;n++)if(e[e.length-1][n]!==e[0][n])throw new Error("First and last Position are not equivalent.")}return t({type:"Polygon",coordinates:r},o)}function a(r,o){if(!r)throw new Error("No coordinates passed");return t({type:"LineString",coordinates:r},o)}function e(t){if(!t)throw new Error("No features passed");return{type:"FeatureCollection",features:t}}function n(r,o){if(!r)throw new Error("No coordinates passed");return t({type:"MultiLineString",coordinates:r},o)}function i(r,o){if(!r)throw new Error("No coordinates passed");return t({type:"MultiPoint",coordinates:r},o)}function s(r,o){if(!r)throw new Error("No coordinates passed");return t({type:"MultiPolygon",coordinates:r},o)}function h(r,o){if(!r)throw new Error("No geometries passed");return t({type:"GeometryCollection",geometries:r},o)}function c(t,r){var o=d[r||"kilometers"];if(void 0===o)throw new Error("Invalid unit");return t*o}function u(t,r){var o=d[r||"kilometers"];if(void 0===o)throw new Error("Invalid unit");return t/o}function M(t,r){var o=d[r||"kilometers"];if(void 0===o)throw new Error("Invalid unit");return t/o*57.2958}function l(t,r){return r={exports:{}},t(r,r.exports),r.exports}function p(t,r,o){var a=t.geometry.coordinates,e=new T(a[1],a[0]),n=e.rhumbDestinationPoint(r,o);return E([n.lon,n.lat])}var d={miles:3960,nauticalmiles:3441.145,degrees:57.2957795,radians:1,inches:250905600,yards:6969600,meters:6373e3,metres:6373e3,kilometers:6373,kilometres:6373,feet:20908792.65},f={feature:t,featureCollection:e,geometryCollection:h,point:r,multiPoint:i,lineString:a,multiLineString:n,polygon:o,multiPolygon:s,radiansToDistance:c,distanceToRadians:u,distanceToDegrees:M},m=l(function(t){"use strict";var r={};r.parseDMS=function(t){if("number"==typeof t&&isFinite(t))return Number(t);var r=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==r[r.length-1]&&r.splice(r.length-1),""==r)return 0/0;var o;switch(r.length){case 3:o=r[0]/1+r[1]/60+r[2]/3600;break;case 2:o=r[0]/1+r[1]/60;break;case 1:o=r[0];break;default:return 0/0}return/^-|[WS]$/i.test(t.trim())&&(o=-o),Number(o)},r.separator="",r.toDMS=function(t,o,a){if(isNaN(t))return null;if(void 0===o&&(o="dms"),void 0===a)switch(o){case"d":case"deg":a=4;break;case"dm":case"deg+min":a=2;break;case"dms":case"deg+min+sec":a=0;break;default:o="dms",a=0}t=Math.abs(t);var e,n,i,s;switch(o){default:case"d":case"deg":n=t.toFixed(a),100>n&&(n="0"+n),10>n&&(n="0"+n),e=n+"°";break;case"dm":case"deg+min":var h=(60*t).toFixed(a);n=Math.floor(h/60),i=(h%60).toFixed(a),100>n&&(n="0"+n),10>n&&(n="0"+n),10>i&&(i="0"+i),e=n+"°"+r.separator+i+"′";break;case"dms":case"deg+min+sec":var c=(3600*t).toFixed(a);n=Math.floor(c/3600),i=Math.floor(c/60)%60,s=(c%60).toFixed(a),100>n&&(n="0"+n),10>n&&(n="0"+n),10>i&&(i="0"+i),10>s&&(s="0"+s),e=n+"°"+r.separator+i+"′"+r.separator+s+"″"}return e},r.toLat=function(t,o,a){var e=r.toDMS(t,o,a);return null===e?"–":e.slice(1)+r.separator+(0>t?"S":"N")},r.toLon=function(t,o,a){var e=r.toDMS(t,o,a);return null===e?"–":e+r.separator+(0>t?"W":"E")},r.toBrng=function(t,o,a){t=(Number(t)+360)%360;var e=r.toDMS(t,o,a);return null===e?"–":e.replace("360","0")},r.compassPoint=function(t,r){void 0===r&&(r=3),t=(t%360+360)%360;var o;switch(r){case 1:switch(Math.round(4*t/360)%4){case 0:o="N";break;case 1:o="E";break;case 2:o="S";break;case 3:o="W"}break;case 2:switch(Math.round(8*t/360)%8){case 0:o="N";break;case 1:o="NE";break;case 2:o="E";break;case 3:o="SE";break;case 4:o="S";break;case 5:o="SW";break;case 6:o="W";break;case 7:o="NW"}break;case 3:switch(Math.round(16*t/360)%16){case 0:o="N";break;case 1:o="NNE";break;case 2:o="NE";break;case 3:o="ENE";break;case 4:o="E";break;case 5:o="ESE";break;case 6:o="SE";break;case 7:o="SSE";break;case 8:o="S";break;case 9:o="SSW";break;case 10:o="SW";break;case 11:o="WSW";break;case 12:o="W";break;case 13:o="WNW";break;case 14:o="NW";break;case 15:o="NNW"}break;default:throw new RangeError("Precision must be between 1 and 3")}return o},void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),t.exports&&(t.exports=r)}),g=l(function(t){"use strict";function r(t,o){return this instanceof r?(this.lat=Number(t),void(this.lon=Number(o))):new r(t,o)}if(t.exports)var o=m;r.prototype.distanceTo=function(t,o){if(!(t instanceof r))throw new TypeError("point is not LatLon object");o=void 0===o?6371e3:Number(o);var a=o,e=this.lat.toRadians(),n=this.lon.toRadians(),i=t.lat.toRadians(),s=t.lon.toRadians(),h=i-e,c=s-n,u=Math.sin(h/2)*Math.sin(h/2)+Math.cos(e)*Math.cos(i)*Math.sin(c/2)*Math.sin(c/2),M=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),l=a*M;return l},r.prototype.bearingTo=function(t){if(!(t instanceof r))throw new TypeError("point is not LatLon object");var o=this.lat.toRadians(),a=t.lat.toRadians(),e=(t.lon-this.lon).toRadians(),n=Math.sin(e)*Math.cos(a),i=Math.cos(o)*Math.sin(a)-Math.sin(o)*Math.cos(a)*Math.cos(e),s=Math.atan2(n,i);return(s.toDegrees()+360)%360},r.prototype.finalBearingTo=function(t){if(!(t instanceof r))throw new TypeError("point is not LatLon object");return(t.bearingTo(this)+180)%360},r.prototype.midpointTo=function(t){if(!(t instanceof r))throw new TypeError("point is not LatLon object");var o=this.lat.toRadians(),a=this.lon.toRadians(),e=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),i=Math.cos(e)*Math.cos(n),s=Math.cos(e)*Math.sin(n),h=Math.sqrt((Math.cos(o)+i)*(Math.cos(o)+i)+s*s),c=Math.sin(o)+Math.sin(e),u=Math.atan2(c,h),M=a+Math.atan2(s,Math.cos(o)+i);return new r(u.toDegrees(),(M.toDegrees()+540)%360-180)},r.prototype.intermediatePointTo=function(t,o){if(!(t instanceof r))throw new TypeError("point is not LatLon object");var a=this.lat.toRadians(),e=this.lon.toRadians(),n=t.lat.toRadians(),i=t.lon.toRadians(),s=Math.sin(a),h=Math.cos(a),c=Math.sin(e),u=Math.cos(e),M=Math.sin(n),l=Math.cos(n),p=Math.sin(i),d=Math.cos(i),f=n-a,m=i-e,g=Math.sin(f/2)*Math.sin(f/2)+Math.cos(a)*Math.cos(n)*Math.sin(m/2)*Math.sin(m/2),v=2*Math.atan2(Math.sqrt(g),Math.sqrt(1-g)),b=Math.sin((1-o)*v)/Math.sin(v),w=Math.sin(o*v)/Math.sin(v),y=b*h*u+w*l*d,N=b*h*c+w*l*p,x=b*s+w*M,R=Math.atan2(x,Math.sqrt(y*y+N*N)),L=Math.atan2(N,y);return new r(R.toDegrees(),(L.toDegrees()+540)%360-180)},r.prototype.destinationPoint=function(t,o,a){a=void 0===a?6371e3:Number(a);var e=Number(t)/a,n=Number(o).toRadians(),i=this.lat.toRadians(),s=this.lon.toRadians(),h=Math.sin(i),c=Math.cos(i),u=Math.sin(e),M=Math.cos(e),l=Math.sin(n),p=Math.cos(n),d=h*M+c*u*p,f=Math.asin(d),m=l*u*c,g=M-h*d,v=s+Math.atan2(m,g);return new r(f.toDegrees(),(v.toDegrees()+540)%360-180)},r.intersection=function(t,o,a,e){if(!(t instanceof r))throw new TypeError("p1 is not LatLon object");if(!(a instanceof r))throw new TypeError("p2 is not LatLon object");var n=t.lat.toRadians(),i=t.lon.toRadians(),s=a.lat.toRadians(),h=a.lon.toRadians(),c=Number(o).toRadians(),u=Number(e).toRadians(),M=s-n,l=h-i,p=2*Math.asin(Math.sqrt(Math.sin(M/2)*Math.sin(M/2)+Math.cos(n)*Math.cos(s)*Math.sin(l/2)*Math.sin(l/2)));if(0==p)return null;var d=Math.acos((Math.sin(s)-Math.sin(n)*Math.cos(p))/(Math.sin(p)*Math.cos(n)));isNaN(d)&&(d=0);var f=Math.acos((Math.sin(n)-Math.sin(s)*Math.cos(p))/(Math.sin(p)*Math.cos(s))),m=Math.sin(h-i)>0?d:2*Math.PI-d,g=Math.sin(h-i)>0?2*Math.PI-f:f,v=(c-m+Math.PI)%(2*Math.PI)-Math.PI,b=(g-u+Math.PI)%(2*Math.PI)-Math.PI;if(0==Math.sin(v)&&0==Math.sin(b))return null;if(Math.sin(v)*Math.sin(b)<0)return null;var w=Math.acos(-Math.cos(v)*Math.cos(b)+Math.sin(v)*Math.sin(b)*Math.cos(p)),y=Math.atan2(Math.sin(p)*Math.sin(v)*Math.sin(b),Math.cos(b)+Math.cos(v)*Math.cos(w)),N=Math.asin(Math.sin(n)*Math.cos(y)+Math.cos(n)*Math.sin(y)*Math.cos(c)),x=Math.atan2(Math.sin(c)*Math.sin(y)*Math.cos(n),Math.cos(y)-Math.sin(n)*Math.sin(N)),R=i+x;return new r(N.toDegrees(),(R.toDegrees()+540)%360-180)},r.prototype.crossTrackDistanceTo=function(t,o,a){if(!(t instanceof r))throw new TypeError("pathStart is not LatLon object");if(!(o instanceof r))throw new TypeError("pathEnd is not LatLon object");a=void 0===a?6371e3:Number(a);var e=t.distanceTo(this,a)/a,n=t.bearingTo(this).toRadians(),i=t.bearingTo(o).toRadians(),s=Math.asin(Math.sin(e)*Math.sin(n-i))*a;return s},r.prototype.maxLatitude=function(t){var r=Number(t).toRadians(),o=this.lat.toRadians(),a=Math.acos(Math.abs(Math.sin(r)*Math.cos(o)));return a.toDegrees()},r.crossingParallels=function(t,r,o){var a=Number(o).toRadians(),e=t.lat.toRadians(),n=t.lon.toRadians(),i=r.lat.toRadians(),s=r.lon.toRadians(),h=s-n,c=Math.sin(e)*Math.cos(i)*Math.cos(a)*Math.sin(h),u=Math.sin(e)*Math.cos(i)*Math.cos(a)*Math.cos(h)-Math.cos(e)*Math.sin(i)*Math.cos(a),M=Math.cos(e)*Math.cos(i)*Math.sin(a)*Math.sin(h);if(M*M>c*c+u*u)return null;var l=Math.atan2(-u,c),p=Math.acos(M/Math.sqrt(c*c+u*u)),d=n+l-p,f=n+l+p;return{lon1:(d.toDegrees()+540)%360-180,lon2:(f.toDegrees()+540)%360-180}},r.prototype.rhumbDistanceTo=function(t,o){if(!(t instanceof r))throw new TypeError("point is not LatLon object");o=void 0===o?6371e3:Number(o);var a=o,e=this.lat.toRadians(),n=t.lat.toRadians(),i=n-e,s=Math.abs(t.lon-this.lon).toRadians();Math.abs(s)>Math.PI&&(s=s>0?-(2*Math.PI-s):2*Math.PI+s);var h=Math.log(Math.tan(n/2+Math.PI/4)/Math.tan(e/2+Math.PI/4)),c=Math.abs(h)>1e-11?i/h:Math.cos(e),u=Math.sqrt(i*i+c*c*s*s),M=u*a;return M},r.prototype.rhumbBearingTo=function(t){if(!(t instanceof r))throw new TypeError("point is not LatLon object");var o=this.lat.toRadians(),a=t.lat.toRadians(),e=(t.lon-this.lon).toRadians();Math.abs(e)>Math.PI&&(e=e>0?-(2*Math.PI-e):2*Math.PI+e);var n=Math.log(Math.tan(a/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),i=Math.atan2(e,n);return(i.toDegrees()+360)%360},r.prototype.rhumbDestinationPoint=function(t,o,a){a=void 0===a?6371e3:Number(a);var e=Number(t)/a,n=this.lat.toRadians(),i=this.lon.toRadians(),s=Number(o).toRadians(),h=e*Math.cos(s),c=n+h;Math.abs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);var u=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),M=Math.abs(u)>1e-11?h/u:Math.cos(n),l=e*Math.sin(s)/M,p=i+l;return new r(c.toDegrees(),(p.toDegrees()+540)%360-180)},r.prototype.rhumbMidpointTo=function(t){if(!(t instanceof r))throw new TypeError("point is not LatLon object");var o=this.lat.toRadians(),a=this.lon.toRadians(),e=t.lat.toRadians(),n=t.lon.toRadians();Math.abs(n-a)>Math.PI&&(a+=2*Math.PI);var i=(o+e)/2,s=Math.tan(Math.PI/4+o/2),h=Math.tan(Math.PI/4+e/2),c=Math.tan(Math.PI/4+i/2),u=((n-a)*Math.log(c)+a*Math.log(h)-n*Math.log(s))/Math.log(h/s);isFinite(u)||(u=(a+n)/2);var M=r(i.toDegrees(),(u.toDegrees()+540)%360-180);return M},r.areaOf=function(t,r){function o(t){for(var r=0,o=t[0].bearingTo(t[1]),a=0;a<t.length-1;a++){var e=t[a].bearingTo(t[a+1]),n=t[a].finalBearingTo(t[a+1]);r+=(e-o+540)%360-180,r+=(n-e+540)%360-180,o=n}var e=t[0].bearingTo(t[1]);r+=(e-o+540)%360-180;var i=Math.abs(r)<90;return i}var a=void 0===r?6371e3:Number(r),e=t[0].equals(t[t.length-1]);e||t.push(t[0]);for(var n=t.length-1,i=0,s=0;n>s;s++){var h=t[s].lat.toRadians(),c=t[s+1].lat.toRadians(),u=(t[s+1].lon-t[s].lon).toRadians(),M=2*Math.atan2(Math.tan(u/2)*(Math.tan(h/2)+Math.tan(c/2)),1+Math.tan(h/2)*Math.tan(c/2));i+=M}o(t)&&(i=Math.abs(i)-2*Math.PI);var l=Math.abs(i*a*a);return e||t.pop(),l},r.prototype.equals=function(t){if(!(t instanceof r))throw new TypeError("point is not LatLon object");return this.lat!=t.lat?!1:this.lon!=t.lon?!1:!0},r.prototype.toString=function(t,r){return o.toLat(this.lat,t,r)+", "+o.toLon(this.lon,t,r)},void 0===Number.prototype.toRadians&&(Number.prototype.toRadians=function(){return this*Math.PI/180}),void 0===Number.prototype.toDegrees&&(Number.prototype.toDegrees=function(){return 180*this/Math.PI}),t.exports&&(t.exports=r)}),v=l(function(t){"use strict";function r(t,o,a){return this instanceof r?(this.x=Number(t),this.y=Number(o),void(this.z=Number(a))):new r(t,o,a)}r.prototype.plus=function(t){if(!(t instanceof r))throw new TypeError("v is not Vector3d object");return new r(this.x+t.x,this.y+t.y,this.z+t.z)},r.prototype.minus=function(t){if(!(t instanceof r))throw new TypeError("v is not Vector3d object");return new r(this.x-t.x,this.y-t.y,this.z-t.z)},r.prototype.times=function(t){return t=Number(t),new r(this.x*t,this.y*t,this.z*t)},r.prototype.dividedBy=function(t){return t=Number(t),new r(this.x/t,this.y/t,this.z/t)},r.prototype.dot=function(t){if(!(t instanceof r))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z},r.prototype.cross=function(t){if(!(t instanceof r))throw new TypeError("v is not Vector3d object");var o=this.y*t.z-this.z*t.y,a=this.z*t.x-this.x*t.z,e=this.x*t.y-this.y*t.x;return new r(o,a,e)},r.prototype.negate=function(){return new r(-this.x,-this.y,-this.z)},r.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},r.prototype.unit=function(){var t=this.length();if(1==t)return this;if(0==t)return this;var o=this.x/t,a=this.y/t,e=this.z/t;return new r(o,a,e)},r.prototype.angleTo=function(t,o){if(!(t instanceof r))throw new TypeError("v is not Vector3d object");var a=this.cross(t).length(),e=this.dot(t);if(void 0!==o){if(!(o instanceof r))throw new TypeError("vSign is not Vector3d object");a=this.cross(t).dot(o)<0?-a:a}return Math.atan2(a,e)},r.prototype.rotateAround=function(t,o){if(!(t instanceof r))throw new TypeError("axis is not Vector3d object");for(var a=this.unit(),e=[a.x,a.y,a.z],n=t.unit(),i=Math.sin(o),s=Math.cos(o),h=[[n.x*n.x*(1-s)+s,n.x*n.y*(1-s)-n.z*i,n.x*n.z*(1-s)+n.y*i],[n.y*n.x*(1-s)+n.z*i,n.y*n.y*(1-s)+s,n.y*n.z*(1-s)-n.x*i],[n.z*n.x*(1-s)-n.y*i,n.z*n.y*(1-s)+n.x*i,n.z*n.z*(1-s)+s]],c=[0,0,0],u=0;3>u;u++)for(var M=0;3>M;M++)c[u]+=h[u][M]*e[M];var l=new r(c[0],c[1],c[2]);return l},r.prototype.toString=function(t){var r=void 0===t?3:Number(t),o="["+this.x.toFixed(r)+","+this.y.toFixed(r)+","+this.z.toFixed(r)+"]";return o},t.exports&&(t.exports=r)}),b=l(function(t){"use strict";function r(t,o,a){return this instanceof r?(void 0===a&&(a=r.datum.WGS84),this.lat=Number(t),this.lon=Number(o),void(this.datum=a)):new r(t,o,a)}if(t.exports)var o=v;if(t.exports)var a=m;r.ellipsoid={WGS84:{a:6378137,b:6356752.31425,f:1/298.257223563},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Intl1924:{a:6378388,b:6356911.946,f:1/297},Bessel1841:{a:6377397.155,b:6356078.963,f:1/299.152815351}},r.datum={WGS84:{ellipsoid:r.ellipsoid.WGS84,transform:{tx:0,ty:0,tz:0,rx:0,ry:0,rz:0,s:0}},ITRF90:{ellipsoid:r.ellipsoid.GRS80,transform:{tx:-.06,ty:.517,tz:.223,rx:-.0183,ry:3e-4,rz:-.007,s:.011}},NAD83:{ellipsoid:r.ellipsoid.GRS80,transform:{tx:1.004,ty:-1.91,tz:-.515,rx:.0267,ry:34e-5,rz:.011,s:-.0015}},OSGB36:{ellipsoid:r.ellipsoid.Airy1830,transform:{tx:-446.448,ty:125.157,tz:-542.06,rx:-.1502,ry:-.247,rz:-.8421,s:20.4894}},ED50:{ellipsoid:r.ellipsoid.Intl1924,transform:{tx:89.5,ty:93.8,tz:123.1,rx:0,ry:0,rz:.156,s:-1.2}},Irl1975:{ellipsoid:r.ellipsoid.AiryModified,transform:{tx:-482.53,ty:130.596,tz:-564.557,rx:-1.042,ry:-.214,rz:-.631,s:-8.15}},TokyoJapan:{ellipsoid:r.ellipsoid.Bessel1841,transform:{tx:148,ty:-507,tz:-685,rx:0,ry:0,rz:0,s:0}}},r.prototype.convertDatum=function(t){var o,a=this;if(a.datum==r.datum.WGS84&&(o=t.transform),t==r.datum.WGS84){o={};for(var e in a.datum.transform)a.datum.transform.hasOwnProperty(e)&&(o[e]=-a.datum.transform[e])}void 0===o&&(a=this.convertDatum(r.datum.WGS84),o=t.transform);var n=a.toCartesian(),i=n.applyTransform(o),s=i.toLatLonE(t);return s},r.prototype.toCartesian=function(){var t=this.lat.toRadians(),r=this.lon.toRadians(),a=0,e=this.datum.ellipsoid.a,n=this.datum.ellipsoid.f,i=Math.sin(t),s=Math.cos(t),h=Math.sin(r),c=Math.cos(r),u=2*n-n*n,M=e/Math.sqrt(1-u*i*i),l=(M+a)*s*c,p=(M+a)*s*h,d=(M*(1-u)+a)*i,f=new o(l,p,d);return f},o.prototype.toLatLonE=function(t){var o=this.x,a=this.y,e=this.z,n=t.ellipsoid.a,i=t.ellipsoid.b,s=t.ellipsoid.f,h=2*s-s*s,c=h/(1-h),u=Math.sqrt(o*o+a*a),M=Math.sqrt(u*u+e*e),l=i*e/(n*u)*(1+c*i/M),p=l/Math.sqrt(1+l*l),d=p/l,f=isNaN(d)?0:Math.atan2(e+c*i*p*p*p,u-h*n*d*d*d),m=Math.atan2(a,o),g=Math.sin(f),v=(Math.cos(f),n/Math.sqrt(1-h*g*g),new r(f.toDegrees(),m.toDegrees(),t));return v},o.prototype.applyTransform=function(t){var r=this.x,a=this.y,e=this.z,n=t.tx,i=t.ty,s=t.tz,h=(t.rx/3600).toRadians(),c=(t.ry/3600).toRadians(),u=(t.rz/3600).toRadians(),M=t.s/1e6+1,l=n+r*M-a*u+e*c,p=i+r*u+a*M-e*h,d=s-r*c+a*h+e*M,f=new o(l,p,d);return f},r.prototype.toString=function(t,r){return a.toLat(this.lat,t,r)+", "+a.toLon(this.lon,t,r)},void 0===Number.prototype.toRadians&&(Number.prototype.toRadians=function(){return this*Math.PI/180}),void 0===Number.prototype.toDegrees&&(Number.prototype.toDegrees=function(){return 180*this/Math.PI}),t.exports&&(t.exports=r,t.exports.Vector3d=o)}),w=l(function(t){"use strict";t.exports&&(b.prototype.distanceTo=function(t){if(!(t instanceof b))throw new TypeError("point is not LatLon object");try{return this.inverse(t).distance}catch(r){return 0/0}}),b.prototype.initialBearingTo=function(t){if(!(t instanceof b))throw new TypeError("point is not LatLon object");try{return this.inverse(t).initialBearing}catch(r){return 0/0}},b.prototype.finalBearingTo=function(t){if(!(t instanceof b))throw new TypeError("point is not LatLon object");try{return this.inverse(t).finalBearing}catch(r){return 0/0}},b.prototype.destinationPoint=function(t,r){return this.direct(Number(t),Number(r)).point},b.prototype.finalBearingOn=function(t,r){return this.direct(Number(t),Number(r)).finalBearing},b.prototype.direct=function(t,r){var o,a,e,n,i,s=this.lat.toRadians(),h=this.lon.toRadians(),c=r.toRadians(),u=t,M=this.datum.ellipsoid.a,l=this.datum.ellipsoid.b,p=this.datum.ellipsoid.f,d=Math.sin(c),f=Math.cos(c),m=(1-p)*Math.tan(s),g=1/Math.sqrt(1+m*m),v=m*g,w=Math.atan2(m,f),y=g*d,N=1-y*y,x=N*(M*M-l*l)/(l*l),R=1+x/16384*(4096+x*(-768+x*(320-175*x))),L=x/1024*(256+x*(-128+x*(74-47*x))),E=u/(l*R),S=0;do o=Math.cos(2*w+E),a=Math.sin(E),e=Math.cos(E),n=L*a*(o+L/4*(e*(-1+2*o*o)-L/6*o*(-3+4*a*a)*(-3+4*o*o))),i=E,E=u/(l*R)+n;while(Math.abs(E-i)>1e-12&&++S<200);if(S>=200)throw new Error("Formula failed to converge");var T=v*a-g*e*f,P=Math.atan2(v*e+g*a*f,(1-p)*Math.sqrt(y*y+T*T)),I=Math.atan2(a*d,g*e-v*a*f),D=p/16*N*(4+p*(4-3*N)),k=I-(1-D)*p*y*(E+D*a*(o+D*e*(-1+2*o*o))),z=(h+k+3*Math.PI)%(2*Math.PI)-Math.PI,q=Math.atan2(y,-T);return q=(q+2*Math.PI)%(2*Math.PI),{point:new b(P.toDegrees(),z.toDegrees(),this.datum),finalBearing:q.toDegrees()}},b.prototype.inverse=function(t){var r,o,a,e,n,i,s,h,c,u,M,l=this,p=t,d=l.lat.toRadians(),f=l.lon.toRadians(),m=p.lat.toRadians(),g=p.lon.toRadians(),v=this.datum.ellipsoid.a,b=this.datum.ellipsoid.b,w=this.datum.ellipsoid.f,y=g-f,N=(1-w)*Math.tan(d),x=1/Math.sqrt(1+N*N),R=N*x,L=(1-w)*Math.tan(m),E=1/Math.sqrt(1+L*L),S=L*E,T=y,P=0;do{if(r=Math.sin(T),o=Math.cos(T),a=E*r*E*r+(x*S-R*E*o)*(x*S-R*E*o),e=Math.sqrt(a),0==e)return 0;n=R*S+x*E*o,i=Math.atan2(e,n),s=x*E*r/e,h=1-s*s,c=n-2*R*S/h,isNaN(c)&&(c=0),u=w/16*h*(4+w*(4-3*h)),M=T,T=y+(1-u)*w*s*(i+u*e*(c+u*n*(-1+2*c*c)))}while(Math.abs(T-M)>1e-12&&++P<200);if(P>=200)throw new Error("Formula failed to converge");var I=h*(v*v-b*b)/(b*b),D=1+I/16384*(4096+I*(-768+I*(320-175*I))),k=I/1024*(256+I*(-128+I*(74-47*I))),z=k*e*(c+k/4*(n*(-1+2*c*c)-k/6*c*(-3+4*e*e)*(-3+4*c*c))),q=b*D*(i-z),V=Math.atan2(E*r,x*S-R*E*o),F=Math.atan2(x*r,-R*E+x*S*o);return V=(V+2*Math.PI)%(2*Math.PI),F=(F+2*Math.PI)%(2*Math.PI),q=Number(q.toFixed(3)),{distance:q,initialBearing:V.toDegrees(),finalBearing:F.toDegrees()}},void 0===Number.prototype.toRadians&&(Number.prototype.toRadians=function(){return this*Math.PI/180}),void 0===Number.prototype.toDegrees&&(Number.prototype.toDegrees=function(){return 180*this/Math.PI}),t.exports&&(t.exports=b)}),y=l(function(t){"use strict";function r(t,o){return this instanceof r?(this.lat=Number(t),void(this.lon=Number(o))):new r(t,o)}if(t.exports)var o=v;if(t.exports)var a=m;r.prototype.toVector=function(){var t=this.lat.toRadians(),r=this.lon.toRadians(),a=Math.cos(t)*Math.cos(r),e=Math.cos(t)*Math.sin(r),n=Math.sin(t);return new o(a,e,n)},o.prototype.toLatLonS=function(){var t=Math.atan2(this.z,Math.sqrt(this.x*this.x+this.y*this.y)),o=Math.atan2(this.y,this.x);return new r(t.toDegrees(),o.toDegrees())},r.prototype.greatCircle=function(t){var r=this.lat.toRadians(),a=this.lon.toRadians(),e=Number(t).toRadians(),n=Math.sin(a)*Math.cos(e)-Math.sin(r)*Math.cos(a)*Math.sin(e),i=-Math.cos(a)*Math.cos(e)-Math.sin(r)*Math.sin(a)*Math.sin(e),s=Math.cos(r)*Math.sin(e);return new o(n,i,s)},o.prototype.greatCircle=function(t){var r=Number(t).toRadians(),a=new o(0,0,1),e=a.cross(this),n=this.cross(e),i=e.times(Math.cos(r)/e.length()),s=n.times(Math.sin(r)/n.length()),h=s.minus(i);return h},r.prototype.distanceTo=function(t,o){if(!(t instanceof r))throw new TypeError("point is not LatLon object");o=void 0===o?6371e3:Number(o);var a=this.toVector(),e=t.toVector(),n=a.angleTo(e),i=n*o;return i},r.prototype.bearingTo=function(t){if(!(t instanceof r))throw new TypeError("point is not LatLon object");var a=this.toVector(),e=t.toVector(),n=new o(0,0,1),i=a.cross(e),s=a.cross(n),h=i.angleTo(s,a).toDegrees();return(h+360)%360},r.prototype.midpointTo=function(t){if(!(t instanceof r))throw new TypeError("point is not LatLon object");var o=this.toVector(),a=t.toVector(),e=o.plus(a).unit();return e.toLatLonS()},r.prototype.destinationPoint=function(t,r,a){a=void 0===a?6371e3:Number(a);var e=this.toVector(),n=Number(t)/a,i=Number(r).toRadians(),s=new o(0,0,1),h=s.cross(e).unit(),c=e.cross(h),u=h.times(Math.sin(i)),M=c.times(Math.cos(i)),l=M.plus(u),p=e.times(Math.cos(n)),d=l.times(Math.sin(n)),f=p.plus(d);return f.toLatLonS()},r.intersection=function(t,o,a,e){if(!(t instanceof r))throw new TypeError("path1start is not LatLon object");if(!(a instanceof r))throw new TypeError("path2start is not LatLon object");if(!(o instanceof r)&&isNaN(o))throw new TypeError("path1brngEnd is not LatLon object or bearing");if(!(e instanceof r)&&isNaN(e))throw new TypeError("path2brngEnd is not LatLon object or bearing");var n,i,s,h,c=t.toVector(),u=a.toVector();o instanceof r?(n=c.cross(o.toVector()),s="endpoint"):(n=t.greatCircle(Number(o)),s="bearing"),e instanceof r?(i=u.cross(e.toVector()),h="endpoint"):(i=a.greatCircle(Number(e)),h="bearing");var M=n.cross(i),l=i.cross(n),p=null,d=null,f=null;switch(s+"+"+h){case"bearing+bearing":switch(d=Math.sign(n.cross(c).dot(M)),f=Math.sign(i.cross(u).dot(M)),d+f){case 2:p=M;break;case-2:p=l;break;case 0:p=c.plus(u).dot(M)>0?l:M}break;case"bearing+endpoint":d=Math.sign(n.cross(c).dot(M)),p=d>0?M:l;break;case"endpoint+bearing":f=Math.sign(i.cross(u).dot(M)),p=f>0?M:l;break;case"endpoint+endpoint":var m=c.plus(u).plus(o.toVector()).plus(e.toVector());p=m.dot(M)>0?M:l}return p.toLatLonS()},r.prototype.crossTrackDistanceTo=function(t,o,a){if(!(t instanceof r))throw new TypeError("pathStart is not LatLon object");var e=void 0===a?6371e3:Number(a),n=this.toVector(),i=o instanceof r?t.toVector().cross(o.toVector()):t.greatCircle(Number(o)),s=i.angleTo(n)-Math.PI/2,h=s*e;return h},r.prototype.nearestPointOnSegment=function(t,r){var o=null;if(this.isBetween(t,r)){var a=this.toVector(),e=t.toVector(),n=r.toVector(),i=e.cross(n),s=a.cross(i),h=i.cross(s);o=h.toLatLonS()}else{var c=this.distanceTo(t),u=this.distanceTo(r);o=u>c?t:r}return o},r.prototype.isBetween=function(t,r){var o=this.toVector(),a=t.toVector(),e=r.toVector(),n=o.minus(a),i=e.minus(a),s=o.minus(e),h=a.minus(e),c=n.dot(i),u=s.dot(h),M=c>=0&&u>=0;return M},r.prototype.enclosedBy=function(t){var r=t[0].equals(t[t.length-1]);r||t.push(t[0]);for(var o=t.length-1,a=this.toVector(),e=[],n=0;o>n;n++)e[n]=a.minus(t[n].toVector());e.push(e[0]);for(var i=0,n=0;o>n;n++)i+=e[n].angleTo(e[n+1],a);var s=Math.abs(i)>Math.PI;return r||t.pop(),s},r.areaOf=function(t,r){var o=void 0===r?6371e3:Number(r);t[0].equals(t[t.length-1])||t.push(t[0]);var a=t.length-1;console.log("n",a);for(var e=[],n=0;a>n;n++){var i=t[n].toVector(),s=t[n+1].toVector();e[n]=i.cross(s)}console.log("c",e.length,e),e.push(e[0]);for(var h=0,n=0;a>n;n++)console.log(n,(Math.PI-e[n].angleTo(e[n+1])).toDegrees()),h+=Math.PI-e[n].angleTo(e[n+1]);console.log("Σθ",h.toDegrees(),((a-2)*Math.PI).toDegrees());var c=h-(a-2)*Math.PI,u=c*o*o;return u},r.meanOf=function(t){for(var r=new o(0,0,0),a=0;a<t.length;a++)r=r.plus(t[a].toVector());return r.unit().toLatLonS()},r.prototype.equals=function(t){if(!(t instanceof r))throw new TypeError("point is not LatLon object");return this.lat!=t.lat?!1:this.lon!=t.lon?!1:!0},r.prototype.toString=function(t,r){return a.toLat(this.lat,t,r)+", "+a.toLon(this.lon,t,r)},void 0===Number.prototype.toRadians&&(Number.prototype.toRadians=function(){return this*Math.PI/180}),void 0===Number.prototype.toDegrees&&(Number.prototype.toDegrees=function(){return 180*this/Math.PI}),void 0===Math.sign&&(Math.sign=function(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1}),t.exports&&(t.exports=r,t.exports.Vector3d=o)}),N=l(function(t){"use strict";function r(t,a,e,n,i,s,h){if(!(this instanceof r))return new r(t,a,e,n,i,s,h);if(void 0===i&&(i=o.datum.WGS84),void 0===s&&(s=null),void 0===h&&(h=null),!(t>=1&&60>=t))throw new Error("Invalid UTM zone "+t);if(!a.match(/[NS]/i))throw new Error("Invalid UTM hemisphere "+a);this.zone=Number(t),this.hemisphere=a.toUpperCase(),this.easting=Number(e),this.northing=Number(n),this.datum=i,this.convergence=null===s?null:Number(s),this.scale=null===h?null:Number(h)}if(t.exports)var o=b;o.prototype.toUtm=function(){if(isNaN(this.lat)||isNaN(this.lon))throw new Error("Invalid point");if(!(-80<this.lat&&this.lat<84))throw new Error("Outside UTM limits ("+this.lat+","+this.lon+")");var t=5e5,o=1e7,a=Math.floor((this.lon+180)/6)+1,e=(6*(a-1)-180+3).toRadians(),n="CDEFGHJKLMNPQRSTUVWXX",i=n.charAt(Math.floor(this.lat/8+10));31==a&&"V"==i&&this.lon>=3&&(a++,e+=6..toRadians()),32==a&&"X"==i&&this.lon<9&&(a--,e-=6..toRadians()),32==a&&"X"==i&&this.lon>=9&&(a++,e+=6..toRadians()),34==a&&"X"==i&&this.lon<21&&(a--,e-=6..toRadians()),34==a&&"X"==i&&this.lon>=21&&(a++,e+=6..toRadians()),36==a&&"X"==i&&this.lon<33&&(a--,e-=6..toRadians()),36==a&&"X"==i&&this.lon>=33&&(a++,e+=6..toRadians());for(var s=this.lat.toRadians(),h=this.lon.toRadians()-e,c=this.datum.ellipsoid.a,u=this.datum.ellipsoid.f,M=.9996,l=Math.sqrt(u*(2-u)),p=u/(2-u),d=p*p,f=p*d,m=p*f,g=p*m,v=p*g,b=Math.cos(h),w=Math.sin(h),y=Math.tan(h),N=Math.tan(s),x=Math.sinh(l*Math.atanh(l*N/Math.sqrt(1+N*N))),R=N*Math.sqrt(1+x*x)-x*Math.sqrt(1+N*N),L=Math.atan2(R,b),E=Math.asinh(w/Math.sqrt(R*R+b*b)),S=c/(1+p)*(1+.25*d+1/64*m+1/256*v),T=[null,.5*p-2/3*d+5/16*f+41/180*m-127/288*g+7891/37800*v,13/48*d-.6*f+557/1440*m+281/630*g-1983433/1935360*v,61/240*f-103/140*m+15061/26880*g+167603/181440*v,49561/161280*m-179/168*g+6601661/7257600*v,34729/80640*g-3418889/1995840*v,.6650675310896665*v],P=L,I=1;6>=I;I++)P+=T[I]*Math.sin(2*I*L)*Math.cosh(2*I*E);for(var D=E,I=1;6>=I;I++)D+=T[I]*Math.cos(2*I*L)*Math.sinh(2*I*E);for(var k=M*S*D,z=M*S*P,q=1,I=1;6>=I;I++)q+=2*I*T[I]*Math.cos(2*I*L)*Math.cosh(2*I*E);for(var V=0,I=1;6>=I;I++)V+=2*I*T[I]*Math.sin(2*I*L)*Math.sinh(2*I*E);var F=Math.atan(R/Math.sqrt(1+R*R)*y),G=Math.atan2(V,q),j=F+G,B=Math.sin(s),C=Math.sqrt(1-l*l*B*B)*Math.sqrt(1+N*N)/Math.sqrt(R*R+b*b),W=S/c*Math.sqrt(q*q+V*V),A=M*C*W;k+=t,0>z&&(z+=o),k=Number(k.toFixed(6)),z=Number(z.toFixed(6));var O=Number(j.toDegrees().toFixed(9)),U=Number(A.toFixed(12)),X=this.lat>=0?"N":"S";return new r(a,X,k,z,this.datum,O,U)},r.prototype.toLatLonE=function(){var t=this.zone,r=this.hemisphere,a=this.easting,e=this.northing;if(isNaN(t)||isNaN(a)||isNaN(e))throw new Error("Invalid coordinate");var n=5e5,i=1e7,s=this.datum.ellipsoid.a,h=this.datum.ellipsoid.f,c=.9996;a-=n,e="S"==r?e-i:e;for(var u=Math.sqrt(h*(2-h)),M=h/(2-h),l=M*M,p=M*l,d=M*p,f=M*d,m=M*f,g=s/(1+M)*(1+.25*l+1/64*d+1/256*m),v=a/(c*g),b=e/(c*g),w=[null,.5*M-2/3*l+37/96*p-1/360*d-81/512*f+96199/604800*m,1/48*l+1/15*p-437/1440*d+46/105*f-1118711/3870720*m,17/480*p-37/840*d-209/4480*f+5569/90720*m,4397/161280*d-11/504*f-830251/7257600*m,4583/161280*f-108847/3991680*m,.03233083094085698*m],y=b,N=1;6>=N;N++)y-=w[N]*Math.sin(2*N*b)*Math.cosh(2*N*v);for(var x=v,N=1;6>=N;N++)x-=w[N]*Math.cos(2*N*b)*Math.sinh(2*N*v);var R=Math.sinh(x),L=Math.sin(y),E=Math.cos(y),S=L/Math.sqrt(R*R+E*E),T=S;do{var P=Math.sinh(u*Math.atanh(u*T/Math.sqrt(1+T*T))),I=T*Math.sqrt(1+P*P)-P*Math.sqrt(1+T*T),D=(S-I)/Math.sqrt(1+I*I)*(1+(1-u*u)*T*T)/((1-u*u)*Math.sqrt(1+T*T));T+=D}while(Math.abs(D)>1e-12);for(var k=T,z=Math.atan(k),q=Math.atan2(R,E),V=1,N=1;6>=N;N++)V-=2*N*w[N]*Math.cos(2*N*b)*Math.cosh(2*N*v);for(var F=0,N=1;6>=N;N++)F+=2*N*w[N]*Math.sin(2*N*b)*Math.sinh(2*N*v);var G=Math.atan(Math.tan(y)*Math.tanh(x)),j=Math.atan2(F,V),B=G+j,C=Math.sin(z),W=Math.sqrt(1-u*u*C*C)*Math.sqrt(1+k*k)*Math.sqrt(R*R+E*E),A=g/s/Math.sqrt(V*V+F*F),O=c*W*A,U=(6*(t-1)-180+3).toRadians();q+=U;var X=Number(z.toDegrees().toFixed(11)),$=Number(q.toDegrees().toFixed(11)),J=Number(B.toDegrees().toFixed(9)),H=Number(O.toFixed(12)),K=new o(X,$,this.datum);return K.convergence=J,K.scale=H,K},r.parse=function(t,a){if(void 0===a&&(a=o.datum.WGS84),t=t.trim().match(/\S+/g),null==t||4!=t.length)throw new Error("Invalid UTM coordinate ‘"+t+"’");var e=t[0],n=t[1],i=t[2],s=t[3];return new r(e,n,i,s,a)},r.prototype.toString=function(t){t=Number(t||0);var r=this.zone<10?"0"+this.zone:this.zone,o=this.hemisphere,a=this.easting,e=this.northing;return isNaN(r)||!o.match(/[NS]/)||isNaN(a)||isNaN(e)?"":r+" "+o+" "+a.toFixed(t)+" "+e.toFixed(t)},void 0===Math.sinh&&(Math.sinh=function(t){return(Math.exp(t)-Math.exp(-t))/2}),void 0===Math.cosh&&(Math.cosh=function(t){return(Math.exp(t)+Math.exp(-t))/2}),void 0===Math.tanh&&(Math.tanh=function(t){return(Math.exp(t)-Math.exp(-t))/(Math.exp(t)+Math.exp(-t))}),void 0===Math.asinh&&(Math.asinh=function(t){return Math.log(t+Math.sqrt(1+t*t))}),void 0===Math.atanh&&(Math.atanh=function(t){return Math.log((1+t)/(1-t))/2}),void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),t.exports&&(t.exports=r)}),x=l(function(t){"use strict";function r(t,o,a,e,n,i,s){if(!(this instanceof r))return new r(t,o,a,e,n,i,s);if(void 0===s&&(s=b.datum.WGS84),!(t>=1&&60>=t))throw new Error("Invalid MGRS grid reference (zone ‘"+t+"’)");if(1!=o.length)throw new Error("Invalid MGRS grid reference (band ‘"+o+"’)");if(-1==r.latBands.indexOf(o))throw new Error("Invalid MGRS grid reference (band ‘"+o+"’)");if(1!=a.length)throw new Error("Invalid MGRS grid reference (e100k ‘"+a+"’)");if(1!=e.length)throw new Error("Invalid MGRS grid reference (n100k ‘"+e+"’)");this.zone=Number(t),this.band=o,this.e100k=a,this.n100k=e,this.easting=Number(n),this.northing=Number(i),this.datum=s}t.exports&&t.exports&&(r.latBands="CDEFGHJKLMNPQRSTUVWXX"),r.e100kLetters=["ABCDEFGH","JKLMNPQR","STUVWXYZ"],r.n100kLetters=["ABCDEFGHJKLMNPQRSTUV","FGHJKLMNPQRSTUVABCDE"],N.prototype.toMgrs=function(){if(isNaN(this.zone+this.easting+this.northing))throw new Error("Invalid UTM coordinate ‘"+this.toString()+"’");var t=this.zone,o=this.toLatLonE(),a=r.latBands.charAt(Math.floor(o.lat/8+10)),e=Math.floor(this.easting/1e5),n=r.e100kLetters[(t-1)%3].charAt(e-1),i=Math.floor(this.northing/1e5)%20,s=r.n100kLetters[(t-1)%2].charAt(i),h=this.easting%1e5,c=this.northing%1e5;
return h=Number(h.toFixed(6)),c=Number(c.toFixed(6)),new r(t,a,n,s,h,c)},r.prototype.toUtm=function(){for(var t=this.zone,o=this.band,a=this.e100k,e=this.n100k,n=this.easting,i=this.northing,s=o>="N"?"N":"S",h=r.e100kLetters[(t-1)%3].indexOf(a)+1,c=1e5*h,u=r.n100kLetters[(t-1)%2].indexOf(e),M=1e5*u,l=8*(r.latBands.indexOf(o)-10),p=1e5*Math.floor(new b(l,0).toUtm().northing/1e5),d=0;p>d+M+i;)d+=2e6;return new N(t,s,c+n,d+M+i,this.datum)},r.parse=function(t){if(t=t.trim(),!t.match(/\s/)){var o=t.slice(5);o=o.slice(0,o.length/2)+" "+o.slice(-o.length/2),t=t.slice(0,3)+" "+t.slice(3,5)+" "+o}if(t=t.match(/\S+/g),null==t||4!=t.length)throw new Error("Invalid MGRS grid reference ‘"+t+"’");var a=t[0],e=a.slice(0,2),n=a.slice(2,3),i=t[1],s=i.slice(0,1),h=i.slice(1,2),c=t[2],u=t[3];return c=c.length>=5?c:(c+"00000").slice(0,5),u=u.length>=5?u:(u+"00000").slice(0,5),new r(e,n,s,h,c,u)},r.prototype.toString=function(t){if(t=void 0===t?10:Number(t),-1==[2,4,6,8,10].indexOf(t))throw new Error("Invalid precision ‘"+t+"’");var r=this.zone.pad(2),o=this.band,a=this.e100k,e=this.n100k,n=Math.floor(this.easting/Math.pow(10,5-t/2)),i=Math.floor(this.northing/Math.pow(10,5-t/2));return n=n.pad(t/2),i=i.pad(t/2),r+o+" "+a+e+" "+n+" "+i},void 0===Number.prototype.pad&&(Number.prototype.pad=function(t){for(var r=this.toString();r.length<t;)r="0"+r;return r}),t.exports&&(t.exports=r)}),R=l(function(t){"use strict";function r(t,o){return this instanceof r?(this.easting=Number(t),void(this.northing=Number(o))):new r(t,o)}if(t.exports)var o=b;r.latLonToOsGrid=function(t){if(!(t instanceof o))throw new TypeError("point is not LatLon object");t.datum!=o.datum.OSGB36&&(t=t.convertDatum(o.datum.OSGB36));var a=t.lat.toRadians(),e=t.lon.toRadians(),n=6377563.396,i=6356256.909,s=.9996012717,h=49..toRadians(),c=(-2).toRadians(),u=-1e5,M=4e5,l=1-i*i/(n*n),p=(n-i)/(n+i),d=p*p,f=p*p*p,m=Math.cos(a),g=Math.sin(a),v=n*s/Math.sqrt(1-l*g*g),b=n*s*(1-l)/Math.pow(1-l*g*g,1.5),w=v/b-1,y=(1+p+5/4*d+5/4*f)*(a-h),N=(3*p+3*p*p+21/8*f)*Math.sin(a-h)*Math.cos(a+h),x=(15/8*d+15/8*f)*Math.sin(2*(a-h))*Math.cos(2*(a+h)),R=35/24*f*Math.sin(3*(a-h))*Math.cos(3*(a+h)),L=i*s*(y-N+x-R),E=m*m*m,S=E*m*m,T=Math.tan(a)*Math.tan(a),P=T*T,I=L+u,D=v/2*g*m,k=v/24*g*E*(5-T+9*w),z=v/720*g*S*(61-58*T+P),q=v*m,V=v/6*E*(v/b-T),F=v/120*S*(5-18*T+P+14*w-58*T*w),G=e-c,j=G*G,B=j*G,C=B*G,W=C*G,A=W*G,O=I+D*j+k*C+z*A,U=M+q*G+V*B+F*W;return O=Number(O.toFixed(3)),U=Number(U.toFixed(3)),new r(U,O)},r.osGridToLatLon=function(t,a){if(!(t instanceof r))throw new TypeError("gridref is not OsGridRef object");void 0===a&&(a=o.datum.WGS84);var e=t.easting,n=t.northing,i=6377563.396,s=6356256.909,h=.9996012717,c=49..toRadians(),u=(-2).toRadians(),M=-1e5,l=4e5,p=1-s*s/(i*i),d=(i-s)/(i+s),f=d*d,m=d*d*d,g=c,v=0;do{g=(n-M-v)/(i*h)+g;var b=(1+d+5/4*f+5/4*m)*(g-c),w=(3*d+3*d*d+21/8*m)*Math.sin(g-c)*Math.cos(g+c),y=(15/8*f+15/8*m)*Math.sin(2*(g-c))*Math.cos(2*(g+c)),N=35/24*m*Math.sin(3*(g-c))*Math.cos(3*(g+c));v=s*h*(b-w+y-N)}while(n-M-v>=1e-5);var x=Math.cos(g),R=Math.sin(g),L=i*h/Math.sqrt(1-p*R*R),E=i*h*(1-p)/Math.pow(1-p*R*R,1.5),S=L/E-1,T=Math.tan(g),P=T*T,I=P*P,D=I*P,k=1/x,z=L*L*L,q=z*L*L,V=q*L*L,F=T/(2*E*L),G=T/(24*E*z)*(5+3*P+S-9*P*S),j=T/(720*E*q)*(61+90*P+45*I),B=k/L,C=k/(6*z)*(L/E+2*P),W=k/(120*q)*(5+28*P+24*I),A=k/(5040*V)*(61+662*P+1320*I+720*D),O=e-l,U=O*O,X=U*O,$=U*U,J=X*U,H=$*U,K=J*U;g=g-F*U+G*$-j*H;var Q=u+B*O-C*X+W*J-A*K,Z=new o(g.toDegrees(),Q.toDegrees(),o.datum.OSGB36);return a!=o.datum.OSGB36&&(Z=Z.convertDatum(a)),Z},r.parse=function(t){t=String(t).trim();var o=t.match(/^(\d+),\s*(\d+)$/);if(o)return new r(o[1],o[2]);if(o=t.match(/^[A-Z]{2}\s*[0-9]+\s*[0-9]+$/i),!o)throw new Error("Invalid grid reference");var a=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),e=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);a>7&&a--,e>7&&e--;var n=(a-2)%5*5+e%5,i=19-5*Math.floor(a/5)-Math.floor(e/5),s=t.slice(2).trim().split(/\s+/);if(1==s.length&&(s=[s[0].slice(0,s[0].length/2),s[0].slice(s[0].length/2)]),0>n||n>6||0>i||i>12)throw new Error("Invalid grid reference");if(2!=s.length)throw new Error("Invalid grid reference");if(s[0].length!=s[1].length)throw new Error("Invalid grid reference");s[0]=(s[0]+"00000").slice(0,5),s[1]=(s[1]+"00000").slice(0,5);var h=n+s[0],c=i+s[1];return new r(h,c)},r.prototype.toString=function(t){if(t=void 0===t?10:Number(t),isNaN(t))throw new Error("Invalid precision");var r=this.easting,o=this.northing;if(isNaN(r)||isNaN(o))throw new Error("Invalid grid reference");if(0==t)return r.pad(6)+","+o.pad(6);var a=Math.floor(r/1e5),e=Math.floor(o/1e5);if(0>a||a>6||0>e||e>12)return"";var n=19-e-(19-e)%5+Math.floor((a+10)/5),i=5*(19-e)%25+a%5;n>7&&n++,i>7&&i++;var s=String.fromCharCode(n+"A".charCodeAt(0),i+"A".charCodeAt(0));r=Math.floor(r%1e5/Math.pow(10,5-t/2)),o=Math.floor(o%1e5/Math.pow(10,5-t/2));var h=s+" "+r.pad(t/2)+" "+o.pad(t/2);return h},void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),void 0===Number.prototype.pad&&(Number.prototype.pad=function(t){for(var r=this.toString();r.length<t;)r="0"+r;return r}),t.exports&&(t.exports=r)}),L=l(function(t,r){"use strict";r.LatLonSpherical=g,r.LatLonEllipsoidal=b;for(var o in w)r.LatLonEllipsoidal[o]=w[o];r.LatLonVectors=y,r.Vector3d=v,r.Utm=N,r.Mgrs=x,r.OsGridRef=R,r.Dms=m}),E=f.point,S=f.featureCollection,T=L.LatLonSpherical,P=function(t,r,o,a){if(!t||!Array.isArray(t))throw new Error("matrix is required");if(!r)throw new Error("origin is required");Array.isArray(r)&&(r=E(r));for(var e=t[0].length,n=t.length,i=1;n>i;i++)if(t[i].length!==e)throw new Error("matrix requires all rows of equal size");a=a||{},a.zProperty=a.zProperty||"elevation","miles"===a.units&&(o*=1.60934),o*=1e3;for(var s=[],h=0;n>h;h++){var c=p(r,o*h,0);c.properties[a.zProperty]=t[n-1-h][0];for(var u in a.properties)c.properties[u]=a.properties[u];s.push(c);for(var M=1;e>M;M++){var l=p(c,o*M,90);for(var d in a.properties)l.properties[d]=a.properties[d];var f=t[n-1-h][M];l.properties[a.zProperty]=f,s.push(l)}}var m=S(s);return m};return P});
var helpers = require('@turf/helpers');
var point = helpers.point;
var featureCollection = helpers.featureCollection;
var mercator = require('global-mercator');
var GeodesyLatLon = require('geodesy').LatLonSpherical;

@@ -41,5 +41,5 @@ /**

if (Array.isArray(origin)) {
origin = point(origin); // Convert GeoJSON to bbox
origin = point(origin); // Convert coordinates array to point
}
// all array same size
// all matrix array have to be of the same size
var matrixCols = matrix[0].length;

@@ -60,11 +60,6 @@ var matrixRows = matrix.length;

var originCoordsMeters = mercator.lngLatToMeters(origin.geometry.coordinates);
var x0 = originCoordsMeters[0];
var y0 = originCoordsMeters[1];
var points = [];
for (var r = 0; r < matrixRows; r++) {
// create first point in the row
var firstCoordsMeters = [x0, y0 + cellSize * r];
var first = point(mercator.metersToLngLat(firstCoordsMeters));
var first = rhumbDestinationPoint(origin, cellSize * r, 0);
first.properties[options.zProperty] = matrix[matrixRows - 1 - r][0];

@@ -77,4 +72,3 @@ for (var prop in options.properties) {

// create the other points in the same row
var pointCoordsMeters = [x0 + cellSize * c, firstCoordsMeters[1]];
var pt = point(mercator.metersToLngLat(pointCoordsMeters));
var pt = rhumbDestinationPoint(first, cellSize * c, 90);
for (var prop2 in options.properties) {

@@ -93,1 +87,21 @@ pt.properties[prop2] = options.properties[prop2];

};
/**
* Returns the destination point having travelled along a rhumb line from the originPoint the given
* distance on the given bearing.
*
* @private
* @param {Point|Array<number>} originPoint - Distance travelled, in same units as earth radius (default: metres).
* @param {number} distance - Distance travelled, in same units as earth radius (default: metres).
* @param {number} bearing - Bearing in degrees from north.
* @returns {Point|Array<number>} Destination point.
*
*/
function rhumbDestinationPoint(originPoint, distance, bearing) {
var coords = originPoint.geometry.coordinates;
var pt = new GeodesyLatLon(coords[1], coords[0]);
var destination = pt.rhumbDestinationPoint(distance, bearing);
return point([destination.lon, destination.lat]);
}
{
"name": "matrix-to-grid",
"version": "3.0.0",
"version": "3.0.1",
"description": "Takes a matrix array of numbers and returns a grid of GeoJSON points with correspondent property value",

@@ -58,4 +58,4 @@ "main": "index.js",

"@turf/helpers": "4.1.0",
"global-mercator": "2.7.0"
"geodesy": "1.1.1"
}
}

Sorry, the diff of this file is too big to display

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