UNPKG

localcoords

Version:

实现国内地方投影坐标,Beijing54 地理坐标,Beijing54 投影坐标,WGS84 地理坐标的转换

1 lines 86.3 kB
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports):"function"==typeof define&&define.amd?define(["exports"],s):s((t="undefined"!=typeof globalThis?globalThis:t||self).localcoords={})}(this,(function(t){"use strict";var s=6378137,i=.0066943799901413165,a=484813681109536e-20,h=Math.PI/2,e=1e-10,n=.017453292519943295,r=57.29577951308232,o=Math.PI/4,l=2*Math.PI,c=3.14159265359,u={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},M={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},f=/[\s_\-\/\(\)]/g;function d(t,s){if(t[s])return t[s];for(var i,a=Object.keys(t),h=s.toLowerCase().replace(f,""),e=-1;++e<a.length;)if((i=a[e]).toLowerCase().replace(f,"")===h)return t[i]}function p(t){var s,i,a,h={},e=t.split("+").map((function(t){return t.trim()})).filter((function(t){return t})).reduce((function(t,s){var i=s.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t}),{}),r={proj:"projName",datum:"datumCode",rf:function(t){h.rf=parseFloat(t)},lat_0:function(t){h.lat0=t*n},lat_1:function(t){h.lat1=t*n},lat_2:function(t){h.lat2=t*n},lat_ts:function(t){h.lat_ts=t*n},lon_0:function(t){h.long0=t*n},lon_1:function(t){h.long1=t*n},lon_2:function(t){h.long2=t*n},alpha:function(t){h.alpha=parseFloat(t)*n},gamma:function(t){h.rectified_grid_angle=parseFloat(t)},lonc:function(t){h.longc=t*n},x_0:function(t){h.x0=parseFloat(t)},y_0:function(t){h.y0=parseFloat(t)},k_0:function(t){h.k0=parseFloat(t)},k:function(t){h.k0=parseFloat(t)},a:function(t){h.a=parseFloat(t)},b:function(t){h.b=parseFloat(t)},r_a:function(){h.R_A=!0},zone:function(t){h.zone=parseInt(t,10)},south:function(){h.utmSouth=!0},towgs84:function(t){h.datum_params=t.split(",").map((function(t){return parseFloat(t)}))},to_meter:function(t){h.to_meter=parseFloat(t)},units:function(t){h.units=t;var s=d(M,t);s&&(h.to_meter=s.to_meter)},from_greenwich:function(t){h.from_greenwich=t*n},pm:function(t){var s=d(u,t);h.from_greenwich=(s||parseFloat(t))*n},nadgrids:function(t){"@null"===t?h.datumCode="none":h.nadgrids=t},axis:function(t){var s="ewnsud";3===t.length&&-1!==s.indexOf(t.substr(0,1))&&-1!==s.indexOf(t.substr(1,1))&&-1!==s.indexOf(t.substr(2,1))&&(h.axis=t)},approx:function(){h.approx=!0}};for(s in e)i=e[s],s in r?"function"==typeof(a=r[s])?a(i):h[a]=i:h[s]=i;return"string"==typeof h.datumCode&&"WGS84"!==h.datumCode&&(h.datumCode=h.datumCode.toLowerCase()),h}var m=/\s/,y=/[A-Za-z]/,_=/[A-Za-z84]/,x=/[,\]]/,g=/[\d\.E\-\+]/;function v(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=1}function b(t,s,i){Array.isArray(s)&&(i.unshift(s),s=null);var a=s?{}:t,h=i.reduce((function(t,s){return w(s,t),t}),a);s&&(t[s]=h)}function w(t,s){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(s[i]={},void w(t[0],s[i])):void(s[i]=t[0]);if(t.length)if("TOWGS84"!==i){if("AXIS"===i)return i in s||(s[i]=[]),void s[i].push(t);var a;switch(Array.isArray(i)||(s[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return s[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&w(t[2],s[i]));case"SPHEROID":case"ELLIPSOID":return s[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&w(t[3],s[i]));case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":return t[0]=["name",t[0]],void b(s,i,t);default:for(a=-1;++a<t.length;)if(!Array.isArray(t[a]))return w(t,s[i]);return b(s,i,t)}}else s[i]=t;else s[i]=!0}else s[t]=!0}v.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;m.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},v.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(x.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},v.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},v.prototype.number=function(t){if(!g.test(t)){if(x.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},v.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},v.prototype.keyword=function(t){if(_.test(t))this.word+=t;else{if("["===t){var s=[];return s.push(this.word),this.level++,null===this.root?this.root=s:this.currentObject.push(s),this.stack.push(this.currentObject),this.currentObject=s,void(this.state=1)}if(!x.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},v.prototype.neutral=function(t){if(y.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(g.test(t))return this.word=t,void(this.state=3);if(!x.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},v.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function N(t){return.017453292519943295*t}function C(t){var s=new v(t).output(),i=s.shift(),a=s.shift();s.unshift(["name",a]),s.unshift(["type",i]);var h={};return w(s,h),function(t){if("GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var s="",i=0,a=t.AXIS.length;i<a;++i){var h=t.AXIS[i][0].toLowerCase();-1!==h.indexOf("north")?s+="n":-1!==h.indexOf("south")?s+="s":-1!==h.indexOf("east")?s+="e":-1!==h.indexOf("west")&&(s+="w")}2===s.length&&(s+="u"),3===s.length&&(t.axis=s)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var e=t.GEOGCS;function n(s){return s*(t.to_meter||1)}"GEOGCS"===t.type&&(e=t),e&&(e.DATUM?t.datumCode=e.DATUM.name.toLowerCase():t.datumCode=e.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_geodetic_datum_1949"!==t.datumCode&&"new_zealand_1949"!==t.datumCode||(t.datumCode="nzgd49"),"wgs_1984"!==t.datumCode&&"world_geodetic_system_1984"!==t.datumCode||("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"_ferro"===t.datumCode.slice(-6)&&(t.datumCode=t.datumCode.slice(0,-6)),"_jakarta"===t.datumCode.slice(-8)&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),e.DATUM&&e.DATUM.SPHEROID&&(t.ellps=e.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=e.DATUM.SPHEROID.a,t.rf=parseFloat(e.DATUM.SPHEROID.rf,10)),e.DATUM&&e.DATUM.TOWGS84&&(t.datum_params=e.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_2","Standard_Parallel_2"],["false_easting","False_Easting"],["false_northing","False_Northing"],["central_meridian","Central_Meridian"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",N],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",N],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",N],["lat0","latitude_of_origin",N],["lat0","standard_parallel_1",N],["lat1","standard_parallel_1",N],["lat2","standard_parallel_2",N],["azimuth","Azimuth"],["alpha","azimuth",N],["srsCode","name"]].forEach((function(s){return function(t,s){var i=s[0],a=s[1];!(i in t)&&a in t&&(t[i]=t[a],3===s.length&&(t[i]=s[2](t[i])))}(t,s)})),t.long0||!t.longc||"Albers_Conic_Equal_Area"!==t.projName&&"Lambert_Azimuthal_Equal_Area"!==t.projName||(t.long0=t.longc),t.lat_ts||!t.lat1||"Stereographic_South_Pole"!==t.projName&&"Polar Stereographic (variant B)"!==t.projName||(t.lat0=N(t.lat1>0?90:-90),t.lat_ts=t.lat1)}(h),h}function S(t){var s=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?S[t]=p(arguments[1]):S[t]=C(arguments[1]):S[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map((function(t){Array.isArray(t)?S.apply(s,t):S(t)}));if("string"==typeof t){if(t in S)return S[t]}else"EPSG"in t?S["EPSG:"+t.EPSG]=t:"ESRI"in t?S["ESRI:"+t.ESRI]=t:"IAU2000"in t?S["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(S);var P=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var E=["3857","900913","3785","102113"];function k(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in S}(t))return S[t];if(function(t){return P.some((function(s){return t.indexOf(s)>-1}))}(t)){var s=C(t);if(function(t){var s=d(t,"authority");if(s){var i=d(s,"epsg");return i&&E.indexOf(i)>-1}}(s))return S["EPSG:3857"];var i=function(t){var s=d(t,"extension");if(s)return d(s,"proj4")}(s);return i?p(i):s}return function(t){return"+"===t[0]}(t)?p(t):void 0}function I(t,s){var i,a;if(t=t||{},!s)return t;for(a in s)void 0!==(i=s[a])&&(t[a]=i);return t}function A(t,s,i){var a=t*s;return i/Math.sqrt(1-a*a)}function q(t){return t<0?-1:1}function O(t){return Math.abs(t)<=c?t:t-q(t)*l}function j(t,s,i){var a=t*i,e=.5*t;return a=Math.pow((1-a)/(1+a),e),Math.tan(.5*(h-s))/a}function G(t,s){for(var i,a,e=.5*t,n=h-2*Math.atan(s),r=0;r<=15;r++)if(i=t*Math.sin(n),n+=a=h-2*Math.atan(s*Math.pow((1-i)/(1+i),e))-n,Math.abs(a)<=1e-10)return n;return-9999}function L(t){return t}var z=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=A(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var s,i,a=t.x,n=t.y;if(n*r>90&&n*r<-90&&a*r>180&&a*r<-180)return null;if(Math.abs(Math.abs(n)-h)<=e)return null;if(this.sphere)s=this.x0+this.a*this.k0*O(a-this.long0),i=this.y0+this.a*this.k0*Math.log(Math.tan(o+.5*n));else{var l=Math.sin(n),c=j(this.e,n,l);s=this.x0+this.a*this.k0*O(a-this.long0),i=this.y0-this.a*this.k0*Math.log(c)}return t.x=s,t.y=i,t},inverse:function(t){var s,i,a=t.x-this.x0,e=t.y-this.y0;if(this.sphere)i=h-2*Math.atan(Math.exp(-e/(this.a*this.k0)));else{var n=Math.exp(-e/(this.a*this.k0));if(-9999===(i=G(this.e,n)))return null}return s=O(this.long0+a/(this.a*this.k0)),t.x=s,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:L,inverse:L,names:["longlat","identity"]}],R={},T=[];function B(t,s){var i=T.length;return t.names?(T[i]=t,t.names.forEach((function(t){R[t.toLowerCase()]=i})),this):(console.log(s),!0)}var D={start:function(){z.forEach(B)},add:B,get:function(t){if(!t)return!1;var s=t.toLowerCase();return void 0!==R[s]&&T[R[s]]?T[R[s]]:void 0}},F={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},U=F.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};F.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var Q={};Q.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Q.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Q.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Q.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Q.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Q.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Q.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Q.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},Q.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Q.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Q.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Q.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Q.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Q.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Q.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Q.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Q.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var W={};function X(t){if(0===t.length)return null;var s="@"===t[0];return s&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!s,grid:null,isNull:!0}:{name:t,mandatory:!s,grid:W[t]||null,isNull:!1}}function H(t){return t/3600*Math.PI/180}function J(t,s,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(s,i)))}function K(t){return t.map((function(t){return[H(t.longitudeShift),H(t.latitudeShift)]}))}function V(t,s,i){return{name:J(t,s+8,s+16).trim(),parent:J(t,s+24,s+24+8).trim(),lowerLatitude:t.getFloat64(s+72,i),upperLatitude:t.getFloat64(s+88,i),lowerLongitude:t.getFloat64(s+104,i),upperLongitude:t.getFloat64(s+120,i),latitudeInterval:t.getFloat64(s+136,i),longitudeInterval:t.getFloat64(s+152,i),gridNodeCount:t.getInt32(s+168,i)}}function Z(t,s,i,a){for(var h=s+176,e=[],n=0;n<i.gridNodeCount;n++){var r={latitudeShift:t.getFloat32(h+16*n,a),longitudeShift:t.getFloat32(h+16*n+4,a),latitudeAccuracy:t.getFloat32(h+16*n+8,a),longitudeAccuracy:t.getFloat32(h+16*n+12,a)};e.push(r)}return e}function Y(t,s){if(!(this instanceof Y))return new Y(t);s=s||function(t){if(t)throw t};var i=k(t);if("object"==typeof i){var h=Y.projections.get(i.projName);if(h){if(i.datumCode&&"none"!==i.datumCode){var n=d(Q,i.datumCode);n&&(i.datum_params=i.datum_params||(n.towgs84?n.towgs84.split(","):null),i.ellps=n.ellipse,i.datumName=n.datumName?n.datumName:i.datumCode)}i.k0=i.k0||1,i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84",i.lat1=i.lat1||i.lat0;var r,o,l,c,u,M,f,p=function(t,s,i,a,h){if(!t){var n=d(F,a);n||(n=U),t=n.a,s=n.b,i=n.rf}return i&&!s&&(s=(1-1/i)*t),(0===i||Math.abs(t-s)<e)&&(h=!0,s=t),{a:t,b:s,rf:i,sphere:h}}(i.a,i.b,i.rf,i.ellps,i.sphere),m=(r=p.a,o=p.b,p.rf,l=i.R_A,M=((c=r*r)-(u=o*o))/c,f=0,l?(c=(r*=1-M*(.16666666666666666+M*(.04722222222222222+.022156084656084655*M)))*r,M=0):f=Math.sqrt(M),{es:M,e:f,ep2:(c-u)/u}),y=function(t){return void 0===t?null:t.split(",").map(X)}(i.nadgrids),_=i.datum||function(t,s,i,h,e,n,r){var o={};return o.datum_type=void 0===t||"none"===t?5:4,s&&(o.datum_params=s.map(parseFloat),0===o.datum_params[0]&&0===o.datum_params[1]&&0===o.datum_params[2]||(o.datum_type=1),o.datum_params.length>3&&(0===o.datum_params[3]&&0===o.datum_params[4]&&0===o.datum_params[5]&&0===o.datum_params[6]||(o.datum_type=2,o.datum_params[3]*=a,o.datum_params[4]*=a,o.datum_params[5]*=a,o.datum_params[6]=o.datum_params[6]/1e6+1))),r&&(o.datum_type=3,o.grids=r),o.a=i,o.b=h,o.es=e,o.ep2=n,o}(i.datumCode,i.datum_params,p.a,p.b,m.es,m.ep2,y);I(this,i),I(this,h),this.a=p.a,this.b=p.b,this.rf=p.rf,this.sphere=p.sphere,this.es=m.es,this.e=m.e,this.ep2=m.ep2,this.datum=_,this.init(),s(null,this)}else s(t)}else s(t)}function $(t,s,i){var a,e,n,r,o=t.x,l=t.y,c=t.z?t.z:0;if(l<-h&&l>-1.001*h)l=-h;else if(l>h&&l<1.001*h)l=h;else{if(l<-h)return{x:-1/0,y:-1/0,z:t.z};if(l>h)return{x:1/0,y:1/0,z:t.z}}return o>Math.PI&&(o-=2*Math.PI),e=Math.sin(l),r=Math.cos(l),n=e*e,{x:((a=i/Math.sqrt(1-s*n))+c)*r*Math.cos(o),y:(a+c)*r*Math.sin(o),z:(a*(1-s)+c)*e}}function tt(t,s,i,a){var e,n,r,o,l,c,u,M,f,d,p,m,y,_,x,g=1e-12,v=t.x,b=t.y,w=t.z?t.z:0;if(e=Math.sqrt(v*v+b*b),n=Math.sqrt(v*v+b*b+w*w),e/i<g){if(_=0,n/i<g)return h,x=-a,{x:t.x,y:t.y,z:t.z}}else _=Math.atan2(b,v);r=w/n,M=(o=e/n)*(1-s)*(l=1/Math.sqrt(1-s*(2-s)*o*o)),f=r*l,y=0;do{y++,c=s*(u=i/Math.sqrt(1-s*f*f))/(u+(x=e*M+w*f-u*(1-s*f*f))),m=(p=r*(l=1/Math.sqrt(1-c*(2-c)*o*o)))*M-(d=o*(1-c)*l)*f,M=d,f=p}while(m*m>1e-24&&y<30);return{x:_,y:Math.atan(p/Math.abs(d)),z:x}}function st(t){return 1===t||2===t}function it(t,a,h){if(function(t,s){return t.datum_type===s.datum_type&&!(t.a!==s.a||Math.abs(t.es-s.es)>5e-11)&&(1===t.datum_type?t.datum_params[0]===s.datum_params[0]&&t.datum_params[1]===s.datum_params[1]&&t.datum_params[2]===s.datum_params[2]:2!==t.datum_type||t.datum_params[0]===s.datum_params[0]&&t.datum_params[1]===s.datum_params[1]&&t.datum_params[2]===s.datum_params[2]&&t.datum_params[3]===s.datum_params[3]&&t.datum_params[4]===s.datum_params[4]&&t.datum_params[5]===s.datum_params[5]&&t.datum_params[6]===s.datum_params[6])}(t,a))return h;if(5===t.datum_type||5===a.datum_type)return h;var e=t.a,n=t.es;if(3===t.datum_type){if(0!==at(t,!1,h))return;e=s,n=i}var r=a.a,o=a.b,l=a.es;if(3===a.datum_type&&(r=s,o=6356752.314,l=i),n===l&&e===r&&!st(t.datum_type)&&!st(a.datum_type))return h;if((h=$(h,n,e),st(t.datum_type)&&(h=function(t,s,i){if(1===s)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(2===s){var a=i[0],h=i[1],e=i[2],n=i[3],r=i[4],o=i[5],l=i[6];return{x:l*(t.x-o*t.y+r*t.z)+a,y:l*(o*t.x+t.y-n*t.z)+h,z:l*(-r*t.x+n*t.y+t.z)+e}}}(h,t.datum_type,t.datum_params)),st(a.datum_type)&&(h=function(t,s,i){if(1===s)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(2===s){var a=i[0],h=i[1],e=i[2],n=i[3],r=i[4],o=i[5],l=i[6],c=(t.x-a)/l,u=(t.y-h)/l,M=(t.z-e)/l;return{x:c+o*u-r*M,y:-o*c+u+n*M,z:r*c-n*u+M}}}(h,a.datum_type,a.datum_params)),h=tt(h,l,r,o),3===a.datum_type)&&0!==at(a,!0,h))return;return h}function at(t,s,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;for(var a={x:-i.x,y:i.y},h={x:Number.NaN,y:Number.NaN},e=[],n=0;n<t.grids.length;n++){var o=t.grids[n];if(e.push(o.name),o.isNull){h=a;break}if(o.mandatory,null!==o.grid){var l=o.grid.subgrids[0],c=(Math.abs(l.del[1])+Math.abs(l.del[0]))/1e4,u=l.ll[0]-c,M=l.ll[1]-c,f=l.ll[0]+(l.lim[0]-1)*l.del[0]+c,d=l.ll[1]+(l.lim[1]-1)*l.del[1]+c;if(!(M>a.y||u>a.x||d<a.y||f<a.x||(h=ht(a,s,l),isNaN(h.x))))break}else if(o.mandatory)return console.log("Unable to find mandatory grid '"+o.name+"'"),-1}return isNaN(h.x)?(console.log("Failed to find a grid shift table for location '"+-a.x*r+" "+a.y*r+" tried: '"+e+"'"),-1):(i.x=-h.x,i.y=h.y,0)}function ht(t,s,i){var a={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return a;var h={x:t.x,y:t.y};h.x-=i.ll[0],h.y-=i.ll[1],h.x=O(h.x-Math.PI)+Math.PI;var e=et(h,i);if(s){if(isNaN(e.x))return a;e.x=h.x-e.x,e.y=h.y-e.y;var n,r,o=9;do{if(r=et(e,i),isNaN(r.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}n={x:h.x-(r.x+e.x),y:h.y-(r.y+e.y)},e.x+=n.x,e.y+=n.y}while(o--&&Math.abs(n.x)>1e-12&&Math.abs(n.y)>1e-12);if(o<0)return console.log("Inverse grid shift iterator failed to converge."),a;a.x=O(e.x+i.ll[0]),a.y=e.y+i.ll[1]}else isNaN(e.x)||(a.x=t.x+e.x,a.y=t.y+e.y);return a}function et(t,s){var i,a={x:t.x/s.del[0],y:t.y/s.del[1]},h=Math.floor(a.x),e=Math.floor(a.y),n=a.x-1*h,r=a.y-1*e,o={x:Number.NaN,y:Number.NaN};if(h<0||h>=s.lim[0])return o;if(e<0||e>=s.lim[1])return o;i=e*s.lim[0]+h;var l=s.cvs[i][0],c=s.cvs[i][1];i++;var u=s.cvs[i][0],M=s.cvs[i][1];i+=s.lim[0];var f=s.cvs[i][0],d=s.cvs[i][1];i--;var p=s.cvs[i][0],m=s.cvs[i][1],y=n*r,_=n*(1-r),x=(1-n)*(1-r),g=(1-n)*r;return o.x=x*l+_*u+g*p+y*f,o.y=x*c+_*M+g*m+y*d,o}function nt(t,s,i){var a,h,e,n=i.x,r=i.y,o=i.z||0,l={};for(e=0;e<3;e++)if(!s||2!==e||void 0!==i.z)switch(0===e?(a=n,h=-1!=="ew".indexOf(t.axis[e])?"x":"y"):1===e?(a=r,h=-1!=="ns".indexOf(t.axis[e])?"y":"x"):(a=o,h="z"),t.axis[e]){case"e":l[h]=a;break;case"w":l[h]=-a;break;case"n":l[h]=a;break;case"s":l[h]=-a;break;case"u":void 0!==i[h]&&(l.z=a);break;case"d":void 0!==i[h]&&(l.z=-a);break;default:return null}return l}function rt(t){var s={x:t[0],y:t[1]};return t.length>2&&(s.z=t[2]),t.length>3&&(s.m=t[3]),s}function ot(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function lt(t,s,i){var a;if(Array.isArray(i)&&(i=rt(i)),function(t){ot(t.x),ot(t.y)}(i),t.datum&&s.datum&&function(t,s){return(1===t.datum.datum_type||2===t.datum.datum_type)&&"WGS84"!==s.datumCode||(1===s.datum.datum_type||2===s.datum.datum_type)&&"WGS84"!==t.datumCode}(t,s)&&(i=lt(t,a=new Y("WGS84"),i),t=a),"enu"!==t.axis&&(i=nt(t,!1,i)),"longlat"===t.projName)i={x:i.x*n,y:i.y*n,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=it(t.datum,s.datum,i))return s.from_greenwich&&(i={x:i.x-s.from_greenwich,y:i.y,z:i.z||0}),"longlat"===s.projName?i={x:i.x*r,y:i.y*r,z:i.z||0}:(i=s.forward(i),s.to_meter&&(i={x:i.x/s.to_meter,y:i.y/s.to_meter,z:i.z||0})),"enu"!==s.axis?nt(s,!0,i):i}Y.projections=D,Y.projections.start();var ct=Y("WGS84");function ut(t,s,i){var a,h,e;return Array.isArray(i)?(a=lt(t,s,i)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==s.name&&"geocent"===s.name?"number"==typeof a.z?[a.x,a.y,a.z].concat(i.splice(3)):[a.x,a.y,i[2]].concat(i.splice(3)):[a.x,a.y].concat(i.splice(2)):[a.x,a.y]):(h=lt(t,s,i),2===(e=Object.keys(i)).length||e.forEach((function(a){if(void 0!==t.name&&"geocent"===t.name||void 0!==s.name&&"geocent"===s.name){if("x"===a||"y"===a||"z"===a)return}else if("x"===a||"y"===a)return;h[a]=i[a]})),h)}function Mt(t){return t instanceof Y?t:t.oProj?t.oProj:Y(t)}function ft(t,s,i){t=Mt(t);var a,h=!1;return void 0===s?(s=t,t=ct,h=!0):(void 0!==s.x||Array.isArray(s))&&(i=s,s=t,t=ct,h=!0),s=Mt(s),i?ut(t,s,i):(a={forward:function(i){return ut(t,s,i)},inverse:function(i){return ut(s,t,i)}},h&&(a.oProj=s),a)}var dt="AJSAJS",pt="AFAFAF",mt=65,yt=73,_t=79,xt=86,gt=90,vt={forward:bt,inverse:function(t){var s=St(kt(t.toUpperCase()));if(s.lat&&s.lon)return[s.lon,s.lat,s.lon,s.lat];return[s.left,s.bottom,s.right,s.top]},toPoint:wt};function bt(t,s){return s=s||5,function(t,s){var i="00000"+t.easting,a="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(f=t.easting,d=t.northing,p=t.zoneNumber,m=Et(p),y=Math.floor(f/1e5),_=Math.floor(d/1e5)%20,h=y,e=_,n=m,r=n-1,o=dt.charCodeAt(r),l=pt.charCodeAt(r),c=o+h-1,u=l+e,M=!1,c>gt&&(c=c-gt+mt-1,M=!0),(c===yt||o<yt&&c>yt||(c>yt||o<yt)&&M)&&c++,(c===_t||o<_t&&c>_t||(c>_t||o<_t)&&M)&&++c===yt&&c++,c>gt&&(c=c-gt+mt-1),u>xt?(u=u-xt+mt-1,M=!0):M=!1,(u===yt||l<yt&&u>yt||(u>yt||l<yt)&&M)&&u++,(u===_t||l<_t&&u>_t||(u>_t||l<_t)&&M)&&++u===yt&&u++,u>xt&&(u=u-xt+mt-1),String.fromCharCode(c)+String.fromCharCode(u))+i.substr(i.length-5,s)+a.substr(a.length-5,s);var h,e,n,r,o,l,c,u,M;var f,d,p,m,y,_}(function(t){var s,i,a,h,e,n,r,o,l=t.lat,c=t.lon,u=6378137,M=.00669438,f=.9996,d=Nt(l),p=Nt(c);o=Math.floor((c+180)/6)+1,180===c&&(o=60);l>=56&&l<64&&c>=3&&c<12&&(o=32);l>=72&&l<84&&(c>=0&&c<9?o=31:c>=9&&c<21?o=33:c>=21&&c<33?o=35:c>=33&&c<42&&(o=37));r=Nt(6*(o-1)-180+3),s=M/(1-M),i=u/Math.sqrt(1-M*Math.sin(d)*Math.sin(d)),a=Math.tan(d)*Math.tan(d),h=s*Math.cos(d)*Math.cos(d),e=Math.cos(d)*(p-r),n=u*((1-M/4-3*M*M/64-5*M*M*M/256)*d-(3*M/8+3*M*M/32+45*M*M*M/1024)*Math.sin(2*d)+(15*M*M/256+45*M*M*M/1024)*Math.sin(4*d)-35*M*M*M/3072*Math.sin(6*d));var m=f*i*(e+(1-a+h)*e*e*e/6+(5-18*a+a*a+72*h-58*s)*e*e*e*e*e/120)+5e5,y=f*(n+i*Math.tan(d)*(e*e/2+(5-a+9*h+4*h*h)*e*e*e*e/24+(61-58*a+a*a+600*h-330*s)*e*e*e*e*e*e/720));l<0&&(y+=1e7);return{northing:Math.round(y),easting:Math.round(m),zoneNumber:o,zoneLetter:Pt(l)}}({lat:t[1],lon:t[0]}),s)}function wt(t){var s=St(kt(t.toUpperCase()));return s.lat&&s.lon?[s.lon,s.lat]:[(s.left+s.right)/2,(s.top+s.bottom)/2]}function Nt(t){return t*(Math.PI/180)}function Ct(t){return t/Math.PI*180}function St(t){var s=t.northing,i=t.easting,a=t.zoneLetter,h=t.zoneNumber;if(h<0||h>60)return null;var e,n,r,o,l,c,u,M,f,d=.9996,p=6378137,m=.00669438,y=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),_=i-5e5,x=s;a<"N"&&(x-=1e7),u=6*(h-1)-180+3,e=.006739496752268451,f=(M=x/d/6367449.145945056)+(3*y/2-27*y*y*y/32)*Math.sin(2*M)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*M)+151*y*y*y/96*Math.sin(6*M),n=p/Math.sqrt(1-m*Math.sin(f)*Math.sin(f)),r=Math.tan(f)*Math.tan(f),o=e*Math.cos(f)*Math.cos(f),l=.99330562*p/Math.pow(1-m*Math.sin(f)*Math.sin(f),1.5),c=_/(n*d);var g=f-n*Math.tan(f)/l*(c*c/2-(5+3*r+10*o-4*o*o-9*e)*c*c*c*c/24+(61+90*r+298*o+45*r*r-1.6983531815716497-3*o*o)*c*c*c*c*c*c/720);g=Ct(g);var v,b=(c-(1+2*r+o)*c*c*c/6+(5-2*o+28*r-3*o*o+8*e+24*r*r)*c*c*c*c*c/120)/Math.cos(f);if(b=u+Ct(b),t.accuracy){var w=St({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});v={top:w.lat,right:w.lon,bottom:g,left:b}}else v={lat:g,lon:b};return v}function Pt(t){var s="Z";return 84>=t&&t>=72?s="X":72>t&&t>=64?s="W":64>t&&t>=56?s="V":56>t&&t>=48?s="U":48>t&&t>=40?s="T":40>t&&t>=32?s="S":32>t&&t>=24?s="R":24>t&&t>=16?s="Q":16>t&&t>=8?s="P":8>t&&t>=0?s="N":0>t&&t>=-8?s="M":-8>t&&t>=-16?s="L":-16>t&&t>=-24?s="K":-24>t&&t>=-32?s="J":-32>t&&t>=-40?s="H":-40>t&&t>=-48?s="G":-48>t&&t>=-56?s="F":-56>t&&t>=-64?s="E":-64>t&&t>=-72?s="D":-72>t&&t>=-80&&(s="C"),s}function Et(t){var s=t%6;return 0===s&&(s=6),s}function kt(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var s,i=t.length,a=null,h="",e=0;!/[A-Z]/.test(s=t.charAt(e));){if(e>=2)throw"MGRSPoint bad conversion from: "+t;h+=s,e++}var n=parseInt(h,10);if(0===e||e+3>i)throw"MGRSPoint bad conversion from: "+t;var r=t.charAt(e++);if(r<="A"||"B"===r||"Y"===r||r>="Z"||"I"===r||"O"===r)throw"MGRSPoint zone letter "+r+" not handled: "+t;a=t.substring(e,e+=2);for(var o=Et(n),l=function(t,s){var i=dt.charCodeAt(s-1),a=1e5,h=!1;for(;i!==t.charCodeAt(0);){if(++i===yt&&i++,i===_t&&i++,i>gt){if(h)throw"Bad character: "+t;i=mt,h=!0}a+=1e5}return a}(a.charAt(0),o),c=function(t,s){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i=pt.charCodeAt(s-1),a=0,h=!1;for(;i!==t.charCodeAt(0);){if(++i===yt&&i++,i===_t&&i++,i>xt){if(h)throw"Bad character: "+t;i=mt,h=!0}a+=1e5}return a}(a.charAt(1),o);c<It(r);)c+=2e6;var u=i-e;if(u%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var M,f,d,p=u/2,m=0,y=0;return p>0&&(M=1e5/Math.pow(10,p),f=t.substring(e,e+p),m=parseFloat(f)*M,d=t.substring(e+p),y=parseFloat(d)*M),{easting:m+l,northing:y+c,zoneLetter:r,zoneNumber:n,accuracy:M}}function It(t){var s;switch(t){case"C":s=11e5;break;case"D":s=2e6;break;case"E":s=28e5;break;case"F":s=37e5;break;case"G":s=46e5;break;case"H":s=55e5;break;case"J":s=64e5;break;case"K":s=73e5;break;case"L":s=82e5;break;case"M":s=91e5;break;case"N":s=0;break;case"P":s=8e5;break;case"Q":s=17e5;break;case"R":s=26e5;break;case"S":s=35e5;break;case"T":s=44e5;break;case"U":s=53e5;break;case"V":s=62e5;break;case"W":s=7e6;break;case"X":s=79e5;break;default:s=-1}if(s>=0)return s;throw"Invalid zone letter: "+t}function At(t,s,i){if(!(this instanceof At))return new At(t,s,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===s){var a=t.split(",");this.x=parseFloat(a[0],10),this.y=parseFloat(a[1],10),this.z=parseFloat(a[2],10)||0}else this.x=t,this.y=s,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}At.fromMGRS=function(t){return new At(wt(t))},At.prototype.toMGRS=function(t){return bt([this.x,this.y],t)};var qt=.046875,Ot=.01953125,jt=.01068115234375;function Gt(t){var s=[];s[0]=1-t*(.25+t*(qt+t*(Ot+t*jt))),s[1]=t*(.75-t*(qt+t*(Ot+t*jt)));var i=t*t;return s[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,s[3]=i*(.3645833333333333-.005696614583333333*t),s[4]=i*t*.3076171875,s}function Lt(t,s,i,a){return i*=s,s*=s,a[0]*t-i*(a[1]+s*(a[2]+s*(a[3]+s*a[4])))}function zt(t,s,i){for(var a=1/(1-s),h=t,n=20;n;--n){var r=Math.sin(h),o=1-s*r*r;if(h-=o=(Lt(h,r,Math.cos(h),i)-t)*(o*Math.sqrt(o))*a,Math.abs(o)<e)return h}return h}var Rt={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=Gt(this.es),this.ml0=Lt(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var s,i,a,h=t.x,n=t.y,r=O(h-this.long0),o=Math.sin(n),l=Math.cos(n);if(this.es){var c=l*r,u=Math.pow(c,2),M=this.ep2*Math.pow(l,2),f=Math.pow(M,2),d=Math.abs(l)>e?Math.tan(n):0,p=Math.pow(d,2),m=Math.pow(p,2);s=1-this.es*Math.pow(o,2),c/=Math.sqrt(s);var y=Lt(n,o,l,this.en);i=this.a*(this.k0*c*(1+u/6*(1-p+M+u/20*(5-18*p+m+14*M-58*p*M+u/42*(61+179*m-m*p-479*p)))))+this.x0,a=this.a*(this.k0*(y-this.ml0+o*r*c/2*(1+u/12*(5-p+9*M+4*f+u/30*(61+m-58*p+270*M-330*p*M+u/56*(1385+543*m-m*p-3111*p))))))+this.y0}else{var _=l*Math.sin(r);if(Math.abs(Math.abs(_)-1)<e)return 93;if(i=.5*this.a*this.k0*Math.log((1+_)/(1-_))+this.x0,a=l*Math.cos(r)/Math.sqrt(1-Math.pow(_,2)),(_=Math.abs(a))>=1){if(_-1>e)return 93;a=0}else a=Math.acos(a);n<0&&(a=-a),a=this.a*this.k0*(a-this.lat0)+this.y0}return t.x=i,t.y=a,t},inverse:function(t){var s,i,a,n,r=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(i=zt(s=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)<h){var l=Math.sin(i),c=Math.cos(i),u=Math.abs(c)>e?Math.tan(i):0,M=this.ep2*Math.pow(c,2),f=Math.pow(M,2),d=Math.pow(u,2),p=Math.pow(d,2);s=1-this.es*Math.pow(l,2);var m=r*Math.sqrt(s)/this.k0,y=Math.pow(m,2);a=i-(s*=u)*y/(1-this.es)*.5*(1-y/12*(5+3*d-9*M*d+M-4*f-y/30*(61+90*d-252*M*d+45*p+46*M-y/56*(1385+3633*d+4095*p+1574*p*d)))),n=O(this.long0+m*(1-y/6*(1+2*d+M-y/20*(5+28*d+24*p+8*M*d+6*M-y/42*(61+662*d+1320*p+720*p*d))))/c)}else a=h*q(o),n=0;else{var _=Math.exp(r/this.k0),x=.5*(_-1/_),g=this.lat0+o/this.k0,v=Math.cos(g);s=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(x,2))),a=Math.asin(s),o<0&&(a=-a),n=0===x&&0===v?0:O(Math.atan2(x,v)+this.long0)}return t.x=n,t.y=a,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function Tt(t){var s=Math.exp(t);return s=(s-1/s)/2}function Bt(t,s){t=Math.abs(t),s=Math.abs(s);var i=Math.max(t,s),a=Math.min(t,s)/(i||1);return i*Math.sqrt(1+Math.pow(a,2))}function Dt(t){var s=Math.abs(t);return s=function(t){var s=1+t,i=s-1;return 0===i?t:t*Math.log(s)/i}(s*(1+s/(Bt(1,s)+1))),t<0?-s:s}function Ft(t,s){for(var i,a=2*Math.cos(2*s),h=t.length-1,e=t[h],n=0;--h>=0;)i=a*e-n+t[h],n=e,e=i;return s+i*Math.sin(2*s)}function Ut(t,s,i){for(var a,h,e=Math.sin(s),n=Math.cos(s),r=Tt(i),o=function(t){var s=Math.exp(t);return(s+1/s)/2}(i),l=2*n*o,c=-2*e*r,u=t.length-1,M=t[u],f=0,d=0,p=0;--u>=0;)a=d,h=f,M=l*(d=M)-a-c*(f=p)+t[u],p=c*d-h+l*f;return[(l=e*o)*M-(c=n*r)*p,l*p+c*M]}var Qt={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Rt.init.apply(this),this.forward=Rt.forward,this.inverse=Rt.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),s=t/(2-t),i=s;this.cgb[0]=s*(2+s*(-2/3+s*(s*(116/45+s*(26/45+s*(-2854/675)))-2))),this.cbg[0]=s*(s*(2/3+s*(4/3+s*(-82/45+s*(32/45+s*(4642/4725)))))-2),i*=s,this.cgb[1]=i*(7/3+s*(s*(-227/45+s*(2704/315+s*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+s*(-16/15+s*(-13/9+s*(904/315+s*(-1522/945))))),i*=s,this.cgb[2]=i*(56/15+s*(-136/35+s*(-1262/105+s*(73814/2835)))),this.cbg[2]=i*(-26/15+s*(34/21+s*(1.6+s*(-12686/2835)))),i*=s,this.cgb[3]=i*(4279/630+s*(-332/35+s*(-399572/14175))),this.cbg[3]=i*(1237/630+s*(s*(-24832/14175)-2.4)),i*=s,this.cgb[4]=i*(4174/315+s*(-144838/6237)),this.cbg[4]=i*(-734/315+s*(109598/31185)),i*=s,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(s,2),this.Qn=this.k0/(1+s)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=s*(s*(2/3+s*(-37/96+s*(1/360+s*(81/512+s*(-96199/604800)))))-.5),this.gtu[0]=s*(.5+s*(-2/3+s*(5/16+s*(41/180+s*(-127/288+s*(7891/37800)))))),this.utg[1]=i*(-1/48+s*(-1/15+s*(437/1440+s*(-46/105+s*(1118711/3870720))))),this.gtu[1]=i*(13/48+s*(s*(557/1440+s*(281/630+s*(-1983433/1935360)))-.6)),i*=s,this.utg[2]=i*(-17/480+s*(37/840+s*(209/4480+s*(-5569/90720)))),this.gtu[2]=i*(61/240+s*(-103/140+s*(15061/26880+s*(167603/181440)))),i*=s,this.utg[3]=i*(-4397/161280+s*(11/504+s*(830251/7257600))),this.gtu[3]=i*(49561/161280+s*(-179/168+s*(6601661/7257600))),i*=s,this.utg[4]=i*(-4583/161280+s*(108847/3991680)),this.gtu[4]=i*(34729/80640+s*(-3418889/1995840)),i*=s,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var a=Ft(this.cbg,this.lat0);this.Zb=-this.Qn*(a+function(t,s){for(var i,a=2*Math.cos(s),h=t.length-1,e=t[h],n=0;--h>=0;)i=a*e-n+t[h],n=e,e=i;return Math.sin(s)*i}(this.gtu,2*a))},forward:function(t){var s=O(t.x-this.long0),i=t.y;i=Ft(this.cbg,i);var a=Math.sin(i),h=Math.cos(i),e=Math.sin(s),n=Math.cos(s);i=Math.atan2(a,n*h),s=Math.atan2(e*h,Bt(a,h*n)),s=Dt(Math.tan(s));var r,o,l=Ut(this.gtu,2*i,2*s);return i+=l[0],s+=l[1],Math.abs(s)<=2.623395162778?(r=this.a*(this.Qn*s)+this.x0,o=this.a*(this.Qn*i+this.Zb)+this.y0):(r=1/0,o=1/0),t.x=r,t.y=o,t},inverse:function(t){var s,i,a=(t.x-this.x0)*(1/this.a),h=(t.y-this.y0)*(1/this.a);if(h=(h-this.Zb)/this.Qn,a/=this.Qn,Math.abs(a)<=2.623395162778){var e=Ut(this.utg,2*h,2*a);h+=e[0],a+=e[1],a=Math.atan(Tt(a));var n=Math.sin(h),r=Math.cos(h),o=Math.sin(a),l=Math.cos(a);h=Math.atan2(n*l,Bt(o,l*r)),s=O((a=Math.atan2(o,l*r))+this.long0),i=Ft(this.cgb,h)}else s=1/0,i=1/0;return t.x=s,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"]};var Wt={init:function(){var t=function(t,s){if(void 0===t){if((t=Math.floor(30*(O(s)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*n,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Qt.init.apply(this),this.forward=Qt.forward,this.inverse=Qt.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function Xt(t,s){return Math.pow((1-t)/(1+t),s)}var Ht={init:function(){var t=Math.sin(this.lat0),s=Math.cos(this.lat0);s*=s,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*s*s/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+o)/(Math.pow(Math.tan(.5*this.lat0+o),this.C)*Xt(this.e*t,this.ratexp))},forward:function(t){var s=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+o),this.C)*Xt(this.e*Math.sin(i),this.ratexp))-h,t.x=this.C*s,t},inverse:function(t){for(var s=t.x/this.C,i=t.y,a=Math.pow(Math.tan(.5*i+o)/this.K,1/this.C),e=20;e>0&&(i=2*Math.atan(a*Xt(this.e*Math.sin(t.y),-.5*this.e))-h,!(Math.abs(i-t.y)<1e-14));--e)t.y=i;return e?(t.x=s,t.y=i,t):null},names:["gauss"]};var Jt={init:function(){Ht.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var s,i,a,h;return t.x=O(t.x-this.long0),Ht.forward.apply(this,[t]),s=Math.sin(t.y),i=Math.cos(t.y),a=Math.cos(t.x),h=this.k0*this.R2/(1+this.sinc0*s+this.cosc0*i*a),t.x=h*i*Math.sin(t.x),t.y=h*(this.cosc0*s-this.sinc0*i*a),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var s,i,a,h,e;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,e=Math.sqrt(t.x*t.x+t.y*t.y)){var n=2*Math.atan2(e,this.R2);s=Math.sin(n),i=Math.cos(n),h=Math.asin(i*this.sinc0+t.y*s*this.cosc0/e),a=Math.atan2(t.x*s,e*this.cosc0*i-t.y*this.sinc0*s)}else h=this.phic0,a=0;return t.x=a,t.y=h,Ht.inverse.apply(this,[t]),t.x=O(t.x+this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};var Kt={init:function(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=e&&(this.k0=.5*(1+q(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=e&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=e&&(this.k0=.5*this.cons*A(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/j(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=A(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-h,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var s,i,a,n,r,o,l=t.x,c=t.y,u=Math.sin(c),M=Math.cos(c),f=O(l-this.long0);return Math.abs(Math.abs(l-this.long0)-Math.PI)<=e&&Math.abs(c+this.lat0)<=e?(t.x=NaN,t.y=NaN,t):this.sphere?(s=2*this.k0/(1+this.sinlat0*u+this.coslat0*M*Math.cos(f)),t.x=this.a*s*M*Math.sin(f)+this.x0,t.y=this.a*s*(this.coslat0*u-this.sinlat0*M*Math.cos(f))+this.y0,t):(i=2*Math.atan(this.ssfn_(c,u,this.e))-h,n=Math.cos(i),a=Math.sin(i),Math.abs(this.coslat0)<=e?(r=j(this.e,c*this.con,this.con*u),o=2*this.a*this.k0*r/this.cons,t.x=this.x0+o*Math.sin(l-this.long0),t.y=this.y0-this.con*o*Math.cos(l-this.long0),t):(Math.abs(this.sinlat0)<e?(s=2*this.a*this.k0/(1+n*Math.cos(f)),t.y=s*a):(s=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*n*Math.cos(f))),t.y=s*(this.cosX0*a-this.sinX0*n*Math.cos(f))+this.y0),t.x=s*n*Math.sin(f)+this.x0,t))},inverse:function(t){var s,i,a,n,r;t.x-=this.x0,t.y-=this.y0;var o=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var l=2*Math.atan(o/(2*this.a*this.k0));return s=this.long0,i=this.lat0,o<=e?(t.x=s,t.y=i,t):(i=Math.asin(Math.cos(l)*this.sinlat0+t.y*Math.sin(l)*this.coslat0/o),s=Math.abs(this.coslat0)<e?this.lat0>0?O(this.long0+Math.atan2(t.x,-1*t.y)):O(this.long0+Math.atan2(t.x,t.y)):O(this.long0+Math.atan2(t.x*Math.sin(l),o*this.coslat0*Math.cos(l)-t.y*this.sinlat0*Math.sin(l))),t.x=s,t.y=i,t)}if(Math.abs(this.coslat0)<=e){if(o<=e)return i=this.lat0,s=this.long0,t.x=s,t.y=i,t;t.x*=this.con,t.y*=this.con,a=o*this.cons/(2*this.a*this.k0),i=this.con*G(this.e,a),s=this.con*O(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else n=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),s=this.long0,o<=e?r=this.X0:(r=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/o),s=O(this.long0+Math.atan2(t.x*Math.sin(n),o*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)))),i=-1*G(this.e,Math.tan(.5*(h+r)));return t.x=s,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],ssfn_:function(t,s,i){return s*=i,Math.tan(.5*(h+t))*Math.pow((1-s)/(1+s),.5*i)}};var Vt={init:function(){var t=this.lat0;this.lambda0=this.long0;var s=Math.sin(t),i=this.a,a=1/this.rf,h=2*a-Math.pow(a,2),e=this.e=Math.sqrt(h);this.R=this.k0*i*Math.sqrt(1-h)/(1-h*Math.pow(s,2)),this.alpha=Math.sqrt(1+h/(1-h)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(s/this.alpha);var n=Math.log(Math.tan(Math.PI/4+this.b0/2)),r=Math.log(Math.tan(Math.PI/4+t/2)),o=Math.log((1+e*s)/(1-e*s));this.K=n-this.alpha*r+this.alpha*e/2*o},forward:function(t){var s=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),a=-this.alpha*(s+i)+this.K,h=2*(Math.atan(Math.exp(a))-Math.PI/4),e=this.alpha*(t.x-this.lambda0),n=Math.atan(Math.sin(e)/(Math.sin(this.b0)*Math.tan(h)+Math.cos(this.b0)*Math.cos(e))),r=Math.asin(Math.cos(this.b0)*Math.sin(h)-Math.sin(this.b0)*Math.cos(h)*Math.cos(e));return t.y=this.R/2*Math.log((1+Math.sin(r))/(1-Math.sin(r)))+this.y0,t.x=this.R*n+this.x0,t},inverse:function(t){for(var s=t.x-this.x0,i=t.y-this.y0,a=s/this.R,h=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),e=Math.asin(Math.cos(this.b0)*Math.sin(h)+Math.sin(this.b0)*Math.cos(h)*Math.cos(a)),n=Math.atan(Math.sin(a)/(Math.cos(this.b0)*Math.cos(a)-Math.sin(this.b0)*Math.tan(h))),r=this.lambda0+n/this.alpha,o=0,l=e,c=-1e3,u=0;Math.abs(l-c)>1e-7;){if(++u>20)return;o=1/this.alpha*(Math.log(Math.tan(Math.PI/4+e/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(o))-Math.PI/2}return t.x=r,t.y=l,t},names:["somerc"]},Zt=1e-7;var Yt={init:function(){var t,s,i,a,r,c,u,M,f,d,p,m,y,_=0,x=0,g=0,v=0,b=0,w=0,N=0;this.no_off=(y="object"==typeof(m=this).PROJECTION?Object.keys(m.PROJECTION)[0]:m.PROJECTION,"no_uoff"in m||"no_off"in m||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(y)),this.no_rot="no_rot"in this;var C=!1;"alpha"in this&&(C=!0);var S=!1;if("rectified_grid_angle"in this&&(S=!0),C&&(N=this.alpha),S&&(_=this.rectified_grid_angle*n),C||S)x=this.longc;else if(g=this.long1,b=this.lat1,v=this.long2,w=this.lat2,Math.abs(b-w)<=Zt||(t=Math.abs(b))<=Zt||Math.abs(t-h)<=Zt||Math.abs(Math.abs(this.lat0)-h)<=Zt||Math.abs(Math.abs(w)-h)<=Zt)throw new Error;var P=1-this.es;s=Math.sqrt(P),Math.abs(this.lat0)>e?(M=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*M*M,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/P),this.A=this.B*this.k0*s/t,(r=(a=this.B*s/(i*Math.sqrt(t)))*a-1)<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=a,this.E*=Math.pow(j(this.e,this.lat0,M),this.B)):(this.B=1/s,this.A=this.k0,this.E=a=r=1),C||S?(C?(p=Math.asin(Math.sin(N)/a),S||(_=N)):(p=_,N=Math.asin(a*Math.sin(p))),this.lam0=x-Math.asin(.5*(r-1/r)*Math.tan(p))/this.B):(c=Math.pow(j(this.e,b,Math.sin(b)),this.B),u=Math.pow(j(this.e,w,Math.sin(w)),this.B),r=this.E/c,f=(u-c)/(u+c),d=((d=this.E*this.E)-u*c)/(d+u*c),(t=g-v)<-Math.pi?v-=l:t>Math.pi&&(v+=l),this.lam0=O(.5*(g+v)-Math.atan(d*Math.tan(.5*this.B*(g-v))/f)/this.B),p=Math.atan(2*Math.sin(this.B*O(g-this.lam0))/(r-1/r)),_=N=Math.asin(a*Math.sin(p))),this.singam=Math.sin(p),this.cosgam=Math.cos(p),this.sinrot=Math.sin(_),this.cosrot=Math.cos(_),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.A,this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(a*a-1)/Math.cos(N))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*p,this.v_pole_n=this.ArB*Math.log(Math.tan(o-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(o+r))},forward:function(t){var s,i,a,n,r,o,l,c,u={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-h)>e){if(s=.5*((r=this.E/Math.pow(j(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/r)),i=.5*(r+o),n=Math.sin(this.B*t.x),a=(s*this.singam-n*this.cosgam)/i,Math.abs(Math.abs(a)-1)<e)throw new Error;c=.5*this.ArB*Math.log((1-a)/(1+a)),o=Math.cos(this.B*t.x),l=Math.abs(o)<Zt?this.A*t.x:this.ArB*Math.atan2(s*this.cosgam+n*this.singam,o)}else c=t.y>0?this.v_pole_n:this.v_pole_s,l=this.ArB*t.y;return this.no_rot?(u.x=l,u.y=c):(l-=this.u_0,u.x=c*this.cosrot+l*this.sinrot,u.y=l*this.cosrot-c*this.sinrot),u.x=this.a*u.x+this.x0,u.y=this.a*u.y+this.y0,u},inverse:function(t){var s,i,a,n,r,o,l,c={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,s=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,s=t.y*this.cosrot+t.x*this.sinrot+this.u_0),n=.5*((a=Math.exp(-this.BrA*i))-1/a),r=.5*(a+1/a),l=((o=Math.sin(this.BrA*s))*this.cosgam+n*this.singam)/r,Math.abs(Math.abs(l)-1)<e)c.x=0,c.y=l<0?-h:h;else{if(c.y=this.E/Math.sqrt((1+l)/(1-l)),c.y=G(this.e,Math.pow(c.y,1/this.B)),c.y===1/0)throw new Error;c.x=-this.rB*Math.atan2(n*this.cosgam-o*this.singam,Math.cos(this.BrA*s))}return c.x+=this.lam0,c},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"]};var $t={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<e)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var s=Math.sin(this.lat1),i=Math.cos(this.lat1),a=A(this.e,s,i),h=j(this.e,this.lat1,s),n=Math.sin(this.lat2),r=Math.cos(this.lat2),o=A(this.e,n,r),l=j(this.e,this.lat2,n),c=j(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>e?this.ns=Math.log(a/o)/Math.log(h/l):this.ns=s,isNaN(this.ns)&&(this.ns=s),this.f0=a/(this.ns*Math.pow(h,this.ns)),this.rh=this.a*this.f0*Math.pow(c,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var s=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=e&&(i=q(i)*(h-2e-10));var a,n,r=Math.abs(Math.abs(i)-h);if(r>e)a=j(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(a,this.ns);else{if((r=i*this.ns)<=0)return null;n=0}var o=this.ns*O(s-this.long0);return t.x=this.k0*(n*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,t},inverse:function(t){var s,i,a,e,n,r=(t.x-this.x0)/this.k0,o=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(s=Math.sqrt(r*r+o*o),i=1):(s=-Math.sqrt(r*r+o*o),i=-1);var l=0;if(0!==s&&(l=Math.atan2(i*r,i*o)),0!==s||this.ns>0){if(i=1/this.ns,a=Math.pow(s/(this.a*this.f0),i),-9999===(e=G(this.e,a)))return null}else e=-h;return n=O(l/this.ns+this.long0),t.x=n,t.y=e,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Confor