@loaders.gl/shapefile
Version:
Loader for the Shapefile Format
10 lines • 98.1 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if (typeof define === 'function' && define.amd) define([], factory);
else if (typeof exports === 'object') exports['loaders'] = factory();
else root['loaders'] = factory();})(globalThis, function () {
"use strict";var __exports__=(()=>{var Cs=Object.create;var kt=Object.defineProperty;var Ls=Object.getOwnPropertyDescriptor;var Ts=Object.getOwnPropertyNames;var Ds=Object.getPrototypeOf,Os=Object.prototype.hasOwnProperty;var Bs=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Gs=(t,e)=>{for(var a in e)kt(t,a,{get:e[a],enumerable:!0})},jt=(t,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ts(e))!Os.call(t,s)&&s!==a&&kt(t,s,{get:()=>e[s],enumerable:!(i=Ls(e,s))||i.enumerable});return t},Ht=(t,e,a)=>(jt(t,e,"default"),a&&jt(a,e,"default")),Fs=(t,e,a)=>(a=t!=null?Cs(Ds(t)):{},jt(e||!t||!t.__esModule?kt(a,"default",{value:t,enumerable:!0}):a,t)),qs=t=>jt(kt({},"__esModule",{value:!0}),t);var qe=Bs((Ah,Fe)=>{Fe.exports=globalThis.loaders});var qt={};Gs(qt,{DBFLoader:()=>Gt,DBFWorkerLoader:()=>Ge,SHPLoader:()=>Nt,SHPWorkerLoader:()=>ge,ShapefileLoader:()=>Rs,_BinaryChunkReader:()=>ot,_BinaryReader:()=>de,_zipBatchIterators:()=>ce});Ht(qt,Fs(qe(),1));var ot=class{offset;arrayBuffers;ended;maxRewindBytes;constructor(e){let{maxRewindBytes:a=0}=e||{};this.offset=0,this.arrayBuffers=[],this.ended=!1,this.maxRewindBytes=a}write(e){this.arrayBuffers.push(e)}end(){this.arrayBuffers=[],this.ended=!0}hasAvailableBytes(e){let a=-this.offset;for(let i of this.arrayBuffers)if(a+=i.byteLength,a>=e)return!0;return!1}findBufferOffsets(e){let a=-this.offset,i=[];for(let s=0;s<this.arrayBuffers.length;s++){let r=this.arrayBuffers[s];if(a+r.byteLength<=0){a+=r.byteLength;continue}let n=a<=0?Math.abs(a):0,h;if(n+e<=r.byteLength)return h=n+e,i.push([s,[n,h]]),i;h=r.byteLength,i.push([s,[n,h]]),e-=r.byteLength-n,a+=r.byteLength}return null}getDataView(e){let a=this.findBufferOffsets(e);if(!a&&this.ended)throw new Error("binary data exhausted");if(!a)return null;if(a.length===1){let[s,[r,n]]=a[0],h=this.arrayBuffers[s],o=new DataView(h,r,n-r);return this.offset+=e,this.disposeBuffers(),o}let i=new DataView(this._combineArrayBuffers(a));return this.offset+=e,this.disposeBuffers(),i}disposeBuffers(){for(;this.arrayBuffers.length>0&&this.offset-this.maxRewindBytes>=this.arrayBuffers[0].byteLength;)this.offset-=this.arrayBuffers[0].byteLength,this.arrayBuffers.shift()}_combineArrayBuffers(e){let a=0;for(let r of e){let[n,h]=r[1];a+=h-n}let i=new Uint8Array(a),s=0;for(let r of e){let[n,[h,o]]=r,l=new Uint8Array(this.arrayBuffers[n]);i.set(l.subarray(h,o),s),s+=o-h}return i.buffer}skip(e){this.offset+=e}rewind(e){this.offset-=e}};function Ut(t){let e={magic:t.getInt32(0,!1),length:t.getInt32(24,!1)*2,version:t.getInt32(28,!0),type:t.getInt32(32,!0),bbox:{minX:t.getFloat64(36,!0),minY:t.getFloat64(44,!0),minZ:t.getFloat64(68,!0),minM:t.getFloat64(84,!0),maxX:t.getFloat64(52,!0),maxY:t.getFloat64(60,!0),maxZ:t.getFloat64(76,!0),maxM:t.getFloat64(92,!0)}};return e.magic!==9994&&console.error(`SHP file: bad magic number ${e.magic}`),e.version!==1e3&&console.error(`SHP file: bad version ${e.version}`),e}function ze(t,e){let{_maxDimensions:a=4}=e?.shp||{},i=0,s=t.getInt32(i,!0);switch(i+=Int32Array.BYTES_PER_ELEMENT,s){case 0:return zs();case 1:return pe(t,i,Math.min(2,a));case 3:return yt(t,i,Math.min(2,a),"LineString");case 5:return yt(t,i,Math.min(2,a),"Polygon");case 8:return ve(t,i,Math.min(2,a));case 11:return pe(t,i,Math.min(4,a));case 13:return yt(t,i,Math.min(4,a),"LineString");case 15:return yt(t,i,Math.min(4,a),"Polygon");case 18:return ve(t,i,Math.min(4,a));case 21:return pe(t,i,Math.min(3,a));case 23:return yt(t,i,Math.min(3,a),"LineString");case 25:return yt(t,i,Math.min(3,a),"Polygon");case 28:return ve(t,i,Math.min(3,a));default:throw new Error(`unsupported shape type: ${s}`)}}function zs(){return null}function pe(t,e,a){let i;return[i,e]=ct(t,e,1,a),{positions:{value:i,size:a},type:"Point"}}function ve(t,e,a){e+=4*Float64Array.BYTES_PER_ELEMENT;let i=t.getInt32(e,!0);e+=Int32Array.BYTES_PER_ELEMENT;let s=null,r=null,n=null;return[s,e]=ct(t,e,i,2),a===4&&(e+=2*Float64Array.BYTES_PER_ELEMENT,[n,e]=ct(t,e,i,1)),a>=3&&(e+=2*Float64Array.BYTES_PER_ELEMENT,[r,e]=ct(t,e,i,1)),{positions:{value:je(s,r,n),size:a},type:"Point"}}function yt(t,e,a,i){e+=4*Float64Array.BYTES_PER_ELEMENT;let s=t.getInt32(e,!0);e+=Int32Array.BYTES_PER_ELEMENT;let r=t.getInt32(e,!0);e+=Int32Array.BYTES_PER_ELEMENT;let n=t.byteOffset+e,h=s*Int32Array.BYTES_PER_ELEMENT,o=new Int32Array(s+1);o.set(new Int32Array(t.buffer.slice(n,n+h))),o[s]=r,e+=s*Int32Array.BYTES_PER_ELEMENT;let l=null,u=null,f=null;[l,e]=ct(t,e,r,2),a===4&&(e+=2*Float64Array.BYTES_PER_ELEMENT,[f,e]=ct(t,e,r,1)),a>=3&&(e+=2*Float64Array.BYTES_PER_ELEMENT,[u,e]=ct(t,e,r,1));let c=je(l,u,f);if(i==="LineString")return{type:i,positions:{value:c,size:a},pathIndices:{value:o,size:1}};let M=[];for(let d=1;d<o.length;d++){let y=o[d-1],x=o[d],g=l.subarray(y*2,x*2);js(g)>0&&M.push(y)}return M.push(r),{type:i,positions:{value:c,size:a},primitivePolygonIndices:{value:o,size:1},polygonIndices:{value:new Uint32Array(M),size:1}}}function ct(t,e,a,i){let s=t.byteOffset+e,r=a*i*Float64Array.BYTES_PER_ELEMENT;return[new Float64Array(t.buffer.slice(s,s+r)),e+r]}function je(t,e,a){if(!(e||a))return t;let i=t.length,s=2;a&&a.length&&(i+=a.length,s++),e&&e.length&&(i+=e.length,s++);let r=new Float64Array(i);for(let n=0;n<t.length/2;n++)r[s*n]=t[n*2],r[s*n+1]=t[n*2+1];if(a&&a.length)for(let n=0;n<a.length;n++)r[s*n+2]=a[n];if(e&&e.length)for(let n=0;n<e.length;n++)r[s*n+(s-1)]=e[n];return r}function js(t){return Math.sign(ks(t))}function ks(t){let e=0,a=t.length/2-1;for(let i=0;i<a;i++)e+=(t[i*2]+t[(i+1)*2])*(t[i*2+1]-t[(i+1)*2+1]);return e/2}var Hs=!0,ke=!1,Us=100,Pt=12,J={EXPECTING_HEADER:0,EXPECTING_RECORD:1,END:2,ERROR:3},Wt=class{options={};binaryReader=new ot({maxRewindBytes:Pt});state=J.EXPECTING_HEADER;result={geometries:[],progress:{bytesTotal:NaN,bytesUsed:NaN,rows:NaN},currentIndex:NaN};constructor(e){this.options=e}write(e){this.binaryReader.write(e),this.state=He(this.state,this.result,this.binaryReader,this.options)}end(){this.binaryReader.end(),this.state=He(this.state,this.result,this.binaryReader,this.options),this.state!==J.END&&(this.state=J.ERROR,this.result.error="SHP incomplete file")}};function ye(t,e){let a=new Wt(e);return a.write(t),a.end(),a.result}async function*Ue(t,e){let a=new Wt(e),i=!1;for await(let s of t)a.write(s),!i&&a.result.header&&(i=!0,yield a.result.header),a.result.geometries.length>0&&(yield a.result.geometries,a.result.geometries=[]);a.end(),a.result.geometries.length>0&&(yield a.result.geometries)}function He(t,e,a,i){for(;;)try{switch(t){case J.ERROR:case J.END:return t;case J.EXPECTING_HEADER:let s=a.getDataView(Us);if(!s)return t;e.header=Ut(s),e.progress={bytesUsed:0,bytesTotal:e.header.length,rows:0},e.currentIndex=1,t=J.EXPECTING_RECORD;break;case J.EXPECTING_RECORD:for(;a.hasAvailableBytes(Pt);){let r=a.getDataView(Pt),n={recordNumber:r.getInt32(0,ke),byteLength:r.getInt32(4,ke)*2,type:r.getInt32(8,Hs)};if(!a.hasAvailableBytes(n.byteLength-4))return a.rewind(Pt),t;if(n.byteLength<4||n.type!==e.header?.type||n.recordNumber!==e.currentIndex)a.rewind(Pt-4);else{a.rewind(4);let o=a.getDataView(n.byteLength),l=ze(o,i);e.geometries.push(l),e.currentIndex++,e.progress.rows=e.currentIndex-1}}return a.ended&&(t=J.END),t;default:return t=J.ERROR,e.error=`illegal parser state ${t}`,t}}catch(s){return t=J.ERROR,e.error=`SHP parsing failed: ${s?.message}`,t}}var Ws="4.3.3",xe=[0,0,39,10],ge={dataType:null,batchType:null,name:"SHP",id:"shp",module:"shapefile",version:Ws,worker:!0,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(xe).buffer],options:{shp:{_maxDimensions:4}}},Nt={...ge,parse:async(t,e)=>ye(t,e),parseSync:ye,parseInBatches:(t,e)=>Ue(t,e)};async function Jt(t,e,a,i){return i._parse(t,e,a,i)}async function Xt(t,e,a,i){if(!i._parseInBatches)throw new Error("parseInBatches");return i._parseInBatches(t,e,a,i)}function _e(t,e,a){switch(t.type){case"Point":return Xs(t,e,a);case"LineString":return Js(t,e,a);case"Polygon":return We(t,e,a);default:let i=t;throw new Error(`Unsupported geometry type: ${i?.type}`)}}function We(t,e=-1/0,a=1/0){let{positions:i}=t,s=t.polygonIndices.value.filter(o=>o>=e&&o<=a),r=t.primitivePolygonIndices.value.filter(o=>o>=e&&o<=a);if(!(s.length>2)){let o=[];for(let l=0;l<r.length-1;l++){let u=r[l],f=r[l+1],c=Qt(i,u,f);o.push(c)}return{type:"Polygon",coordinates:o}}let h=[];for(let o=0;o<s.length-1;o++){let l=s[o],u=s[o+1],f=We(t,l,u).coordinates;h.push(f)}return{type:"MultiPolygon",coordinates:h}}function Js(t,e=-1/0,a=1/0){let{positions:i}=t,s=t.pathIndices.value.filter(h=>h>=e&&h<=a);if(!(s.length>2))return{type:"LineString",coordinates:Qt(i,s[0],s[1])};let n=[];for(let h=0;h<s.length-1;h++){let o=Qt(i,s[h],s[h+1]);n.push(o)}return{type:"MultiLineString",coordinates:n}}function Xs(t,e,a){let{positions:i}=t,s=Qt(i,e,a);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Qt(t,e,a){e=e||0,a=a||t.value.length/t.size;let i=[];for(let s=e;s<a;s++){let r=Array();for(let n=s*t.size;n<(s+1)*t.size;n++)r.push(Number(t.value[n]));i.push(r)}return i}function be(t,e){for(let a of t)a.geometry.coordinates=Je(a.geometry.coordinates,e);return t}function Je(t,e){return Qs(t)?e(t):t.map(a=>Je(a,e))}function Qs(t){return Array.isArray(t)&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function Xe(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"]}var X=1,Q=2,Qe=4,St=5,mt=484813681109536e-20,m=Math.PI/2,Ve=.16666666666666666,Ke=.04722222222222222,Ye=.022156084656084655,p=1e-10,L=.017453292519943295,V=57.29577951308232,I=Math.PI/4,Rt=Math.PI*2,R=3.14159265359;var G={};G.greenwich=0;G.lisbon=-9.131906111111;G.paris=2.337229166667;G.bogota=-74.080916666667;G.madrid=-3.687938888889;G.rome=12.452333333333;G.bern=7.439583333333;G.jakarta=106.807719444444;G.ferro=-17.666666666667;G.brussels=4.367975;G.stockholm=18.058277777778;G.athens=23.7163375;G.oslo=10.722916666667;var Ze={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var $e=/[\s_\-\/\(\)]/g;function k(t,e){if(t[e])return t[e];for(var a=Object.keys(t),i=e.toLowerCase().replace($e,""),s=-1,r,n;++s<a.length;)if(r=a[s],n=r.toLowerCase().replace($e,""),n===i)return t[r]}function wt(t){var e={},a=t.split("+").map(function(h){return h.trim()}).filter(function(h){return h}).reduce(function(h,o){var l=o.split("=");return l.push(!0),h[l[0].toLowerCase()]=l[1],h},{}),i,s,r,n={proj:"projName",datum:"datumCode",rf:function(h){e.rf=parseFloat(h)},lat_0:function(h){e.lat0=h*L},lat_1:function(h){e.lat1=h*L},lat_2:function(h){e.lat2=h*L},lat_ts:function(h){e.lat_ts=h*L},lon_0:function(h){e.long0=h*L},lon_1:function(h){e.long1=h*L},lon_2:function(h){e.long2=h*L},alpha:function(h){e.alpha=parseFloat(h)*L},lonc:function(h){e.longc=h*L},x_0:function(h){e.x0=parseFloat(h)},y_0:function(h){e.y0=parseFloat(h)},k_0:function(h){e.k0=parseFloat(h)},k:function(h){e.k0=parseFloat(h)},a:function(h){e.a=parseFloat(h)},b:function(h){e.b=parseFloat(h)},r_a:function(){e.R_A=!0},zone:function(h){e.zone=parseInt(h,10)},south:function(){e.utmSouth=!0},towgs84:function(h){e.datum_params=h.split(",").map(function(o){return parseFloat(o)})},to_meter:function(h){e.to_meter=parseFloat(h)},units:function(h){e.units=h;var o=k(Ze,h);o&&(e.to_meter=o.to_meter)},from_greenwich:function(h){e.from_greenwich=h*L},pm:function(h){var o=k(G,h);e.from_greenwich=(o||parseFloat(h))*L},nadgrids:function(h){h==="@null"?e.datumCode="none":e.nadgrids=h},axis:function(h){var o="ewnsud";h.length===3&&o.indexOf(h.substr(0,1))!==-1&&o.indexOf(h.substr(1,1))!==-1&&o.indexOf(h.substr(2,1))!==-1&&(e.axis=h)}};for(i in a)s=a[i],i in n?(r=n[i],typeof r=="function"?r(s):e[r]=s):e[i]=s;return typeof e.datumCode=="string"&&e.datumCode!=="WGS84"&&(e.datumCode=e.datumCode.toLowerCase()),e}var ta=Zs,Ct=1,ea=2,aa=3,Vt=4,sa=5,Ee=-1,Vs=/\s/,Ks=/[A-Za-z]/,Ys=/[A-Za-z84_]/,Kt=/[,\]]/,ia=/[\d\.E\-\+]/;function et(t){if(typeof t!="string")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=Ct}et.prototype.readCharicter=function(){var t=this.text[this.place++];if(this.state!==Vt)for(;Vs.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case Ct:return this.neutral(t);case ea:return this.keyword(t);case Vt:return this.quoted(t);case sa:return this.afterquote(t);case aa:return this.number(t);case Ee:return}};et.prototype.afterquote=function(t){if(t==='"'){this.word+='"',this.state=Vt;return}if(Kt.test(t)){this.word=this.word.trim(),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in afterquote yet, index '+this.place)};et.prototype.afterItem=function(t){if(t===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Ct;return}if(t==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Ct,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Ee);return}};et.prototype.number=function(t){if(ia.test(t)){this.word+=t;return}if(Kt.test(t)){this.word=parseFloat(this.word),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in number yet, index '+this.place)};et.prototype.quoted=function(t){if(t==='"'){this.state=sa;return}this.word+=t};et.prototype.keyword=function(t){if(Ys.test(t)){this.word+=t;return}if(t==="["){var e=[];e.push(this.word),this.level++,this.root===null?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=Ct;return}if(Kt.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in keyword yet, index '+this.place)};et.prototype.neutral=function(t){if(Ks.test(t)){this.word=t,this.state=ea;return}if(t==='"'){this.word="",this.state=Vt;return}if(ia.test(t)){this.word=t,this.state=aa;return}if(Kt.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in neutral yet, index '+this.place)};et.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Ee)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Zs(t){var e=new et(t);return e.output()}function ra(t,e,a){Array.isArray(e)&&(a.unshift(e),e=null);var i=e?{}:t,s=a.reduce(function(r,n){return Mt(n,r),r},i);e&&(t[e]=s)}function Mt(t,e){if(!Array.isArray(t)){e[t]=!0;return}var a=t.shift();if(a==="PARAMETER"&&(a=t.shift()),t.length===1){if(Array.isArray(t[0])){e[a]={},Mt(t[0],e[a]);return}e[a]=t[0];return}if(!t.length){e[a]=!0;return}if(a==="TOWGS84"){e[a]=t;return}if(a==="AXIS"){a in e||(e[a]=[]),e[a].push(t);return}Array.isArray(a)||(e[a]={});var i;switch(a){case"UNIT":case"PRIMEM":case"VERT_DATUM":e[a]={name:t[0].toLowerCase(),convert:t[1]},t.length===3&&Mt(t[2],e[a]);return;case"SPHEROID":case"ELLIPSOID":e[a]={name:t[0],a:t[1],rf:t[2]},t.length===4&&Mt(t[3],e[a]);return;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":t[0]=["name",t[0]],ra(e,a,t);return;default:for(i=-1;++i<t.length;)if(!Array.isArray(t[i]))return Mt(t,e[a]);return ra(e,a,t)}}var $s=.017453292519943295;function ti(t,e){var a=e[0],i=e[1];!(a in t)&&i in t&&(t[a]=t[i],e.length===3&&(t[a]=e[2](t[a])))}function $(t){return t*$s}function ei(t){if(t.type==="GEOGCS"?t.projName="longlat":t.type==="LOCAL_CS"?(t.projName="identity",t.local=!0):typeof t.PROJECTION=="object"?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var e="",a=0,i=t.AXIS.length;a<i;++a){var s=[t.AXIS[a][0].toLowerCase(),t.AXIS[a][1].toLowerCase()];s[0].indexOf("north")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="north"?e+="n":s[0].indexOf("south")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="south"?e+="s":s[0].indexOf("east")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="east"?e+="e":(s[0].indexOf("west")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="west")&&(e+="w")}e.length===2&&(e+="u"),e.length===3&&(t.axis=e)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.UNIT.convert&&(t.type==="GEOGCS"?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var r=t.GEOGCS;t.type==="GEOGCS"&&(r=t),r&&(r.DATUM?t.datumCode=r.DATUM.name.toLowerCase():t.datumCode=r.name.toLowerCase(),t.datumCode.slice(0,2)==="d_"&&(t.datumCode=t.datumCode.slice(2)),(t.datumCode==="new_zealand_geodetic_datum_1949"||t.datumCode==="new_zealand_1949")&&(t.datumCode="nzgd49"),(t.datumCode==="wgs_1984"||t.datumCode==="world_geodetic_system_1984")&&(t.PROJECTION==="Mercator_Auxiliary_Sphere"&&(t.sphere=!0),t.datumCode="wgs84"),t.datumCode.slice(-6)==="_ferro"&&(t.datumCode=t.datumCode.slice(0,-6)),t.datumCode.slice(-8)==="_jakarta"&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),r.DATUM&&r.DATUM.SPHEROID&&(t.ellps=r.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),t.ellps.toLowerCase().slice(0,13)==="international"&&(t.ellps="intl"),t.a=r.DATUM.SPHEROID.a,t.rf=parseFloat(r.DATUM.SPHEROID.rf,10)),r.DATUM&&r.DATUM.TOWGS84&&(t.datum_params=r.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"),t.datumCode==="ch1903+"&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a);function n(l){var u=t.to_meter||1;return l*u}var h=function(l){return ti(t,l)},o=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",$],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",$],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",$],["lat0","latitude_of_origin",$],["lat0","standard_parallel_1",$],["lat1","standard_parallel_1",$],["lat2","standard_parallel_2",$],["azimuth","Azimuth"],["alpha","azimuth",$],["srsCode","name"]];o.forEach(h),!t.long0&&t.longc&&(t.projName==="Albers_Conic_Equal_Area"||t.projName==="Lambert_Azimuthal_Equal_Area")&&(t.long0=t.longc),!t.lat_ts&&t.lat1&&(t.projName==="Stereographic_South_Pole"||t.projName==="Polar Stereographic (variant B)")?(t.lat0=$(t.lat1>0?90:-90),t.lat_ts=t.lat1):!t.lat_ts&&t.lat0&&t.projName==="Polar_Stereographic"&&(t.lat_ts=t.lat0,t.lat0=$(t.lat0>0?90:-90))}function Yt(t){var e=ta(t),a=e.shift(),i=e.shift();e.unshift(["name",i]),e.unshift(["type",a]);var s={};return Mt(e,s),ei(s),s}function U(t){var e=this;if(arguments.length===2){var a=arguments[1];typeof a=="string"?a.charAt(0)==="+"?U[t]=wt(arguments[1]):U[t]=Yt(arguments[1]):U[t]=a}else if(arguments.length===1){if(Array.isArray(t))return t.map(function(i){Array.isArray(i)?U.apply(e,i):U(i)});if(typeof t=="string"){if(t in U)return U[t]}else"EPSG"in t?U["EPSG:"+t.EPSG]=t:"ESRI"in t?U["ESRI:"+t.ESRI]=t:"IAU2000"in t?U["IAU2000:"+t.IAU2000]=t:console.log(t);return}}Xe(U);var xt=U;function ai(t){return typeof t=="string"}function si(t){return t in xt}var ii=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function ri(t){return ii.some(function(e){return t.indexOf(e)>-1})}var ni=["3857","900913","3785","102113"];function hi(t){var e=k(t,"authority");if(e){var a=k(e,"epsg");return a&&ni.indexOf(a)>-1}}function oi(t){var e=k(t,"extension");if(e)return k(e,"proj4")}function li(t){return t[0]==="+"}function fi(t){if(ai(t)){if(si(t))return xt[t];if(ri(t)){var e=Yt(t);if(hi(e))return xt["EPSG:3857"];var a=oi(e);return a?wt(a):e}if(li(t))return wt(t)}else return t}var na=fi;function Ie(t,e){t=t||{};var a,i;if(!e)return t;for(i in e)a=e[i],a!==void 0&&(t[i]=a);return t}function B(t,e,a){var i=t*e;return a/Math.sqrt(1-i*i)}function tt(t){return t<0?-1:1}function v(t){return Math.abs(t)<=R?t:t-tt(t)*Rt}function F(t,e,a){var i=t*a,s=.5*t;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(m-e))/i}function at(t,e){for(var a=.5*t,i,s,r=m-2*Math.atan(e),n=0;n<=15;n++)if(i=t*Math.sin(r),s=m-2*Math.atan(e*Math.pow((1-i)/(1+i),a))-r,r+=s,Math.abs(s)<=1e-10)return r;return-9999}function ui(){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=B(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function ci(t){var e=t.x,a=t.y;if(a*V>90&&a*V<-90&&e*V>180&&e*V<-180)return null;var i,s;if(Math.abs(Math.abs(a)-m)<=p)return null;if(this.sphere)i=this.x0+this.a*this.k0*v(e-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(I+.5*a));else{var r=Math.sin(a),n=F(this.e,a,r);i=this.x0+this.a*this.k0*v(e-this.long0),s=this.y0-this.a*this.k0*Math.log(n)}return t.x=i,t.y=s,t}function mi(t){var e=t.x-this.x0,a=t.y-this.y0,i,s;if(this.sphere)s=m-2*Math.atan(Math.exp(-a/(this.a*this.k0)));else{var r=Math.exp(-a/(this.a*this.k0));if(s=at(this.e,r),s===-9999)return null}return i=v(this.long0+e/(this.a*this.k0)),t.x=i,t.y=s,t}var Mi=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],ha={init:ui,forward:ci,inverse:mi,names:Mi};function di(){}function oa(t){return t}var pi=["longlat","identity"],la={init:di,forward:oa,inverse:oa,names:pi};var vi=[ha,la],Zt={},$t=[];function fa(t,e){var a=$t.length;return t.names?($t[a]=t,t.names.forEach(function(i){Zt[i.toLowerCase()]=a}),this):(console.log(e),!0)}function yi(t){if(!t)return!1;var e=t.toLowerCase();if(typeof Zt[e]<"u"&&$t[Zt[e]])return $t[Zt[e]]}function xi(){vi.forEach(fa)}var ua={start:xi,add:fa,get:yi};var _={};_.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:6377563396e-3,b:635625691e-2,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:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};_.andrae={a:637710443e-2,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:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};_.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};_.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};_.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};_.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};_.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};_.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};_.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};_.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};_.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};_.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};_.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};_.evrstSS={a:6377298556e-3,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:63781575e-1,b:63567722e-1,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:63567733205e-4,ellipseName:"Southeast Asia"};_.walbeck={a:6376896,b:63558348467e-4,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"};var ca=_.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};_.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function ma(t,e,a,i){var s=t*t,r=e*e,n=(s-r)/s,h=0;i?(t*=1-n*(Ve+n*(Ke+n*Ye)),s=t*t,n=0):h=Math.sqrt(n);var o=(s-r)/r;return{es:n,e:h,ep2:o}}function Ma(t,e,a,i,s){if(!t){var r=k(_,i);r||(r=ca),t=r.a,e=r.b,a=r.rf}return a&&!e&&(e=(1-1/a)*t),(a===0||Math.abs(t-e)<p)&&(s=!0,e=t),{a:t,b:e,rf:a,sphere:s}}var T={};T.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};T.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};T.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};T.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};T.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};T.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};T.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};T.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};T.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};T.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};T.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};T.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};T.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};T.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};T.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};T.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};T.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function gi(t,e,a,i,s,r){var n={};return t===void 0||t==="none"?n.datum_type=St:n.datum_type=Qe,e&&(n.datum_params=e.map(parseFloat),(n.datum_params[0]!==0||n.datum_params[1]!==0||n.datum_params[2]!==0)&&(n.datum_type=X),n.datum_params.length>3&&(n.datum_params[3]!==0||n.datum_params[4]!==0||n.datum_params[5]!==0||n.datum_params[6]!==0)&&(n.datum_type=Q,n.datum_params[3]*=mt,n.datum_params[4]*=mt,n.datum_params[5]*=mt,n.datum_params[6]=n.datum_params[6]/1e6+1)),n.a=a,n.b=i,n.es=s,n.ep2=r,n}var da=gi;function gt(t,e){if(!(this instanceof gt))return new gt(t);e=e||function(o){if(o)throw o};var a=na(t);if(typeof a!="object"){e(t);return}var i=gt.projections.get(a.projName);if(!i){e(t);return}if(a.datumCode&&a.datumCode!=="none"){var s=k(T,a.datumCode);s&&(a.datum_params=s.towgs84?s.towgs84.split(","):null,a.ellps=s.ellipse,a.datumName=s.datumName?s.datumName:a.datumCode)}a.k0=a.k0||1,a.axis=a.axis||"enu",a.ellps=a.ellps||"wgs84";var r=Ma(a.a,a.b,a.rf,a.ellps,a.sphere),n=ma(r.a,r.b,r.rf,a.R_A),h=a.datum||da(a.datumCode,a.datum_params,r.a,r.b,n.es,n.ep2);Ie(this,a),Ie(this,i),this.a=r.a,this.b=r.b,this.rf=r.rf,this.sphere=r.sphere,this.es=n.es,this.e=n.e,this.ep2=n.ep2,this.datum=h,this.init(),e(null,this)}gt.projections=ua;gt.projections.start();var lt=gt;function pa(t,e){return t.datum_type!==e.datum_type||t.a!==e.a||Math.abs(t.es-e.es)>5e-11?!1:t.datum_type===X?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type===Q?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]:!0}function te(t,e,a){var i=t.x,s=t.y,r=t.z?t.z:0,n,h,o,l;if(s<-m&&s>-1.001*m)s=-m;else if(s>m&&s<1.001*m)s=m;else{if(s<-m)return{x:-1/0,y:-1/0,z:t.z};if(s>m)return{x:1/0,y:1/0,z:t.z}}return i>Math.PI&&(i-=2*Math.PI),h=Math.sin(s),l=Math.cos(s),o=h*h,n=a/Math.sqrt(1-e*o),{x:(n+r)*l*Math.cos(i),y:(n+r)*l*Math.sin(i),z:(n*(1-e)+r)*h}}function ee(t,e,a,i){var s=1e-12,r=s*s,n=30,h,o,l,u,f,c,M,d,y,x,g,b,E,S=t.x,A=t.y,P=t.z?t.z:0,O,C,Z;if(h=Math.sqrt(S*S+A*A),o=Math.sqrt(S*S+A*A+P*P),h/a<s){if(O=0,o/a<s)return C=m,Z=-i,{x:t.x,y:t.y,z:t.z}}else O=Math.atan2(A,S);l=P/o,u=h/o,f=1/Math.sqrt(1-e*(2-e)*u*u),d=u*(1-e)*f,y=l*f,E=0;do E++,M=a/Math.sqrt(1-e*y*y),Z=h*d+P*y-M*(1-e*y*y),c=e*M/(M+Z),f=1/Math.sqrt(1-c*(2-c)*u*u),x=u*(1-c)*f,g=l*f,b=g*d-x*y,d=x,y=g;while(b*b>r&&E<n);return C=Math.atan(g/Math.abs(x)),{x:O,y:C,z:Z}}function va(t,e,a){if(e===X)return{x:t.x+a[0],y:t.y+a[1],z:t.z+a[2]};if(e===Q){var i=a[0],s=a[1],r=a[2],n=a[3],h=a[4],o=a[5],l=a[6];return{x:l*(t.x-o*t.y+h*t.z)+i,y:l*(o*t.x+t.y-n*t.z)+s,z:l*(-h*t.x+n*t.y+t.z)+r}}}function ya(t,e,a){if(e===X)return{x:t.x-a[0],y:t.y-a[1],z:t.z-a[2]};if(e===Q){var i=a[0],s=a[1],r=a[2],n=a[3],h=a[4],o=a[5],l=a[6],u=(t.x-i)/l,f=(t.y-s)/l,c=(t.z-r)/l;return{x:u+o*f-h*c,y:-o*u+f+n*c,z:h*u-n*f+c}}}function ae(t){return t===X||t===Q}function xa(t,e,a){return pa(t,e)||t.datum_type===St||e.datum_type===St||t.es===e.es&&t.a===e.a&&!ae(t.datum_type)&&!ae(e.datum_type)?a:(a=te(a,t.es,t.a),ae(t.datum_type)&&(a=va(a,t.datum_type,t.datum_params)),ae(e.datum_type)&&(a=ya(a,e.datum_type,e.datum_params)),ee(a,e.es,e.a,e.b))}function Ae(t,e,a){var i=a.x,s=a.y,r=a.z||0,n,h,o,l={};for(o=0;o<3;o++)if(!(e&&o===2&&a.z===void 0))switch(o===0?(n=i,"ew".indexOf(t.axis[o])!==-1?h="x":h="y"):o===1?(n=s,"ns".indexOf(t.axis[o])!==-1?h="y":h="x"):(n=r,h="z"),t.axis[o]){case"e":case"w":case"n":case"s":l[h]=n;break;case"u":a[h]!==void 0&&(l.z=n);break;case"d":a[h]!==void 0&&(l.z=-n);break;default:return null}return l}function se(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function _a(t){ga(t.x),ga(t.y)}function ga(t){if(typeof Number.isFinite=="function"){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if(typeof t!="number"||t!==t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function _i(t,e){return(t.datum.datum_type===X||t.datum.datum_type===Q)&&e.datumCode!=="WGS84"||(e.datum.datum_type===X||e.datum.datum_type===Q)&&t.datumCode!=="WGS84"}function dt(t,e,a){var i;if(Array.isArray(a)&&(a=se(a)),_a(a),t.datum&&e.datum&&_i(t,e)&&(i=new lt("WGS84"),a=dt(t,i,a),t=i),t.axis!=="enu"&&(a=Ae(t,!1,a)),t.projName==="longlat")a={x:a.x*L,y:a.y*L,z:a.z||0};else if(t.to_meter&&(a={x:a.x*t.to_meter,y:a.y*t.to_meter,z:a.z||0}),a=t.inverse(a),!a)return;return t.from_greenwich&&(a.x+=t.from_greenwich),a=xa(t.datum,e.datum,a),e.from_greenwich&&(a={x:a.x-e.from_greenwich,y:a.y,z:a.z||0}),e.projName==="longlat"?a={x:a.x*V,y:a.y*V,z:a.z||0}:(a=e.forward(a),e.to_meter&&(a={x:a.x/e.to_meter,y:a.y/e.to_meter,z:a.z||0})),e.axis!=="enu"?Ae(e,!0,a):a}var ba=lt("WGS84");function Pe(t,e,a){var i,s,r;return Array.isArray(a)?(i=dt(t,e,a)||{x:NaN,y:NaN},a.length>2?typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"?typeof i.z=="number"?[i.x,i.y,i.z].concat(a.splice(3)):[i.x,i.y,a[2]].concat(a.splice(3)):[i.x,i.y].concat(a.splice(2)):[i.x,i.y]):(s=dt(t,e,a),r=Object.keys(a),r.length===2||r.forEach(function(n){if(typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"){if(n==="x"||n==="y"||n==="z")return}else if(n==="x"||n==="y")return;s[n]=a[n]}),s)}function Ea(t){return t instanceof lt?t:t.oProj?t.oProj:lt(t)}function bi(t,e,a){t=Ea(t);var i=!1,s;return typeof e>"u"?(e=t,t=ba,i=!0):(typeof e.x<"u"||Array.isArray(e))&&(a=e,e=t,t=ba,i=!0),e=Ea(e),a?Pe(t,e,a):(s={forward:function(r){return Pe(t,e,r)},inverse:function(r){return Pe(e,t,r)}},i&&(s.oProj=e),s)}var H=bi;var Ia=6,Pa="AJSAJS",Na="AFAFAF",_t=65,z=73,W=79,Lt=86,Tt=90,Sa={forward:Se,inverse:Ei,toPoint:Re};function Se(t,e){return e=e||5,Pi(Ii({lat:t[1],lon:t[0]}),e)}function Ei(t){var e=we(wa(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function Re(t){var e=we(wa(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Ne(t){return t*(Math.PI/180)}function Aa(t){return 180*(t/Math.PI)}function Ii(t){var e=t.lat,a=t.lon,i=6378137,s=.00669438,r=.9996,n,h,o,l,u,f,c,M=Ne(e),d=Ne(a),y,x;x=Math.floor((a+180)/6)+1,a===180&&(x=60),e>=56&&e<64&&a>=3&&a<12&&(x=32),e>=72&&e<84&&(a>=0&&a<9?x=31:a>=9&&a<21?x=33:a>=21&&a<33?x=35:a>=33&&a<42&&(x=37)),n=(x-1)*6-180+3,y=Ne(n),h=s/(1-s),o=i/Math.sqrt(1-s*Math.sin(M)*Math.sin(M)),l=Math.tan(M)*Math.tan(M),u=h*Math.cos(M)*Math.cos(M),f=Math.cos(M)*(d-y),c=i*((1-s/4-3*s*s/64-5*s*s*s/256)*M-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*M)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*M)-35*s*s*s/3072*Math.sin(6*M));var g=r*o*(f+(1-l+u)*f*f*f/6+(5-18*l+l*l+72*u-58*h)*f*f*f*f*f/120)+5e5,b=r*(c+o*Math.tan(M)*(f*f/2+(5-l+9*u+4*u*u)*f*f*f*f/24+(61-58*l+l*l+600*u-330*h)*f*f*f*f*f*f/720));return e<0&&(b+=1e7),{northing:Math.round(b),easting:Math.round(g),zoneNumber:x,zoneLetter:Ai(e)}}function we(t){var e=t.northing,a=t.easting,i=t.zoneLetter,s=t.zoneNumber;if(s<0||s>60)return null;var r=.9996,n=6378137,h=.00669438,o,l=(1-Math.sqrt(1-h))/(1+Math.sqrt(1-h)),u,f,c,M,d,y,x,g,b,E=a-5e5,S=e;i<"N"&&(S-=1e7),x=(s-1)*6-180+3,o=h/(1-h),y=S/r,g=y/(n*(1-h/4-3*h*h/64-5*h*h*h/256)),b=g+(3*l/2-27*l*l*l/32)*Math.sin(2*g)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*g)+151*l*l*l/96*Math.sin(6*g),u=n/Math.sqrt(1-h*Math.sin(b)*Math.sin(b)),f=Math.tan(b)*Math.tan(b),c=o*Math.cos(b)*Math.cos(b),M=n*(1-h)/Math.pow(1-h*Math.sin(b)*Math.sin(b),1.5),d=E/(u*r);var A=b-u*Math.tan(b)/M*(d*d/2-(5+3*f+10*c-4*c*c-9*o)*d*d*d*d/24+(61+90*f+298*c+45*f*f-252*o-3*c*c)*d*d*d*d*d*d/720);A=Aa(A);var P=(d-(1+2*f+c)*d*d*d/6+(5-2*c+28*f-3*c*c+8*o+24*f*f)*d*d*d*d*d/120)/Math.cos(b);P=x+Aa(P);var O;if(t.accuracy){var C=we({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});O={top:C.lat,right:C.lon,bottom:A,left:P}}else O={lat:A,lon:P};return O}function Ai(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function Pi(t,e){var a="00000"+t.easting,i="00000"+t.northing;return t.zoneNumber+t.zoneLetter+Ni(t.easting,t.northing,t.zoneNumber)+a.substr(a.length-5,e)+i.substr(i.length-5,e)}function Ni(t,e,a){var i=Ra(a),s=Math.floor(t/1e5),r=Math.floor(e/1e5)%20;return Si(s,r,i)}function Ra(t){var e=t%Ia;return e===0&&(e=Ia),e}function Si(t,e,a){var i=a-1,s=Pa.charCodeAt(i),r=Na.charCodeAt(i),n=s+t-1,h=r+e,o=!1;n>Tt&&(n=n-Tt+_t-1,o=!0),(n===z||s<z&&n>z||(n>z||s<z)&&o)&&n++,(n===W||s<W&&n>W||(n>W||s<W)&&o)&&(n++,n===z&&n++),n>Tt&&(n=n-Tt+_t-1),h>Lt?(h=h-Lt+_t-1,o=!0):o=!1,(h===z||r<z&&h>z||(h>z||r<z)&&o)&&h++,(h===W||r<W&&h>W||(h>W||r<W)&&o)&&(h++,h===z&&h++),h>Lt&&(h=h-Lt+_t-1);var l=String.fromCharCode(n)+String.fromCharCode(h);return l}function wa(t){if(t&&t.length===0)throw"MGRSPoint coverting from nothing";for(var e=t.length,a=null,i="",s,r=0;!/[A-Z]/.test(s=t.charAt(r));){if(r>=2)throw"MGRSPoint bad conversion from: "+t;i+=s,r++}var n=parseInt(i,10);if(r===0||r+3>e)throw"MGRSPoint bad conversion from: "+t;var h=t.charAt(r++);if(h<="A"||h==="B"||h==="Y"||h>="Z"||h==="I"||h==="O")throw"MGRSPoint zone letter "+h+" not handled: "+t;a=t.substring(r,r+=2);for(var o=Ra(n),l=Ri(a.charAt(0),o),u=wi(a.charAt(1),o);u<Ci(h);)u+=2e6;var f=e-r;if(f%2!==0)throw`MGRSPoint has to have an even number
of digits after the zone letter and two 100km letters - front
half for easting meters, second half for
northing meters`+t;var c=f/2,M=0,d=0,y,x,g,b,E;return c>0&&(y=1e5/Math.pow(10,c),x=t.substring(r,r+c),M=parseFloat(x)*y,g=t.substring(r+c),d=parseFloat(g)*y),b=M+l,E=d+u,{easting:b,northing:E,zoneLetter:h,zoneNumber:n,accuracy:y}}function Ri(t,e){for(var a=Pa.charCodeAt(e-1),i=1e5,s=!1;a!==t.charCodeAt(0);){if(a++,a===z&&a++,a===W&&a++,a>Tt){if(s)throw"Bad character: "+t;a=_t,s=!0}i+=1e5}return i}function wi(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var a=Na.charCodeAt(e-1),i=0,s=!1;a!==t.charCodeAt(0);){if(a++,a===z&&a++,a===W&&a++,a>Lt){if(s)throw"Bad character: "+t;a=_t,s=!0}i+=1e5}return i}function Ci(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function bt(t,e,a){if(!(this instanceof bt))return new bt(t,e,a);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if(typeof t=="object")this.x=t.x,this.y=t.y,this.z=t.z||0;else if(typeof t=="string"&&typeof e>"u"){var i=t.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=t,this.y=e,this.z=a||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}bt.fromMGRS=function(t){return new bt(Re(t))};bt.prototype.toMGRS=function(t){return Se([this.x,this.y],t)};var Ca=bt;var Li=1,Ti=.25,La=.046875,Ta=.01953125,Da=.01068115234375,Di=.75,Oi=.46875,Bi=.013020833333333334,Gi=.007120768229166667,Fi=.3645833333333333,qi=.005696614583333333,zi=.3076171875;function ie(t){var e=[];e[0]=Li-t*(Ti+t*(La+t*(Ta+t*Da))),e[1]=t*(Di-t*(La+t*(Ta+t*Da)));var a=t*t;return e[2]=a*(Oi-t*(Bi+t*Gi)),a*=t,e[3]=a*(Fi-t*qi),e[4]=a*t*zi,e}function pt(t,e,a,i){return a*=e,e*=e,i[0]*t-a*(i[1]+e*(i[2]+e*(i[3]+e*i[4])))}var ji=20;function re(t,e,a){for(var i=1/(1-e),s=t,r=ji;r;--r){var n=Math.sin(s),h=1-e*n*n;if(h=(pt(s,n,Math.cos(s),a)-t)*(h*Math.sqrt(h))*i,s-=h,Math.abs(h)<p)return s}return s}function ki(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=ie(this.es),this.ml0=pt(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Hi(t){var e=t.x,a=t.y,i=v(e-this.long0),s,r,n,h=Math.sin(a),o=Math.cos(a);if(this.es){var u=o*i,f=Math.pow(u,2),c=this.ep2*Math.pow(o,2),M=Math.pow(c,2),d=Math.abs(o)>p?Math.tan(a):0,y=Math.pow(d,2),x=Math.pow(y,2);s=1-this.es*Math.pow(h,2),u=u/Math.sqrt(s);var g=pt(a,h,o,this.en);r=this.a*(this.k0*u*(1+f/6*(1-y+c+f/20*(5-18*y+x+14*c-58*y*c+f/42*(61+179*x-x*y-479*y)))))+this.x0,n=this.a*(this.k0*(g-this.ml0+h*i*u/2*(1+f/12*(5-y+9*c+4*M+f/30*(61+x-58*y+270*c-330*y*c+f/56*(1385+543*x-x*y-3111*y))))))+this.y0}else{var l=o*Math.sin(i);if(Math.abs(Math.abs(l)-1)<p)return 93;if(r=.5*this.a*this.k0*Math.log((1+l)/(1-l))+this.x0,n=o*Math.cos(i)/Math.sqrt(1-Math.pow(l,2)),l=Math.abs(n),l>=1){if(l-1>p)return 93;n=0}else n=Math.acos(n);a<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=r,t.y=n,t}function Ui(t){var e,a,i,s,r=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+n/this.k0,a=re(e,this.es,this.en),Math.abs(a)<m){var f=Math.sin(a),c=Math.cos(a),M=Math.abs(c)>p?Math.tan(a):0,d=this.ep2*Math.pow(c,2),y=Math.pow(d,2),x=Math.pow(M,2),g=Math.pow(x,2);e=1-this.es*Math.pow(f,2);var b=r*Math.sqrt(e)/this.k0,E=Math.pow(b,2);e=e*M,i=a-e*E/(1-this.es)*.5*(1-E/12*(5+3*x-9*d*x+d-4*y-E/30*(61+90*x-252*d*x+45*g+46*d-E/56*(1385+3633*x+4095*g+1574*g*x)))),s=v(this.long0+b*(1-E/6*(1+2*x+d-E/20*(5+28*x+24*g+8*d*x+6*d-E/42*(61+662*x+1320*g+720*g*x))))/c)}else i=m*tt(n),s=0;else{var h=Math.exp(r/this.k0),o=.5*(h-1/h),l=this.lat0+n/this.k0,u=Math.cos(l);e=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(o,2))),i=Math.asin(e),n<0&&(i=-i),o===0&&u===0?s=0:s=v(Math.atan2(o,u)+this.long0)}return t.x=s,t.y=i,t}var Wi=["Transverse_Mercator","Transverse Mercator","tmerc"],Oa={init:ki,forward:Hi,inverse:Ui,names:Wi};function ne(t){var e=Math.exp(t);return e=(e-1/e)/2,e}function Dt(t,e){t=Math.abs(t),e=Math.abs(e);var a=Math.max(t,e),i=Math.min(t,e)/(a||1);return a*Math.sqrt(1+Math.pow(i,2))}function Ba(t){var e=1+t,a=e-1;return a===0?t:t*Math.log(e)/a}function Ga(t){var e=Math.abs(t);return e=Ba(e*(1+e/(Dt(1,e)+1))),t<0?-e:e}function he(t,e){for(var a=2*Math.cos(2*e),i=t.length-1,s=t[i],r=0,n;--i>=0;)n=-r+a*s+t[i],r=s,s=n;return e+n*Math.sin(2*e)}function Fa(t,e){for(var a=2*Math.cos(e),i=t.length-1,s=t[i],r=0,n;--i>=0;)n=-r+a*s+t[i],r=s,s=n;return Math.sin(e)*n}function qa(t){var e=Math.exp(t);return e=(e+1/e)/2,e}function Ce(t,e,a){for(var i=Math.sin(e),s=Math.cos(e),r=ne(a),n=qa(a),h=2*s*n,o=-2*i*r,l=t.length-1,u=t[l],f=0,c=0,M=0,d,y;--l>=0;)d=c,y=f,c=u,f=M,u=-d+h*c-o*f+t[l],M=-y+o*c+h*f;return h=i*n,o=s*r,[h*u-o*M,h*M+o*u]}function Ji(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),a=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),a=a*e,this.cgb[1]=a*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=a*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),a=a*e,this.cgb[2]=a*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=a*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),a=a*e,this.cgb[3]=a*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=a*(1237/630+e*(-12/5+e*(-24832/14175))),a=a*e,this.cgb[4]=a*(4174/315+e*(-144838/6237)),this.cbg[4]=a*(-734/315+e*(109598/31185)),a=a*e,this.cgb[5]=a*(601676/22275),this.cbg[5]=a*(444337/155925),a=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+a*(1/4+a*(1/64+a/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=a*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=a*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),a=a*e,this.utg[2]=a*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=a*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),a=a*e,this.utg[3]=a*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=a*(49561/161280+e*(-179/168+e*(6601661/7257600))),a=a*e,this.utg[4]=a*(-4583/161280+e*(108847/3991680)),this.gtu[4]=a*(34729/80640+e*(-3418889/1995840)),a=a*e,this.utg[5]=a*(-20648693/638668800),this.gtu[5]=a*(212378941/319334400);var i=he(this.cbg,this.lat0);this.Zb=-this.Qn*(i+Fa(this.gtu,2*i))}function Xi(t){var e=v(t.x-this.long0),a=t.y;a=he(this.cbg,a);var i=Math.sin(a),s=Math.cos(a),r=Math.sin(e),n=Math.cos(e);a=Math.atan2(i,n*s),e=Math.atan2(r*s,Dt(i,s*n)),e=Ga(Math.tan(e));var h=Ce(this.gtu,2*a,2*e);a=a+h[0],e=e+h[1];var o,l;return Math.abs(e)<=2.623395162778?(o=this.a*(this.Qn*e)+this.x0,l=this.a*(this.Qn*a+this.Zb)+this.y0):(o=1/0,l=1/0),t.x=o,t.y=l,t}function Qi(t){var e=(t.x-this.x0)*(1/this.a),a=(t.y-this.y0)*(1/this.a);a=(a-this.Zb)/this.Qn,e=e/this.Qn;var i,s;if(Math.abs(e)<=2.623395162778){var r=Ce(this.utg,2*a,2*e);a=a+r[0],e=e+r[1],e=Math.atan(ne(e));var n=Math.sin(a),h=Math.cos(a),o=Math.sin(e),l=Math.cos(e);a=Math.atan2(n*l,Dt(o,l*h)),e=Math.atan2(o,l*h),i=v(e+this.long0),s=he(this.cgb,a)}else i=1/0,s=1/0;return t.x=i,t.y=s,t}var Vi=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Et={init:Ji,forward:Xi,inverse:Qi,names:Vi};function za(t,e){if(t===void 0){if(t=Math.floor((v(e)+Math.PI)*30/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t}var Ki="etmerc";function Yi(){var t=za(this.zone,this.long0);if(t===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*L,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Et.init.apply(this),this.forward=Et.forward,this.inverse=Et.inverse}var Zi=["Universal Transverse Mercator System","utm"],ja={init:Yi,names:Zi,dependsOn:Ki};function oe(t,e){return Math.pow((1-t)/(1+t),e)}var $i=20;function tr(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+I)/(Math.pow(Math.tan(.5*this.lat0+I),this.C)*oe(this.e*t,this.ratexp))}function er(t){var e=t.x,a=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*a+I),this.C)*oe(this.e*Math.sin(a),this.ratexp))-m,t.x=this.C*e,t}function ar(t){for(var e=1e-14,a=t.x/this.C,i=t.y,s=Math.pow(Math.tan(.5*i+I)/this.K,1/this.C),r=$i;r>0&&(i=2*Math.atan(s*oe(this.e*Math.sin(t.y),-.5*this.e))-m,!(Math.abs(i-t.y)<e));--r)t.y=i;return r?(t.x=a,t.y=i,t):null}var sr=["gauss"],le={init:tr,forward:er,inverse:ar,names:sr};function ir(){le.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"))}function rr(t){var e,a,i,s;return t.x=v(t.x-this.long0),le.forward.apply(this,[t]),e=Math.sin(t.y),a=Math.cos(t.y),i=Math.cos(t.x),s=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*a*i),t.x=s*a*Math.sin(t.x),t.y=s*(this.cosc0*e-this.sinc0*a*i),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function nr(t){var e,a,i,s,r;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,r=Math.sqrt(t.x*t.x+t.y*t.y)){var n=2*Math.atan2(r,this.R2);e=Math.sin(n),a=Math.cos(n),s=Math.asin(a*this.sinc0+t.y*e*this.cosc0/r),i=Math.atan2(t.x*e,r*this.cosc0*a-t.y*this.sinc0*e)}else s=this.phic0,i=0;return t.x=i,t.y=s,le.inverse.apply(this,[t]),t.x=v(t.x+this.long0),t}var hr=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],ka={init:ir,forward:rr,inverse:nr,names:hr};function or(t,e,a){return e*=a,Math.tan(.5*(m+t))*Math.pow((1-e)/(1+e),.5*a)}function lr(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=p&&(this.k0=.5*(1+tt(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=p&&(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)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=p&&(this.k0=.5*this.cons*B(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/F(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=B(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-m,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function fr(t){var e=t.x,a=t.y,i=Math.sin(a),s=Math.cos(a),r,n,h,o,l,u,f=v(e-this.long0);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=p&&Math.abs(a+this.lat0)<=p?(t.x=NaN,t.y=NaN,t):this.sphere?(r=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(f)),t.x=this.a*r*s*Math.sin(f)+this.x0,t.y=this.a*r*(this.coslat0*i-this.sinlat0*s*Math.cos(f))+this.y0,t):(n=2*Math.atan(this.ssfn_(a,i,this.e))-m,o=Math.cos(n),h=Math.sin(n),Math.abs(this.coslat0)<=p?(l=F(this.e,a*this.con,this.con*i),u=2*this.a*this.k0*l/this.cons,t.x=this.x0+u*Math.sin(e-this.long0),t.y=this.y0-this.con*u*Math.cos(e-this.long0),t):(Math.abs(this.sinlat0)<p?(r=2*this.a*this.k0/(1+o*Math.cos(f)),t.y=r*h):(r=2*this.a*t