@loaders.gl/shapefile 3.1.0-alpha.4 → 3.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +7554 -0
  4. package/dist/dbf-loader.d.ts +8 -0
  5. package/dist/dbf-loader.d.ts.map +1 -0
  6. package/dist/dbf-loader.js +32 -0
  7. package/dist/dbf-worker.js +912 -2
  8. package/dist/es5/bundle.js +1 -1
  9. package/dist/es5/bundle.js.map +1 -1
  10. package/dist/es5/dbf-loader.js +5 -40
  11. package/dist/es5/dbf-loader.js.map +1 -1
  12. package/dist/es5/index.js +5 -5
  13. package/dist/es5/lib/parsers/parse-dbf.js +86 -232
  14. package/dist/es5/lib/parsers/parse-dbf.js.map +1 -1
  15. package/dist/es5/lib/parsers/parse-shapefile.js +151 -404
  16. package/dist/es5/lib/parsers/parse-shapefile.js.map +1 -1
  17. package/dist/es5/lib/parsers/parse-shp-geometry.js +49 -96
  18. package/dist/es5/lib/parsers/parse-shp-geometry.js.map +1 -1
  19. package/dist/es5/lib/parsers/parse-shp-header.js +4 -4
  20. package/dist/es5/lib/parsers/parse-shp-header.js.map +1 -1
  21. package/dist/es5/lib/parsers/parse-shp.js +47 -165
  22. package/dist/es5/lib/parsers/parse-shp.js.map +1 -1
  23. package/dist/es5/lib/parsers/parse-shx.js +11 -11
  24. package/dist/es5/lib/parsers/parse-shx.js.map +1 -1
  25. package/dist/es5/lib/streaming/binary-chunk-reader.js +99 -172
  26. package/dist/es5/lib/streaming/binary-chunk-reader.js.map +1 -1
  27. package/dist/es5/lib/streaming/binary-reader.js +24 -35
  28. package/dist/es5/lib/streaming/binary-reader.js.map +1 -1
  29. package/dist/es5/lib/streaming/zip-batch-iterators.js +37 -96
  30. package/dist/es5/lib/streaming/zip-batch-iterators.js.map +1 -1
  31. package/dist/es5/shapefile-loader.js +3 -3
  32. package/dist/es5/shapefile-loader.js.map +1 -1
  33. package/dist/es5/shp-loader.js +6 -41
  34. package/dist/es5/shp-loader.js.map +1 -1
  35. package/dist/es5/workers/dbf-worker.js +7 -3
  36. package/dist/es5/workers/dbf-worker.js.map +1 -0
  37. package/dist/es5/workers/shp-worker.js +7 -3
  38. package/dist/es5/workers/shp-worker.js.map +1 -0
  39. package/dist/esm/dbf-loader.js +1 -1
  40. package/dist/esm/dbf-loader.js.map +1 -1
  41. package/dist/esm/lib/parsers/parse-dbf.js +4 -6
  42. package/dist/esm/lib/parsers/parse-dbf.js.map +1 -1
  43. package/dist/esm/lib/parsers/parse-shapefile.js +1 -1
  44. package/dist/esm/lib/parsers/parse-shapefile.js.map +1 -1
  45. package/dist/esm/lib/parsers/parse-shp-geometry.js +1 -1
  46. package/dist/esm/lib/parsers/parse-shp-geometry.js.map +1 -1
  47. package/dist/esm/lib/parsers/parse-shp-header.js +2 -2
  48. package/dist/esm/lib/parsers/parse-shp-header.js.map +1 -1
  49. package/dist/esm/lib/parsers/parse-shp.js +2 -2
  50. package/dist/esm/lib/parsers/parse-shp.js.map +1 -1
  51. package/dist/esm/shapefile-loader.js +1 -1
  52. package/dist/esm/shapefile-loader.js.map +1 -1
  53. package/dist/esm/shp-loader.js +1 -1
  54. package/dist/esm/shp-loader.js.map +1 -1
  55. package/dist/esm/workers/dbf-worker.js +3 -3
  56. package/dist/esm/workers/dbf-worker.js.map +1 -0
  57. package/dist/esm/workers/shp-worker.js +3 -3
  58. package/dist/esm/workers/shp-worker.js.map +1 -0
  59. package/dist/index.d.ts +4 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +11 -0
  62. package/dist/lib/parsers/parse-dbf.d.ts +28 -0
  63. package/dist/lib/parsers/parse-dbf.d.ts.map +1 -0
  64. package/dist/lib/parsers/parse-dbf.js +335 -0
  65. package/dist/lib/parsers/parse-shapefile.d.ts +54 -0
  66. package/dist/lib/parsers/parse-shapefile.d.ts.map +1 -0
  67. package/dist/lib/parsers/parse-shapefile.js +245 -0
  68. package/dist/lib/parsers/parse-shp-geometry.d.ts +11 -0
  69. package/dist/lib/parsers/parse-shp-geometry.d.ts.map +1 -0
  70. package/dist/lib/parsers/parse-shp-geometry.js +287 -0
  71. package/dist/lib/parsers/parse-shp-header.d.ts +26 -0
  72. package/dist/lib/parsers/parse-shp-header.d.ts.map +1 -0
  73. package/dist/lib/parsers/parse-shp-header.js +43 -0
  74. package/dist/lib/parsers/parse-shp.d.ts +9 -0
  75. package/dist/lib/parsers/parse-shp.d.ts.map +1 -0
  76. package/dist/lib/parsers/parse-shp.js +170 -0
  77. package/dist/lib/parsers/parse-shx.d.ts +10 -0
  78. package/dist/lib/parsers/parse-shx.d.ts.map +1 -0
  79. package/dist/lib/parsers/parse-shx.js +28 -0
  80. package/dist/lib/streaming/binary-chunk-reader.d.ts +59 -0
  81. package/dist/lib/streaming/binary-chunk-reader.d.ts.map +1 -0
  82. package/dist/lib/streaming/binary-chunk-reader.js +161 -0
  83. package/dist/lib/streaming/binary-reader.d.ts +32 -0
  84. package/dist/lib/streaming/binary-reader.d.ts.map +1 -0
  85. package/dist/lib/streaming/binary-reader.js +52 -0
  86. package/dist/lib/streaming/zip-batch-iterators.d.ts +8 -0
  87. package/dist/lib/streaming/zip-batch-iterators.d.ts.map +1 -0
  88. package/dist/lib/streaming/zip-batch-iterators.js +61 -0
  89. package/dist/shapefile-loader.d.ts +26 -0
  90. package/dist/shapefile-loader.d.ts.map +1 -0
  91. package/dist/shapefile-loader.js +31 -0
  92. package/dist/shp-loader.d.ts +9 -0
  93. package/dist/shp-loader.d.ts.map +1 -0
  94. package/dist/shp-loader.js +35 -0
  95. package/dist/shp-worker.js +606 -2
  96. package/dist/workers/dbf-worker.d.ts +2 -0
  97. package/dist/workers/dbf-worker.d.ts.map +1 -0
  98. package/dist/workers/dbf-worker.js +5 -0
  99. package/dist/workers/shp-worker.d.ts +2 -0
  100. package/dist/workers/shp-worker.d.ts.map +1 -0
  101. package/dist/workers/shp-worker.js +5 -0
  102. package/package.json +10 -10
  103. package/src/lib/parsers/parse-dbf.ts +5 -3
  104. package/src/lib/parsers/parse-shp-geometry.ts +1 -1
  105. package/src/workers/{dbf-worker.js → dbf-worker.ts} +0 -0
  106. package/src/workers/{shp-worker.js → shp-worker.ts} +0 -0
  107. package/dist/dbf-worker.js.map +0 -1
  108. package/dist/dist.min.js +0 -2
  109. package/dist/dist.min.js.map +0 -1
  110. package/dist/shp-worker.js.map +0 -1
package/dist/dist.min.js DELETED
@@ -1,2 +0,0 @@
1
- !function(t,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s();else if("function"==typeof define&&define.amd)define([],s);else{var i=s();for(var a in i)("object"==typeof exports?exports:t)[a]=i[a]}}(window,(function(){return function(t){var s={};function i(a){if(s[a])return s[a].exports;var e=s[a]={i:a,l:!1,exports:{}};return t[a].call(e.exports,e,e.exports,i),e.l=!0,e.exports}return i.m=t,i.c=s,i.d=function(t,s,a){i.o(t,s)||Object.defineProperty(t,s,{enumerable:!0,get:a})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,s){if(1&s&&(t=i(t)),8&s)return t;if(4&s&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&s&&"string"!=typeof t)for(var e in t)i.d(a,e,function(s){return t[s]}.bind(null,e));return a},i.n=function(t){var s=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(s,"a",s),s},i.o=function(t,s){return Object.prototype.hasOwnProperty.call(t,s)},i.p="",i(i.s=0)}([function(t,s,i){const a=i(1);globalThis.loaders=globalThis.loaders||{},t.exports=Object.assign(globalThis.loaders,a)},function(t,s,i){"use strict";function a(t,s,i){return s in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}i.r(s),i.d(s,"ShapefileLoader",(function(){return Hi})),i.d(s,"DBFLoader",(function(){return zi})),i.d(s,"DBFWorkerLoader",(function(){return Bi})),i.d(s,"SHPLoader",(function(){return w})),i.d(s,"SHPWorkerLoader",(function(){return x}));class e{constructor(t){a(this,"offset",void 0),a(this,"arrayBuffers",void 0),a(this,"ended",void 0),a(this,"maxRewindBytes",void 0);const{maxRewindBytes:s=0}=t||{};this.offset=0,this.arrayBuffers=[],this.ended=!1,this.maxRewindBytes=s}write(t){this.arrayBuffers.push(t)}end(){this.arrayBuffers=[],this.ended=!0}hasAvailableBytes(t){let s=-this.offset;for(const i of this.arrayBuffers)if(s+=i.byteLength,s>=t)return!0;return!1}findBufferOffsets(t){let s=-this.offset;const i=[];for(let a=0;a<this.arrayBuffers.length;a++){const e=this.arrayBuffers[a];if(s+e.byteLength<=0){s+=e.byteLength;continue}const h=s<=0?Math.abs(s):0;let n;if(h+t<=e.byteLength)return n=h+t,i.push([a,[h,n]]),i;n=e.byteLength,i.push([a,[h,n]]),t-=e.byteLength-h,s+=e.byteLength}return null}getDataView(t){const s=this.findBufferOffsets(t);if(!s&&this.ended)throw new Error("binary data exhausted");if(!s)return null;if(1===s.length){const[i,[a,e]]=s[0],h=this.arrayBuffers[i],n=new DataView(h,a,e-a);return this.offset+=t,this.disposeBuffers(),n}const i=new DataView(this._combineArrayBuffers(s));return this.offset+=t,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(t){let s=0;for(const i of t){const[t,a]=i[1];s+=a-t}const i=new Uint8Array(s);let a=0;for(const s of t){const[t,[e,h]]=s,n=new Uint8Array(this.arrayBuffers[t]);i.set(n.subarray(e,h),a),a+=h-e}return i.buffer}skip(t){this.offset+=t}rewind(t){this.offset-=t}}function h(t){const s={magic:t.getInt32(0,!1),length:2*t.getInt32(24,!1),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 9994!==s.magic&&console.error("SHP file: bad magic number "+s.magic),1e3!==s.version&&console.error("SHP file: bad version "+s.version),s}function n(t,s){const{_maxDimensions:i}=(null==s?void 0:s.shp)||{};let a=0;const e=t.getInt32(a,!0);switch(a+=Int32Array.BYTES_PER_ELEMENT,e){case 0:return null;case 1:return r(t,a,Math.min(2,i));case 3:return l(t,a,Math.min(2,i),"LineString");case 5:return l(t,a,Math.min(2,i),"Polygon");case 8:return o(t,a,Math.min(2,i));case 11:return r(t,a,Math.min(4,i));case 13:return l(t,a,Math.min(4,i),"LineString");case 15:return l(t,a,Math.min(4,i),"Polygon");case 18:return o(t,a,Math.min(4,i));case 21:return r(t,a,Math.min(3,i));case 23:return l(t,a,Math.min(3,i),"LineString");case 25:return l(t,a,Math.min(3,i),"Polygon");case 28:return o(t,a,Math.min(3,i));default:throw new Error("unsupported shape type: "+e)}}function r(t,s,i){let a;return[a,s]=c(t,s,1,i),{positions:{value:a,size:i},type:"Point"}}function o(t,s,i){s+=4*Float64Array.BYTES_PER_ELEMENT;const a=t.getInt32(s,!0);s+=Int32Array.BYTES_PER_ELEMENT;let e=null,h=null,n=null;[e,s]=c(t,s,a,2),4===i&&(s+=2*Float64Array.BYTES_PER_ELEMENT,[n,s]=c(t,s,a,1)),i>=3&&(s+=2*Float64Array.BYTES_PER_ELEMENT,[h,s]=c(t,s,a,1));return{positions:{value:u(e,h,n),size:i},type:"Point"}}function l(t,s,i,a){s+=4*Float64Array.BYTES_PER_ELEMENT;const e=t.getInt32(s,!0);s+=Int32Array.BYTES_PER_ELEMENT;const h=t.getInt32(s,!0);s+=Int32Array.BYTES_PER_ELEMENT;const n=t.byteOffset+s,r=e*Int32Array.BYTES_PER_ELEMENT,o=new Int32Array(e+1);o.set(new Int32Array(t.buffer.slice(n,n+r))),o[e]=h,s+=e*Int32Array.BYTES_PER_ELEMENT;let l=null,M=null,d=null;[l,s]=c(t,s,h,2),4===i&&(s+=2*Float64Array.BYTES_PER_ELEMENT,[d,s]=c(t,s,h,1)),i>=3&&(s+=2*Float64Array.BYTES_PER_ELEMENT,[M,s]=c(t,s,h,1));const p=u(l,M,d);if("LineString"===a)return{type:a,positions:{value:p,size:i},pathIndices:{value:o,size:1}};const m=[];for(let t=1;t<o.length;t++){const s=o[t-1],i=o[t];f(l.subarray(2*s,2*i))>0&&m.push(s)}return m.push(h),{type:a,positions:{value:p,size:i},primitivePolygonIndices:{value:o,size:1},polygonIndices:{value:new Uint32Array(m),size:1}}}function c(t,s,i,a){const e=t.byteOffset+s,h=i*a*Float64Array.BYTES_PER_ELEMENT;return[new Float64Array(t.buffer.slice(e,e+h)),s+h]}function u(t,s,i){if(!s&&!i)return t;let a=t.length,e=2;i&&i.length&&(a+=i.length,e++),s&&s.length&&(a+=s.length,e++);const h=new Float64Array(a);for(let s=0;s<t.length/2;s++)h[e*s]=t[2*s],h[e*s+1]=t[2*s+1];if(i&&i.length)for(let t=0;t<i.length;t++)h[e*t+2]=i[t];if(s&&s.length)for(let t=0;t<s.length;t++)h[e*t+(e-1)]=s[t];return h}function f(t){return Math.sign(function(t){let s=0;const i=t.length/2-1;for(let a=0;a<i;a++)s+=(t[2*a]+t[2*(a+1)])*(t[2*a+1]-t[2*(a+1)+1]);return s/2}(t))}function M(t,s,i){return s in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}const d=0,p=1,m=2,y=3;class g{constructor(t){M(this,"options",{}),M(this,"binaryReader",new e({maxRewindBytes:12})),M(this,"state",d),M(this,"result",{geometries:[]}),this.options=t}write(t){this.binaryReader.write(t),this.state=b(this.state,this.result,this.binaryReader,this.options)}end(){this.binaryReader.end(),this.state=b(this.state,this.result,this.binaryReader,this.options),this.state!==m&&(this.state=y,this.result.error="SHP incomplete file")}}function _(t,s){const i=new g(s);return i.write(t),i.end(),i.result}function b(t,s,i,a){for(;;)try{switch(t){case y:case m:return t;case d:const e=i.getDataView(100);if(!e)return t;s.header=h(e),s.progress={bytesUsed:0,bytesTotal:s.header.length,rows:0},s.currentIndex=1,t=p;break;case p:for(;i.hasAvailableBytes(12);){const e=i.getDataView(12),h={recordNumber:e.getInt32(0,!1),byteLength:2*e.getInt32(4,!1),type:e.getInt32(8,!0)};if(!i.hasAvailableBytes(h.byteLength-4))return i.rewind(12),t;if(h.byteLength<4||h.type!==s.header.type||h.recordNumber!==s.currentIndex)i.rewind(8);else{i.rewind(4);const t=n(i.getDataView(h.byteLength),a);s.geometries.push(t),s.currentIndex++,s.progress.rows=s.currentIndex-1}}return i.ended&&(t=m),t;default:return t=y,s.error="illegal parser state "+t,t}}catch(i){return t=y,s.error="SHP parsing failed: "+(null==i?void 0:i.message),t}}const v=[0,0,39,10],x={name:"SHP",id:"shp",module:"shapefile",version:"3.1.0-alpha.4",worker:!0,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(v).buffer],options:{shp:{_maxDimensions:4}}},w={...x,parse:async(t,s)=>_(t,s),parseSync:_,parseInBatches:async function*(t,s){const i=new g(s);let a=!1;for await(const s of t)i.write(s),!a&&i.result.header&&(a=!0,yield i.result.header),i.result.geometries.length>0&&(yield i.result.geometries,i.result.geometries=[]);i.end(),i.result.geometries.length>0&&(yield i.result.geometries)}};function S(t,s,i){switch(t.type){case"Point":return function(t,s,i){const{positions:a}=t,e=E(a,s,i);if(e.length>1)return{type:"MultiPoint",coordinates:e};return{type:"Point",coordinates:e[0]}}(t,s,i);case"LineString":return function(t,s=-1/0,i=1/0){const{positions:a}=t,e=t.pathIndices.value.filter(t=>t>=s&&t<=i);if(!(e.length>2)){return{type:"LineString",coordinates:E(a,e[0],e[1])}}const h=[];for(let t=0;t<e.length-1;t++){const s=E(a,e[t],e[t+1]);h.push(s)}return{type:"MultiLineString",coordinates:h}}(t,s,i);case"Polygon":return function t(s,i=-1/0,a=1/0){const{positions:e}=s,h=s.polygonIndices.value.filter(t=>t>=i&&t<=a),n=s.primitivePolygonIndices.value.filter(t=>t>=i&&t<=a);if(!(h.length>2)){const t=[];for(let s=0;s<n.length-1;s++){const i=n[s],a=n[s+1],h=E(e,i,a);t.push(h)}return{type:"Polygon",coordinates:t}}const r=[];for(let i=0;i<h.length-1;i++){const a=h[i],e=h[i+1],n=t(s,a,e).coordinates;r.push(n)}return{type:"MultiPolygon",coordinates:r}}(t,s,i);default:const a=t;throw new Error("Unsupported geometry type: "+(null==a?void 0:a.type))}}function E(t,s,i){s=s||0,i=i||t.value.length/t.size;const a=[];for(let e=s;e<i;e++){const s=Array();for(let i=e*t.size;i<(e+1)*t.size;i++)s.push(Number(t.value[i]));a.push(s)}return a}function I(t,s){return function(t){return Number.isFinite(t[0])&&Number.isFinite(t[1])}(t)?s(t):t.map(t=>I(t,s))}var P=484813681109536e-20,N=Math.PI/2,C=.017453292519943295,T=57.29577951308232,O=Math.PI/4,A=2*Math.PI,k=3.14159265359,R={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},L={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},q=/[\s_\-\/\(\)]/g;function D(t,s){if(t[s])return t[s];for(var i,a=Object.keys(t),e=s.toLowerCase().replace(q,""),h=-1;++h<a.length;)if((i=a[h]).toLowerCase().replace(q,"")===e)return t[i]}var j=function(t){var s,i,a,e={},h=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}),{}),n={proj:"projName",datum:"datumCode",rf:function(t){e.rf=parseFloat(t)},lat_0:function(t){e.lat0=t*C},lat_1:function(t){e.lat1=t*C},lat_2:function(t){e.lat2=t*C},lat_ts:function(t){e.lat_ts=t*C},lon_0:function(t){e.long0=t*C},lon_1:function(t){e.long1=t*C},lon_2:function(t){e.long2=t*C},alpha:function(t){e.alpha=parseFloat(t)*C},lonc:function(t){e.longc=t*C},x_0:function(t){e.x0=parseFloat(t)},y_0:function(t){e.y0=parseFloat(t)},k_0:function(t){e.k0=parseFloat(t)},k:function(t){e.k0=parseFloat(t)},a:function(t){e.a=parseFloat(t)},b:function(t){e.b=parseFloat(t)},r_a:function(){e.R_A=!0},zone:function(t){e.zone=parseInt(t,10)},south:function(){e.utmSouth=!0},towgs84:function(t){e.datum_params=t.split(",").map((function(t){return parseFloat(t)}))},to_meter:function(t){e.to_meter=parseFloat(t)},units:function(t){e.units=t;var s=D(L,t);s&&(e.to_meter=s.to_meter)},from_greenwich:function(t){e.from_greenwich=t*C},pm:function(t){var s=D(R,t);e.from_greenwich=(s||parseFloat(t))*C},nadgrids:function(t){"@null"===t?e.datumCode="none":e.nadgrids=t},axis:function(t){3===t.length&&-1!=="ewnsud".indexOf(t.substr(0,1))&&-1!=="ewnsud".indexOf(t.substr(1,1))&&-1!=="ewnsud".indexOf(t.substr(2,1))&&(e.axis=t)}};for(s in h)i=h[s],s in n?"function"==typeof(a=n[s])?a(i):e[a]=i:e[s]=i;return"string"==typeof e.datumCode&&"WGS84"!==e.datumCode&&(e.datumCode=e.datumCode.toLowerCase()),e},B=function(t){return new Q(t).output()},z=/\s/,G=/[A-Za-z]/,F=/[A-Za-z84]/,U=/[,\]]/,W=/[\d\.E\-\+]/;function Q(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 H(t,s,i){Array.isArray(s)&&(i.unshift(s),s=null);var a=s?{}:t,e=i.reduce((function(t,s){return X(s,t),t}),a);s&&(t[s]=e)}function X(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 X(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&&X(t[2],s[i]));case"SPHEROID":case"ELLIPSOID":return s[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&X(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 H(s,i,t);default:for(a=-1;++a<t.length;)if(!Array.isArray(t[a]))return X(t,s[i]);return H(s,i,t)}}else s[i]=t;else s[i]=!0}else s[t]=!0}Q.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;z.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}},Q.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(U.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)},Q.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},Q.prototype.number=function(t){if(!W.test(t)){if(U.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},Q.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Q.prototype.keyword=function(t){if(F.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(!U.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Q.prototype.neutral=function(t){if(G.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(W.test(t))return this.word=t,void(this.state=3);if(!U.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},Q.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 V(t){return.017453292519943295*t}var Y=function(t){var s=B(t),i=s.shift(),a=s.shift();s.unshift(["name",a]),s.unshift(["type",i]);var e={};return X(s,e),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 e=t.AXIS[i][0].toLowerCase();-1!==e.indexOf("north")?s+="n":-1!==e.indexOf("south")?s+="s":-1!==e.indexOf("east")?s+="e":-1!==e.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 h=t.GEOGCS;function n(s){return s*(t.to_meter||1)}"GEOGCS"===t.type&&(h=t),h&&(h.DATUM?t.datumCode=h.DATUM.name.toLowerCase():t.datumCode=h.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"),h.DATUM&&h.DATUM.SPHEROID&&(t.ellps=h.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=h.DATUM.SPHEROID.a,t.rf=parseFloat(h.DATUM.SPHEROID.rf,10)),h.DATUM&&h.DATUM.TOWGS84&&(t.datum_params=h.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",V],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",V],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",V],["lat0","latitude_of_origin",V],["lat0","standard_parallel_1",V],["lat1","standard_parallel_1",V],["lat2","standard_parallel_2",V],["azimuth","Azimuth"],["alpha","azimuth",V],["srsCode","name"]].forEach((function(s){return i=t,e=(a=s)[0],h=a[1],void(!(e in i)&&h in i&&(i[e]=i[h],3===a.length&&(i[e]=a[2](i[e]))));var i,a,e,h})),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=V(t.lat1>0?90:-90),t.lat_ts=t.lat1)}(e),e};function J(t){var s=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?J[t]=j(arguments[1]):J[t]=Y(arguments[1]):J[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map((function(t){Array.isArray(t)?J.apply(s,t):J(t)}));if("string"==typeof t){if(t in J)return J[t]}else"EPSG"in t?J["EPSG:"+t.EPSG]=t:"ESRI"in t?J["ESRI:"+t.ESRI]=t:"IAU2000"in t?J["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"]}(J);var K=J;var Z=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var $=["3857","900913","3785","102113"];var tt=function(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in K}(t))return K[t];if(function(t){return Z.some((function(s){return t.indexOf(s)>-1}))}(t)){var s=Y(t);if(function(t){var s=D(t,"authority");if(s){var i=D(s,"epsg");return i&&$.indexOf(i)>-1}}(s))return K["EPSG:3857"];var i=function(t){var s=D(t,"extension");if(s)return D(s,"proj4")}(s);return i?j(i):s}return function(t){return"+"===t[0]}(t)?j(t):void 0},st=function(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},it=function(t,s,i){var a=t*s;return i/Math.sqrt(1-a*a)},at=function(t){return t<0?-1:1},et=function(t){return Math.abs(t)<=k?t:t-at(t)*A},ht=function(t,s,i){var a=t*i,e=.5*t;return a=Math.pow((1-a)/(1+a),e),Math.tan(.5*(N-s))/a},nt=function(t,s){for(var i,a,e=.5*t,h=N-2*Math.atan(s),n=0;n<=15;n++)if(i=t*Math.sin(h),h+=a=N-2*Math.atan(s*Math.pow((1-i)/(1+i),e))-h,Math.abs(a)<=1e-10)return h;return-9999};function rt(t){return t}var ot=[{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=it(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,e=t.y;if(e*T>90&&e*T<-90&&a*T>180&&a*T<-180)return null;if(Math.abs(Math.abs(e)-N)<=1e-10)return null;if(this.sphere)s=this.x0+this.a*this.k0*et(a-this.long0),i=this.y0+this.a*this.k0*Math.log(Math.tan(O+.5*e));else{var h=Math.sin(e),n=ht(this.e,e,h);s=this.x0+this.a*this.k0*et(a-this.long0),i=this.y0-this.a*this.k0*Math.log(n)}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=N-2*Math.atan(Math.exp(-e/(this.a*this.k0)));else{var h=Math.exp(-e/(this.a*this.k0));if(-9999===(i=nt(this.e,h)))return null}return s=et(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:rt,inverse:rt,names:["longlat","identity"]}],lt={},ct=[];function ut(t,s){var i=ct.length;return t.names?(ct[i]=t,t.names.forEach((function(t){lt[t.toLowerCase()]=i})),this):(console.log(s),!0)}var ft={start:function(){ot.forEach(ut)},add:ut,get:function(t){if(!t)return!1;var s=t.toLowerCase();return void 0!==lt[s]&&ct[lt[s]]?ct[lt[s]]:void 0}},Mt={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"}},dt=Mt.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Mt.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var pt={};pt.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},pt.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},pt.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},pt.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},pt.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},pt.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},pt.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},pt.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},pt.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},pt.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},pt.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},pt.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},pt.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},pt.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},pt.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},pt.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},pt.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var mt=function(t,s,i,a,e,h){var n={};return n.datum_type=void 0===t||"none"===t?5:4,s&&(n.datum_params=s.map(parseFloat),0===n.datum_params[0]&&0===n.datum_params[1]&&0===n.datum_params[2]||(n.datum_type=1),n.datum_params.length>3&&(0===n.datum_params[3]&&0===n.datum_params[4]&&0===n.datum_params[5]&&0===n.datum_params[6]||(n.datum_type=2,n.datum_params[3]*=P,n.datum_params[4]*=P,n.datum_params[5]*=P,n.datum_params[6]=n.datum_params[6]/1e6+1))),n.a=i,n.b=a,n.es=e,n.ep2=h,n};function yt(t,s){if(!(this instanceof yt))return new yt(t);s=s||function(t){if(t)throw t};var i=tt(t);if("object"==typeof i){var a=yt.projections.get(i.projName);if(a){if(i.datumCode&&"none"!==i.datumCode){var e=D(pt,i.datumCode);e&&(i.datum_params=e.towgs84?e.towgs84.split(","):null,i.ellps=e.ellipse,i.datumName=e.datumName?e.datumName:i.datumCode)}i.k0=i.k0||1,i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84";var h,n,r,o,l,c,u,f=function(t,s,i,a,e){if(!t){var h=D(Mt,a);h||(h=dt),t=h.a,s=h.b,i=h.rf}return i&&!s&&(s=(1-1/i)*t),(0===i||Math.abs(t-s)<1e-10)&&(e=!0,s=t),{a:t,b:s,rf:i,sphere:e}}(i.a,i.b,i.rf,i.ellps,i.sphere),M=(h=f.a,n=f.b,f.rf,r=i.R_A,c=((o=h*h)-(l=n*n))/o,u=0,r?(o=(h*=1-c*(.16666666666666666+c*(.04722222222222222+.022156084656084655*c)))*h,c=0):u=Math.sqrt(c),{es:c,e:u,ep2:(o-l)/l}),d=i.datum||mt(i.datumCode,i.datum_params,f.a,f.b,M.es,M.ep2);st(this,i),st(this,a),this.a=f.a,this.b=f.b,this.rf=f.rf,this.sphere=f.sphere,this.es=M.es,this.e=M.e,this.ep2=M.ep2,this.datum=d,this.init(),s(null,this)}else s(t)}else s(t)}yt.projections=ft,yt.projections.start();var gt=yt;function _t(t,s,i){var a,e,h,n,r=t.x,o=t.y,l=t.z?t.z:0;if(o<-N&&o>-1.001*N)o=-N;else if(o>N&&o<1.001*N)o=N;else{if(o<-N)return{x:-1/0,y:-1/0,z:t.z};if(o>N)return{x:1/0,y:1/0,z:t.z}}return r>Math.PI&&(r-=2*Math.PI),e=Math.sin(o),n=Math.cos(o),h=e*e,{x:((a=i/Math.sqrt(1-s*h))+l)*n*Math.cos(r),y:(a+l)*n*Math.sin(r),z:(a*(1-s)+l)*e}}function bt(t,s,i,a){var e,h,n,r,o,l,c,u,f,M,d,p,m,y,g,_=t.x,b=t.y,v=t.z?t.z:0;if(e=Math.sqrt(_*_+b*b),h=Math.sqrt(_*_+b*b+v*v),e/i<1e-12){if(y=0,h/i<1e-12)return N,g=-a,{x:t.x,y:t.y,z:t.z}}else y=Math.atan2(b,_);n=v/h,u=(r=e/h)*(1-s)*(o=1/Math.sqrt(1-s*(2-s)*r*r)),f=n*o,m=0;do{m++,l=s*(c=i/Math.sqrt(1-s*f*f))/(c+(g=e*u+v*f-c*(1-s*f*f))),p=(d=n*(o=1/Math.sqrt(1-l*(2-l)*r*r)))*u-(M=r*(1-l)*o)*f,u=M,f=d}while(p*p>1e-24&&m<30);return{x:y,y:Math.atan(d/Math.abs(M)),z:g}}function vt(t){return 1===t||2===t}var xt=function(t,s,i){return 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,s)||5===t.datum_type||5===s.datum_type?i:t.es!==s.es||t.a!==s.a||vt(t.datum_type)||vt(s.datum_type)?(i=_t(i,t.es,t.a),vt(t.datum_type)&&(i=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],e=i[1],h=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)+e,z:l*(-r*t.x+n*t.y+t.z)+h}}}(i,t.datum_type,t.datum_params)),vt(s.datum_type)&&(i=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],e=i[1],h=i[2],n=i[3],r=i[4],o=i[5],l=i[6],c=(t.x-a)/l,u=(t.y-e)/l,f=(t.z-h)/l;return{x:c+o*u-r*f,y:-o*c+u+n*f,z:r*c-n*u+f}}}(i,s.datum_type,s.datum_params)),bt(i,s.es,s.a,s.b)):i},wt=function(t,s,i){var a,e,h,n=i.x,r=i.y,o=i.z||0,l={};for(h=0;h<3;h++)if(!s||2!==h||void 0!==i.z)switch(0===h?(a=n,e=-1!=="ew".indexOf(t.axis[h])?"x":"y"):1===h?(a=r,e=-1!=="ns".indexOf(t.axis[h])?"y":"x"):(a=o,e="z"),t.axis[h]){case"e":case"w":case"n":case"s":l[e]=a;break;case"u":void 0!==i[e]&&(l.z=a);break;case"d":void 0!==i[e]&&(l.z=-a);break;default:return null}return l},St=function(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 Et(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 It(t,s,i){var a;if(Array.isArray(i)&&(i=St(i)),function(t){Et(t.x),Et(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=It(t,a=new gt("WGS84"),i),t=a),"enu"!==t.axis&&(i=wt(t,!1,i)),"longlat"===t.projName)i={x:i.x*C,y:i.y*C,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;return t.from_greenwich&&(i.x+=t.from_greenwich),i=xt(t.datum,s.datum,i),s.from_greenwich&&(i={x:i.x-s.from_greenwich,y:i.y,z:i.z||0}),"longlat"===s.projName?i={x:i.x*T,y:i.y*T,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?wt(s,!0,i):i}var Pt=gt("WGS84");function Nt(t,s,i){var a,e,h;return Array.isArray(i)?(a=It(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]):(e=It(t,s,i),2===(h=Object.keys(i)).length||h.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;e[a]=i[a]})),e)}function Ct(t){return t instanceof gt?t:t.oProj?t.oProj:gt(t)}var Tt=function(t,s,i){t=Ct(t);var a,e=!1;return void 0===s?(s=t,t=Pt,e=!0):(void 0!==s.x||Array.isArray(s))&&(i=s,s=t,t=Pt,e=!0),s=Ct(s),i?Nt(t,s,i):(a={forward:function(i){return Nt(t,s,i)},inverse:function(i){return Nt(s,t,i)}},e&&(a.oProj=s),a)},Ot=73,At=79,kt={forward:Rt,inverse:function(t){var s=jt(Gt(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:Lt};function Rt(t,s){return s=s||5,function(t,s){var i="00000"+t.easting,a="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(M=t.easting,d=t.northing,p=t.zoneNumber,m=zt(p),y=Math.floor(M/1e5),g=Math.floor(d/1e5)%20,e=y,h=g,n=m,r=n-1,o="AJSAJS".charCodeAt(r),l="AFAFAF".charCodeAt(r),c=o+e-1,u=l+h,f=!1,c>90&&(c=c-90+65-1,f=!0),(c===Ot||o<Ot&&c>Ot||(c>Ot||o<Ot)&&f)&&c++,(c===At||o<At&&c>At||(c>At||o<At)&&f)&&++c===Ot&&c++,c>90&&(c=c-90+65-1),u>86?(u=u-86+65-1,f=!0):f=!1,(u===Ot||l<Ot&&u>Ot||(u>Ot||l<Ot)&&f)&&u++,(u===At||l<At&&u>At||(u>At||l<At)&&f)&&++u===Ot&&u++,u>86&&(u=u-86+65-1),String.fromCharCode(c)+String.fromCharCode(u))+i.substr(i.length-5,s)+a.substr(a.length-5,s);var e,h,n,r,o,l,c,u,f;var M,d,p,m,y,g}(function(t){var s,i,a,e,h,n,r,o=t.lat,l=t.lon,c=6378137,u=qt(o),f=qt(l);r=Math.floor((l+180)/6)+1,180===l&&(r=60);o>=56&&o<64&&l>=3&&l<12&&(r=32);o>=72&&o<84&&(l>=0&&l<9?r=31:l>=9&&l<21?r=33:l>=21&&l<33?r=35:l>=33&&l<42&&(r=37));n=qt(6*(r-1)-180+3),.006739496752268451,s=c/Math.sqrt(1-.00669438*Math.sin(u)*Math.sin(u)),i=Math.tan(u)*Math.tan(u),a=.006739496752268451*Math.cos(u)*Math.cos(u),e=Math.cos(u)*(f-n),h=c*(.9983242984503243*u-.002514607064228144*Math.sin(2*u)+2639046602129982e-21*Math.sin(4*u)-3.418046101696858e-9*Math.sin(6*u));var M=.9996*s*(e+(1-i+a)*e*e*e/6+(5-18*i+i*i+72*a-.39089081163157013)*e*e*e*e*e/120)+5e5,d=.9996*(h+s*Math.tan(u)*(e*e/2+(5-i+9*a+4*a*a)*e*e*e*e/24+(61-58*i+i*i+600*a-2.2240339282485886)*e*e*e*e*e*e/720));o<0&&(d+=1e7);return{northing:Math.round(d),easting:Math.round(M),zoneNumber:r,zoneLetter:Bt(o)}}({lat:t[1],lon:t[0]}),s)}function Lt(t){var s=jt(Gt(t.toUpperCase()));return s.lat&&s.lon?[s.lon,s.lat]:[(s.left+s.right)/2,(s.top+s.bottom)/2]}function qt(t){return t*(Math.PI/180)}function Dt(t){return t/Math.PI*180}function jt(t){var s=t.northing,i=t.easting,a=t.zoneLetter,e=t.zoneNumber;if(e<0||e>60)return null;var h,n,r,o,l,c,u,f,M=6378137,d=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),p=i-5e5,m=s;a<"N"&&(m-=1e7),c=6*(e-1)-180+3,f=(u=m/.9996/6367449.145945056)+(3*d/2-27*d*d*d/32)*Math.sin(2*u)+(21*d*d/16-55*d*d*d*d/32)*Math.sin(4*u)+151*d*d*d/96*Math.sin(6*u),h=M/Math.sqrt(1-.00669438*Math.sin(f)*Math.sin(f)),n=Math.tan(f)*Math.tan(f),r=.006739496752268451*Math.cos(f)*Math.cos(f),o=.99330562*M/Math.pow(1-.00669438*Math.sin(f)*Math.sin(f),1.5),l=p/(.9996*h);var y=f-h*Math.tan(f)/o*(l*l/2-(5+3*n+10*r-4*r*r-.06065547077041606)*l*l*l*l/24+(61+90*n+298*r+45*n*n-1.6983531815716497-3*r*r)*l*l*l*l*l*l/720);y=Dt(y);var g,_=(l-(1+2*n+r)*l*l*l/6+(5-2*r+28*n-3*r*r+.05391597401814761+24*n*n)*l*l*l*l*l/120)/Math.cos(f);if(_=c+Dt(_),t.accuracy){var b=jt({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});g={top:b.lat,right:b.lon,bottom:y,left:_}}else g={lat:y,lon:_};return g}function Bt(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 zt(t){var s=t%6;return 0===s&&(s=6),s}function Gt(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var s,i=t.length,a=null,e="",h=0;!/[A-Z]/.test(s=t.charAt(h));){if(h>=2)throw"MGRSPoint bad conversion from: "+t;e+=s,h++}var n=parseInt(e,10);if(0===h||h+3>i)throw"MGRSPoint bad conversion from: "+t;var r=t.charAt(h++);if(r<="A"||"B"===r||"Y"===r||r>="Z"||"I"===r||"O"===r)throw"MGRSPoint zone letter "+r+" not handled: "+t;a=t.substring(h,h+=2);for(var o=zt(n),l=function(t,s){var i="AJSAJS".charCodeAt(s-1),a=1e5,e=!1;for(;i!==t.charCodeAt(0);){if(++i===Ot&&i++,i===At&&i++,i>90){if(e)throw"Bad character: "+t;i=65,e=!0}a+=1e5}return a}(a.charAt(0),o),c=function(t,s){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i="AFAFAF".charCodeAt(s-1),a=0,e=!1;for(;i!==t.charCodeAt(0);){if(++i===Ot&&i++,i===At&&i++,i>86){if(e)throw"Bad character: "+t;i=65,e=!0}a+=1e5}return a}(a.charAt(1),o);c<Ft(r);)c+=2e6;var u=i-h;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 f,M,d,p=u/2,m=0,y=0;return p>0&&(f=1e5/Math.pow(10,p),M=t.substring(h,h+p),m=parseFloat(M)*f,d=t.substring(h+p),y=parseFloat(d)*f),{easting:m+l,northing:y+c,zoneLetter:r,zoneNumber:n,accuracy:f}}function Ft(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 Ut(t,s,i){if(!(this instanceof Ut))return new Ut(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")}Ut.fromMGRS=function(t){return new Ut(Lt(t))},Ut.prototype.toMGRS=function(t){return Rt([this.x,this.y],t)};var Wt=Ut,Qt=.01068115234375,Ht=function(t){var s=[];s[0]=1-t*(.25+t*(.046875+t*(.01953125+t*Qt))),s[1]=t*(.75-t*(.046875+t*(.01953125+t*Qt)));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},Xt=function(t,s,i,a){return i*=s,s*=s,a[0]*t-i*(a[1]+s*(a[2]+s*(a[3]+s*a[4])))},Vt=function(t,s,i){for(var a=1/(1-s),e=t,h=20;h;--h){var n=Math.sin(e),r=1-s*n*n;if(e-=r=(Xt(e,n,Math.cos(e),i)-t)*(r*Math.sqrt(r))*a,Math.abs(r)<1e-10)return e}return e};var Yt={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=Ht(this.es),this.ml0=Xt(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var s,i,a,e=t.x,h=t.y,n=et(e-this.long0),r=Math.sin(h),o=Math.cos(h);if(this.es){var l=o*n,c=Math.pow(l,2),u=this.ep2*Math.pow(o,2),f=Math.pow(u,2),M=Math.abs(o)>1e-10?Math.tan(h):0,d=Math.pow(M,2),p=Math.pow(d,2);s=1-this.es*Math.pow(r,2),l/=Math.sqrt(s);var m=Xt(h,r,o,this.en);i=this.a*(this.k0*l*(1+c/6*(1-d+u+c/20*(5-18*d+p+14*u-58*d*u+c/42*(61+179*p-p*d-479*d)))))+this.x0,a=this.a*(this.k0*(m-this.ml0+r*n*l/2*(1+c/12*(5-d+9*u+4*f+c/30*(61+p-58*d+270*u-330*d*u+c/56*(1385+543*p-p*d-3111*d))))))+this.y0}else{var y=o*Math.sin(n);if(Math.abs(Math.abs(y)-1)<1e-10)return 93;if(i=.5*this.a*this.k0*Math.log((1+y)/(1-y))+this.x0,a=o*Math.cos(n)/Math.sqrt(1-Math.pow(y,2)),(y=Math.abs(a))>=1){if(y-1>1e-10)return 93;a=0}else a=Math.acos(a);h<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,e,h=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(this.es)if(s=this.ml0+n/this.k0,i=Vt(s,this.es,this.en),Math.abs(i)<N){var r=Math.sin(i),o=Math.cos(i),l=Math.abs(o)>1e-10?Math.tan(i):0,c=this.ep2*Math.pow(o,2),u=Math.pow(c,2),f=Math.pow(l,2),M=Math.pow(f,2);s=1-this.es*Math.pow(r,2);var d=h*Math.sqrt(s)/this.k0,p=Math.pow(d,2);a=i-(s*=l)*p/(1-this.es)*.5*(1-p/12*(5+3*f-9*c*f+c-4*u-p/30*(61+90*f-252*c*f+45*M+46*c-p/56*(1385+3633*f+4095*M+1574*M*f)))),e=et(this.long0+d*(1-p/6*(1+2*f+c-p/20*(5+28*f+24*M+8*c*f+6*c-p/42*(61+662*f+1320*M+720*M*f))))/o)}else a=N*at(n),e=0;else{var m=Math.exp(h/this.k0),y=.5*(m-1/m),g=this.lat0+n/this.k0,_=Math.cos(g);s=Math.sqrt((1-Math.pow(_,2))/(1+Math.pow(y,2))),a=Math.asin(s),n<0&&(a=-a),e=0===y&&0===_?0:et(Math.atan2(y,_)+this.long0)}return t.x=e,t.y=a,t},names:["Transverse_Mercator","Transverse Mercator","tmerc"]},Jt=function(t){var s=Math.exp(t);return s=(s-1/s)/2},Kt=function(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))},Zt=function(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/(Kt(1,s)+1))),t<0?-s:s},$t=function(t,s){for(var i,a=2*Math.cos(2*s),e=t.length-1,h=t[e],n=0;--e>=0;)i=a*h-n+t[e],n=h,h=i;return s+i*Math.sin(2*s)},ts=function(t,s,i){for(var a,e,h=Math.sin(s),n=Math.cos(s),r=Jt(i),o=function(t){var s=Math.exp(t);return s=(s+1/s)/2}(i),l=2*n*o,c=-2*h*r,u=t.length-1,f=t[u],M=0,d=0,p=0;--u>=0;)a=d,e=M,f=l*(d=f)-a-c*(M=p)+t[u],p=c*d-e+l*M;return[(l=h*o)*f-(c=n*r)*p,l*p+c*f]};var ss={init:function(){if(void 0===this.es||this.es<=0)throw new Error("incorrect elliptical usage");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=$t(this.cbg,this.lat0);this.Zb=-this.Qn*(a+function(t,s){for(var i,a=2*Math.cos(s),e=t.length-1,h=t[e],n=0;--e>=0;)i=a*h-n+t[e],n=h,h=i;return Math.sin(s)*i}(this.gtu,2*a))},forward:function(t){var s=et(t.x-this.long0),i=t.y;i=$t(this.cbg,i);var a=Math.sin(i),e=Math.cos(i),h=Math.sin(s),n=Math.cos(s);i=Math.atan2(a,n*e),s=Math.atan2(h*e,Kt(a,e*n)),s=Zt(Math.tan(s));var r,o,l=ts(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),e=(t.y-this.y0)*(1/this.a);if(e=(e-this.Zb)/this.Qn,a/=this.Qn,Math.abs(a)<=2.623395162778){var h=ts(this.utg,2*e,2*a);e+=h[0],a+=h[1],a=Math.atan(Jt(a));var n=Math.sin(e),r=Math.cos(e),o=Math.sin(a),l=Math.cos(a);e=Math.atan2(n*l,Kt(o,l*r)),a=Math.atan2(o,l*r),s=et(a+this.long0),i=$t(this.cgb,e)}else s=1/0,i=1/0;return t.x=s,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"]};var is={init:function(){var t=function(t,s){if(void 0===t){if((t=Math.floor(30*(et(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)*C,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ss.init.apply(this),this.forward=ss.forward,this.inverse=ss.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"},as=function(t,s){return Math.pow((1-t)/(1+t),s)};var es={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)*as(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)*as(this.e*Math.sin(i),this.ratexp))-N,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*as(this.e*Math.sin(t.y),-.5*this.e))-N,!(Math.abs(i-t.y)<1e-14));--e)t.y=i;return e?(t.x=s,t.y=i,t):null},names:["gauss"]};var hs={init:function(){es.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,e;return t.x=et(t.x-this.long0),es.forward.apply(this,[t]),s=Math.sin(t.y),i=Math.cos(t.y),a=Math.cos(t.x),e=this.k0*this.R2/(1+this.sinc0*s+this.cosc0*i*a),t.x=e*i*Math.sin(t.x),t.y=e*(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,e,h;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,h=Math.sqrt(t.x*t.x+t.y*t.y)){var n=2*Math.atan2(h,this.R2);s=Math.sin(n),i=Math.cos(n),e=Math.asin(i*this.sinc0+t.y*s*this.cosc0/h),a=Math.atan2(t.x*s,h*this.cosc0*i-t.y*this.sinc0*s)}else e=this.phic0,a=0;return t.x=a,t.y=e,es.inverse.apply(this,[t]),t.x=et(t.x+this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};var ns={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)<=1e-10&&(this.k0=.5*(1+at(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=1e-10&&(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)<=1e-10&&(this.k0=.5*this.cons*it(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/ht(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=it(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-N,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var s,i,a,e,h,n,r=t.x,o=t.y,l=Math.sin(o),c=Math.cos(o),u=et(r-this.long0);return Math.abs(Math.abs(r-this.long0)-Math.PI)<=1e-10&&Math.abs(o+this.lat0)<=1e-10?(t.x=NaN,t.y=NaN,t):this.sphere?(s=2*this.k0/(1+this.sinlat0*l+this.coslat0*c*Math.cos(u)),t.x=this.a*s*c*Math.sin(u)+this.x0,t.y=this.a*s*(this.coslat0*l-this.sinlat0*c*Math.cos(u))+this.y0,t):(i=2*Math.atan(this.ssfn_(o,l,this.e))-N,e=Math.cos(i),a=Math.sin(i),Math.abs(this.coslat0)<=1e-10?(h=ht(this.e,o*this.con,this.con*l),n=2*this.a*this.k0*h/this.cons,t.x=this.x0+n*Math.sin(r-this.long0),t.y=this.y0-this.con*n*Math.cos(r-this.long0),t):(Math.abs(this.sinlat0)<1e-10?(s=2*this.a*this.k0/(1+e*Math.cos(u)),t.y=s*a):(s=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*e*Math.cos(u))),t.y=s*(this.cosX0*a-this.sinX0*e*Math.cos(u))+this.y0),t.x=s*e*Math.sin(u)+this.x0,t))},inverse:function(t){var s,i,a,e,h;t.x-=this.x0,t.y-=this.y0;var n=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var r=2*Math.atan(n/(2*this.a*this.k0));return s=this.long0,i=this.lat0,n<=1e-10?(t.x=s,t.y=i,t):(i=Math.asin(Math.cos(r)*this.sinlat0+t.y*Math.sin(r)*this.coslat0/n),s=Math.abs(this.coslat0)<1e-10?this.lat0>0?et(this.long0+Math.atan2(t.x,-1*t.y)):et(this.long0+Math.atan2(t.x,t.y)):et(this.long0+Math.atan2(t.x*Math.sin(r),n*this.coslat0*Math.cos(r)-t.y*this.sinlat0*Math.sin(r))),t.x=s,t.y=i,t)}if(Math.abs(this.coslat0)<=1e-10){if(n<=1e-10)return i=this.lat0,s=this.long0,t.x=s,t.y=i,t;t.x*=this.con,t.y*=this.con,a=n*this.cons/(2*this.a*this.k0),i=this.con*nt(this.e,a),s=this.con*et(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else e=2*Math.atan(n*this.cosX0/(2*this.a*this.k0*this.ms1)),s=this.long0,n<=1e-10?h=this.X0:(h=Math.asin(Math.cos(e)*this.sinX0+t.y*Math.sin(e)*this.cosX0/n),s=et(this.long0+Math.atan2(t.x*Math.sin(e),n*this.cosX0*Math.cos(e)-t.y*this.sinX0*Math.sin(e)))),i=-1*nt(this.e,Math.tan(.5*(N+h)));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*(N+t))*Math.pow((1-s)/(1+s),.5*i)}};var rs={init:function(){var t=this.lat0;this.lambda0=this.long0;var s=Math.sin(t),i=this.a,a=1/this.rf,e=2*a-Math.pow(a,2),h=this.e=Math.sqrt(e);this.R=this.k0*i*Math.sqrt(1-e)/(1-e*Math.pow(s,2)),this.alpha=Math.sqrt(1+e/(1-e)*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+h*s)/(1-h*s));this.K=n-this.alpha*r+this.alpha*h/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,e=2*(Math.atan(Math.exp(a))-Math.PI/4),h=this.alpha*(t.x-this.lambda0),n=Math.atan(Math.sin(h)/(Math.sin(this.b0)*Math.tan(e)+Math.cos(this.b0)*Math.cos(h))),r=Math.asin(Math.cos(this.b0)*Math.sin(e)-Math.sin(this.b0)*Math.cos(e)*Math.cos(h));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,e=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),h=Math.asin(Math.cos(this.b0)*Math.sin(e)+Math.sin(this.b0)*Math.cos(e)*Math.cos(a)),n=Math.atan(Math.sin(a)/(Math.cos(this.b0)*Math.cos(a)-Math.sin(this.b0)*Math.tan(e))),r=this.lambda0+n/this.alpha,o=0,l=h,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+h/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"]};var os={init:function(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),s=Math.cos(this.lat0),i=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(s,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-i*i);var a,e,h=ht(this.e,this.lat0,t),n=this.bl/s*Math.sqrt((1-this.es)/(1-i*i));if(n*n<1&&(n=1),isNaN(this.longc)){var r=ht(this.e,this.lat1,Math.sin(this.lat1)),o=ht(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(n+Math.sqrt(n*n-1))*Math.pow(h,this.bl):this.el=(n-Math.sqrt(n*n-1))*Math.pow(h,this.bl);var l=Math.pow(r,this.bl),c=Math.pow(o,this.bl);e=.5*((a=this.el/l)-1/a);var u=(this.el*this.el-c*l)/(this.el*this.el+c*l),f=(c-l)/(c+l),M=et(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(u*Math.tan(.5*this.bl*M)/f)/this.bl,this.long0=et(this.long0);var d=et(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*d)/e),this.alpha=Math.asin(n*Math.sin(this.gamma0))}else a=this.lat0>=0?n+Math.sqrt(n*n-1):n-Math.sqrt(n*n-1),this.el=a*Math.pow(h,this.bl),e=.5*(a-1/a),this.gamma0=Math.asin(Math.sin(this.alpha)/n),this.long0=this.longc-Math.asin(e*Math.tan(this.gamma0))/this.bl;this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha))},forward:function(t){var s,i,a,e=t.x,h=t.y,n=et(e-this.long0);if(Math.abs(Math.abs(h)-N)<=1e-10)a=h>0?-1:1,i=this.al/this.bl*Math.log(Math.tan(O+a*this.gamma0*.5)),s=-1*a*N*this.al/this.bl;else{var r=ht(this.e,h,Math.sin(h)),o=this.el/Math.pow(r,this.bl),l=.5*(o-1/o),c=.5*(o+1/o),u=Math.sin(this.bl*n),f=(l*Math.sin(this.gamma0)-u*Math.cos(this.gamma0))/c;i=Math.abs(Math.abs(f)-1)<=1e-10?Number.POSITIVE_INFINITY:.5*this.al*Math.log((1-f)/(1+f))/this.bl,s=Math.abs(Math.cos(this.bl*n))<=1e-10?this.al*this.bl*n:this.al*Math.atan2(l*Math.cos(this.gamma0)+u*Math.sin(this.gamma0),Math.cos(this.bl*n))/this.bl}return this.no_rot?(t.x=this.x0+s,t.y=this.y0+i):(s-=this.uc,t.x=this.x0+i*Math.cos(this.alpha)+s*Math.sin(this.alpha),t.y=this.y0+s*Math.cos(this.alpha)-i*Math.sin(this.alpha)),t},inverse:function(t){var s,i;this.no_rot?(i=t.y-this.y0,s=t.x-this.x0):(i=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),s=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),s+=this.uc);var a=Math.exp(-1*this.bl*i/this.al),e=.5*(a-1/a),h=.5*(a+1/a),n=Math.sin(this.bl*s/this.al),r=(n*Math.cos(this.gamma0)+e*Math.sin(this.gamma0))/h,o=Math.pow(this.el/Math.sqrt((1+r)/(1-r)),1/this.bl);return Math.abs(r-1)<1e-10?(t.x=this.long0,t.y=N):Math.abs(r+1)<1e-10?(t.x=this.long0,t.y=-1*N):(t.y=nt(this.e,o),t.x=et(this.long0-Math.atan2(e*Math.cos(this.gamma0)-n*Math.sin(this.gamma0),Math.cos(this.bl*s/this.al))/this.bl)),t},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"]};var ls={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)<1e-10)){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=it(this.e,s,i),e=ht(this.e,this.lat1,s),h=Math.sin(this.lat2),n=Math.cos(this.lat2),r=it(this.e,h,n),o=ht(this.e,this.lat2,h),l=ht(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>1e-10?this.ns=Math.log(a/r)/Math.log(e/o):this.ns=s,isNaN(this.ns)&&(this.ns=s),this.f0=a/(this.ns*Math.pow(e,this.ns)),this.rh=this.a*this.f0*Math.pow(l,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)<=1e-10&&(i=at(i)*(N-2e-10));var a,e,h=Math.abs(Math.abs(i)-N);if(h>1e-10)a=ht(this.e,i,Math.sin(i)),e=this.a*this.f0*Math.pow(a,this.ns);else{if((h=i*this.ns)<=0)return null;e=0}var n=this.ns*et(s-this.long0);return t.x=this.k0*(e*Math.sin(n))+this.x0,t.y=this.k0*(this.rh-e*Math.cos(n))+this.y0,t},inverse:function(t){var s,i,a,e,h,n=(t.x-this.x0)/this.k0,r=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(s=Math.sqrt(n*n+r*r),i=1):(s=-Math.sqrt(n*n+r*r),i=-1);var o=0;if(0!==s&&(o=Math.atan2(i*n,i*r)),0!==s||this.ns>0){if(i=1/this.ns,a=Math.pow(s/(this.a*this.f0),i),-9999===(e=nt(this.e,a)))return null}else e=-N;return h=et(o/this.ns+this.long0),t.x=h,t.y=e,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"]};var cs={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var s,i,a,e,h,n,r,o=t.x,l=t.y,c=et(o-this.long0);return s=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/s)-this.s45),a=-c*this.alfa,e=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(a)),h=Math.asin(Math.cos(i)*Math.sin(a)/Math.cos(e)),n=this.n*h,r=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(e/2+this.s45),this.n),t.y=r*Math.cos(n)/1,t.x=r*Math.sin(n)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var s,i,a,e,h,n,r,o=t.x;t.x=t.y,t.y=o,this.czech||(t.y*=-1,t.x*=-1),h=Math.sqrt(t.x*t.x+t.y*t.y),e=Math.atan2(t.y,t.x)/Math.sin(this.s0),a=2*(Math.atan(Math.pow(this.ro0/h,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),s=Math.asin(Math.cos(this.ad)*Math.sin(a)-Math.sin(this.ad)*Math.cos(a)*Math.cos(e)),i=Math.asin(Math.cos(a)*Math.sin(e)/Math.cos(s)),t.x=this.long0-i/this.alfa,n=s,r=0;var l=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(s/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(n))/(1-this.e*Math.sin(n)),this.e/2))-this.s45),Math.abs(n-t.y)<1e-10&&(r=1),n=t.y,l+=1}while(0===r&&l<15);return l>=15?null:t},names:["Krovak","krovak"]},us=function(t,s,i,a,e){return t*e-s*Math.sin(2*e)+i*Math.sin(4*e)-a*Math.sin(6*e)},fs=function(t){return 1-.25*t*(1+t/16*(3+1.25*t))},Ms=function(t){return.375*t*(1+.25*t*(1+.46875*t))},ds=function(t){return.05859375*t*t*(1+.75*t)},ps=function(t){return t*t*t*(35/3072)},ms=function(t,s,i){var a=s*i;return t/Math.sqrt(1-a*a)},ys=function(t){return Math.abs(t)<N?t:t-at(t)*Math.PI},gs=function(t,s,i,a,e){var h,n;h=t/s;for(var r=0;r<15;r++)if(h+=n=(t-(s*h-i*Math.sin(2*h)+a*Math.sin(4*h)-e*Math.sin(6*h)))/(s-2*i*Math.cos(2*h)+4*a*Math.cos(4*h)-6*e*Math.cos(6*h)),Math.abs(n)<=1e-10)return h;return NaN};var _s={init:function(){this.sphere||(this.e0=fs(this.es),this.e1=Ms(this.es),this.e2=ds(this.es),this.e3=ps(this.es),this.ml0=this.a*us(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var s,i,a=t.x,e=t.y;if(a=et(a-this.long0),this.sphere)s=this.a*Math.asin(Math.cos(e)*Math.sin(a)),i=this.a*(Math.atan2(Math.tan(e),Math.cos(a))-this.lat0);else{var h=Math.sin(e),n=Math.cos(e),r=ms(this.a,this.e,h),o=Math.tan(e)*Math.tan(e),l=a*Math.cos(e),c=l*l,u=this.es*n*n/(1-this.es);s=r*l*(1-c*o*(1/6-(8-o+8*u)*c/120)),i=this.a*us(this.e0,this.e1,this.e2,this.e3,e)-this.ml0+r*h/n*c*(.5+(5-o+6*u)*c/24)}return t.x=s+this.x0,t.y=i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s,i,a=t.x/this.a,e=t.y/this.a;if(this.sphere){var h=e+this.lat0;s=Math.asin(Math.sin(h)*Math.cos(a)),i=Math.atan2(Math.tan(a),Math.cos(h))}else{var n=this.ml0/this.a+e,r=gs(n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(r)-N)<=1e-10)return t.x=this.long0,t.y=N,e<0&&(t.y*=-1),t;var o=ms(this.a,this.e,Math.sin(r)),l=o*o*o/this.a/this.a*(1-this.es),c=Math.pow(Math.tan(r),2),u=a*this.a/o,f=u*u;s=r-o*Math.tan(r)/l*u*u*(.5-(1+3*c)*u*u/24),i=u*(1-f*(c/3+(1+3*c)*c*f/15))/Math.cos(r)}return t.x=et(i+this.long0),t.y=ys(s),t},names:["Cassini","Cassini_Soldner","cass"]},bs=function(t,s){var i;return t>1e-7?(1-t*t)*(s/(1-(i=t*s)*i)-.5/t*Math.log((1-i)/(1+i))):2*s};var vs={init:function(){var t,s=Math.abs(this.lat0);if(Math.abs(s-N)<1e-10?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(s)<1e-10?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0)switch(this.qp=bs(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var s,i=[];return i[0]=.3333333333333333*t,s=t*t,i[0]+=.17222222222222222*s,i[1]=.06388888888888888*s,s*=t,i[0]+=.10257936507936508*s,i[1]+=.0664021164021164*s,i[2]=.016415012942191543*s,i}(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=bs(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var s,i,a,e,h,n,r,o,l,c,u=t.x,f=t.y;if(u=et(u-this.long0),this.sphere){if(h=Math.sin(f),c=Math.cos(f),a=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+c*a:1+this.sinph0*h+this.cosph0*c*a)<=1e-10)return null;s=(i=Math.sqrt(2/i))*c*Math.sin(u),i*=this.mode===this.EQUIT?h:this.cosph0*h-this.sinph0*c*a}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(a=-a),Math.abs(f+this.lat0)<1e-10)return null;i=O-.5*f,s=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(u),i*=a}}else{switch(r=0,o=0,l=0,a=Math.cos(u),e=Math.sin(u),h=Math.sin(f),n=bs(this.e,h),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(r=n/this.qp,o=Math.sqrt(1-r*r)),this.mode){case this.OBLIQ:l=1+this.sinb1*r+this.cosb1*o*a;break;case this.EQUIT:l=1+o*a;break;case this.N_POLE:l=N+f,n=this.qp-n;break;case this.S_POLE:l=f-N,n=this.qp+n}if(Math.abs(l)<1e-10)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),i=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*r-this.sinb1*o*a):(l=Math.sqrt(2/(1+o*a)))*r*this.ymf,s=this.xmf*l*o*e;break;case this.N_POLE:case this.S_POLE:n>=0?(s=(l=Math.sqrt(n))*e,i=a*(this.mode===this.S_POLE?l:-l)):s=i=0}}return t.x=this.a*s+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s,i,a,e,h,n,r,o,l,c,u=t.x/this.a,f=t.y/this.a;if(this.sphere){var M,d=0,p=0;if((i=.5*(M=Math.sqrt(u*u+f*f)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(p=Math.sin(i),d=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(M)<=1e-10?0:Math.asin(f*p/M),u*=p,f=d*M;break;case this.OBLIQ:i=Math.abs(M)<=1e-10?this.lat0:Math.asin(d*this.sinph0+f*p*this.cosph0/M),u*=p*this.cosph0,f=(d-Math.sin(i)*this.sinph0)*M;break;case this.N_POLE:f=-f,i=N-i;break;case this.S_POLE:i-=N}s=0!==f||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(u,f):0}else{if(r=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(u/=this.dd,f*=this.dd,(n=Math.sqrt(u*u+f*f))<1e-10)return t.x=this.long0,t.y=this.lat0,t;e=2*Math.asin(.5*n/this.rq),a=Math.cos(e),u*=e=Math.sin(e),this.mode===this.OBLIQ?(r=a*this.sinb1+f*e*this.cosb1/n,h=this.qp*r,f=n*this.cosb1*a-f*this.sinb1*e):(r=f*e/n,h=this.qp*r,f=n*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(f=-f),!(h=u*u+f*f))return t.x=this.long0,t.y=this.lat0,t;r=1-h/this.qp,this.mode===this.S_POLE&&(r=-r)}s=Math.atan2(u,f),o=Math.asin(r),l=this.apa,c=o+o,i=o+l[0]*Math.sin(c)+l[1]*Math.sin(c+c)+l[2]*Math.sin(c+c+c)}return t.x=et(this.long0+s),t.y=i,t},names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4},xs=function(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)};var ws={init:function(){Math.abs(this.lat1+this.lat2)<1e-10||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=it(this.e3,this.sin_po,this.cos_po),this.qs1=bs(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=it(this.e3,this.sin_po,this.cos_po),this.qs2=bs(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=bs(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>1e-10?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var s=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var a=bs(this.e3,this.sin_phi,this.cos_phi),e=this.a*Math.sqrt(this.c-this.ns0*a)/this.ns0,h=this.ns0*et(s-this.long0),n=e*Math.sin(h)+this.x0,r=this.rh-e*Math.cos(h)+this.y0;return t.x=n,t.y=r,t},inverse:function(t){var s,i,a,e,h,n;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(s=Math.sqrt(t.x*t.x+t.y*t.y),a=1):(s=-Math.sqrt(t.x*t.x+t.y*t.y),a=-1),e=0,0!==s&&(e=Math.atan2(a*t.x,a*t.y)),a=s*this.ns0/this.a,this.sphere?n=Math.asin((this.c-a*a)/(2*this.ns0)):(i=(this.c-a*a)/this.ns0,n=this.phi1z(this.e3,i)),h=et(e/this.ns0+this.long0),t.x=h,t.y=n,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,s){var i,a,e,h,n=xs(.5*s);if(t<1e-10)return n;for(var r=t*t,o=1;o<=25;o++)if(n+=h=.5*(e=1-(a=t*(i=Math.sin(n)))*a)*e/Math.cos(n)*(s/(1-r)-i/e+.5/t*Math.log((1-a)/(1+a))),Math.abs(h)<=1e-7)return n;return null}};var Ss={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(t){var s,i,a,e,h,n,r,o=t.x,l=t.y;return a=et(o-this.long0),s=Math.sin(l),i=Math.cos(l),e=Math.cos(a),1,(h=this.sin_p14*s+this.cos_p14*i*e)>0||Math.abs(h)<=1e-10?(n=this.x0+1*this.a*i*Math.sin(a)/h,r=this.y0+1*this.a*(this.cos_p14*s-this.sin_p14*i*e)/h):(n=this.x0+this.infinity_dist*i*Math.sin(a),r=this.y0+this.infinity_dist*(this.cos_p14*s-this.sin_p14*i*e)),t.x=n,t.y=r,t},inverse:function(t){var s,i,a,e,h,n;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(s=Math.sqrt(t.x*t.x+t.y*t.y))?(e=Math.atan2(s,this.rc),i=Math.sin(e),a=Math.cos(e),n=xs(a*this.sin_p14+t.y*i*this.cos_p14/s),h=Math.atan2(t.x*i,s*this.cos_p14*a-t.y*this.sin_p14*i),h=et(this.long0+h)):(n=this.phic0,h=0),t.x=h,t.y=n,t},names:["gnom"]};var Es={init:function(){this.sphere||(this.k0=it(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var s,i,a=t.x,e=t.y,h=et(a-this.long0);if(this.sphere)s=this.x0+this.a*h*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(e)/Math.cos(this.lat_ts);else{var n=bs(this.e,Math.sin(e));s=this.x0+this.a*this.k0*h,i=this.y0+this.a*n*.5/this.k0}return t.x=s,t.y=i,t},inverse:function(t){var s,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(s=et(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=function(t,s){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(s)-i)<1e-6)return s<0?-1*N:N;for(var a,e,h,n,r=Math.asin(.5*s),o=0;o<30;o++)if(e=Math.sin(r),h=Math.cos(r),n=t*e,r+=a=Math.pow(1-n*n,2)/(2*h)*(s/(1-t*t)-e/(1-n*n)+.5/t*Math.log((1-n)/(1+n))),Math.abs(a)<=1e-10)return r;return NaN}(this.e,2*t.y*this.k0/this.a),s=et(this.long0+t.x/(this.a*this.k0))),t.x=s,t.y=i,t},names:["cea"]};var Is={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var s=t.x,i=t.y,a=et(s-this.long0),e=ys(i-this.lat0);return t.x=this.x0+this.a*a*this.rc,t.y=this.y0+this.a*e,t},inverse:function(t){var s=t.x,i=t.y;return t.x=et(this.long0+(s-this.x0)/(this.a*this.rc)),t.y=ys(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]};var Ps={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=fs(this.es),this.e1=Ms(this.es),this.e2=ds(this.es),this.e3=ps(this.es),this.ml0=this.a*us(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var s,i,a,e=t.x,h=t.y,n=et(e-this.long0);if(a=n*Math.sin(h),this.sphere)Math.abs(h)<=1e-10?(s=this.a*n,i=-1*this.a*this.lat0):(s=this.a*Math.sin(a)/Math.tan(h),i=this.a*(ys(h-this.lat0)+(1-Math.cos(a))/Math.tan(h)));else if(Math.abs(h)<=1e-10)s=this.a*n,i=-1*this.ml0;else{var r=ms(this.a,this.e,Math.sin(h))/Math.tan(h);s=r*Math.sin(a),i=this.a*us(this.e0,this.e1,this.e2,this.e3,h)-this.ml0+r*(1-Math.cos(a))}return t.x=s+this.x0,t.y=i+this.y0,t},inverse:function(t){var s,i,a,e,h,n,r,o,l;if(a=t.x-this.x0,e=t.y-this.y0,this.sphere)if(Math.abs(e+this.a*this.lat0)<=1e-10)s=et(a/this.a+this.long0),i=0;else{var c;for(n=this.lat0+e/this.a,r=a*a/this.a/this.a+n*n,o=n,h=20;h;--h)if(o+=l=-1*(n*(o*(c=Math.tan(o))+1)-o-.5*(o*o+r)*c)/((o-n)/c-1),Math.abs(l)<=1e-10){i=o;break}s=et(this.long0+Math.asin(a*Math.tan(o)/this.a)/Math.sin(i))}else if(Math.abs(e+this.ml0)<=1e-10)i=0,s=et(this.long0+a/this.a);else{var u,f,M,d,p;for(n=(this.ml0+e)/this.a,r=a*a/this.a/this.a+n*n,o=n,h=20;h;--h)if(p=this.e*Math.sin(o),u=Math.sqrt(1-p*p)*Math.tan(o),f=this.a*us(this.e0,this.e1,this.e2,this.e3,o),M=this.e0-2*this.e1*Math.cos(2*o)+4*this.e2*Math.cos(4*o)-6*this.e3*Math.cos(6*o),o-=l=(n*(u*(d=f/this.a)+1)-d-.5*u*(d*d+r))/(this.es*Math.sin(2*o)*(d*d+r-2*n*d)/(4*u)+(n-d)*(u*M-2/Math.sin(2*o))-M),Math.abs(l)<=1e-10){i=o;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),s=et(this.long0+Math.asin(a*u/this.a)/Math.sin(i))}return t.x=s,t.y=i,t},names:["Polyconic","poly"]};var Ns={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var s,i=t.x,a=t.y-this.lat0,e=i-this.long0,h=a/P*1e-5,n=e,r=1,o=0;for(s=1;s<=10;s++)r*=h,o+=this.A[s]*r;var l,c=o,u=n,f=1,M=0,d=0,p=0;for(s=1;s<=6;s++)l=M*c+f*u,f=f*c-M*u,M=l,d=d+this.B_re[s]*f-this.B_im[s]*M,p=p+this.B_im[s]*f+this.B_re[s]*M;return t.x=p*this.a+this.x0,t.y=d*this.a+this.y0,t},inverse:function(t){var s,i,a=t.x,e=t.y,h=a-this.x0,n=(e-this.y0)/this.a,r=h/this.a,o=1,l=0,c=0,u=0;for(s=1;s<=6;s++)i=l*n+o*r,o=o*n-l*r,l=i,c=c+this.C_re[s]*o-this.C_im[s]*l,u=u+this.C_im[s]*o+this.C_re[s]*l;for(var f=0;f<this.iterations;f++){var M,d=c,p=u,m=n,y=r;for(s=2;s<=6;s++)M=p*c+d*u,d=d*c-p*u,p=M,m+=(s-1)*(this.B_re[s]*d-this.B_im[s]*p),y+=(s-1)*(this.B_im[s]*d+this.B_re[s]*p);d=1,p=0;var g=this.B_re[1],_=this.B_im[1];for(s=2;s<=6;s++)M=p*c+d*u,d=d*c-p*u,p=M,g+=s*(this.B_re[s]*d-this.B_im[s]*p),_+=s*(this.B_im[s]*d+this.B_re[s]*p);var b=g*g+_*_;c=(m*g+y*_)/b,u=(y*g-m*_)/b}var v=c,x=u,w=1,S=0;for(s=1;s<=9;s++)w*=v,S+=this.D[s]*w;var E=this.lat0+S*P*1e5,I=this.long0+x;return t.x=I,t.y=E,t},names:["New_Zealand_Map_Grid","nzmg"]};var Cs={init:function(){},forward:function(t){var s=t.x,i=t.y,a=et(s-this.long0),e=this.x0+this.a*a,h=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=e,t.y=h,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s=et(this.long0+t.x/this.a),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=s,t.y=i,t},names:["Miller_Cylindrical","mill"]};var Ts={init:function(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Ht(this.es)},forward:function(t){var s,i,a=t.x,e=t.y;if(a=et(a-this.long0),this.sphere){if(this.m)for(var h=this.n*Math.sin(e),n=20;n;--n){var r=(this.m*e+Math.sin(e)-h)/(this.m+Math.cos(e));if(e-=r,Math.abs(r)<1e-10)break}else e=1!==this.n?Math.asin(this.n*Math.sin(e)):e;s=this.a*this.C_x*a*(this.m+Math.cos(e)),i=this.a*this.C_y*e}else{var o=Math.sin(e),l=Math.cos(e);i=this.a*Xt(e,o,l,this.en),s=this.a*a*l/Math.sqrt(1-this.es*o*o)}return t.x=s,t.y=i,t},inverse:function(t){var s,i,a,e;return t.x-=this.x0,a=t.x/this.a,t.y-=this.y0,s=t.y/this.a,this.sphere?(s/=this.C_y,a/=this.C_x*(this.m+Math.cos(s)),this.m?s=xs((this.m*s+Math.sin(s))/this.n):1!==this.n&&(s=xs(Math.sin(s)/this.n)),a=et(a+this.long0),s=ys(s)):(s=Vt(t.y/this.a,this.es,this.en),(e=Math.abs(s))<N?(e=Math.sin(s),i=this.long0+t.x*Math.sqrt(1-this.es*e*e)/(this.a*Math.cos(s)),a=et(i)):e-1e-10<N&&(a=this.long0)),t.x=a,t.y=s,t},names:["Sinusoidal","sinu"]};var Os={init:function(){},forward:function(t){for(var s=t.x,i=t.y,a=et(s-this.long0),e=i,h=Math.PI*Math.sin(i);;){var n=-(e+Math.sin(e)-h)/(1+Math.cos(e));if(e+=n,Math.abs(n)<1e-10)break}e/=2,Math.PI/2-Math.abs(i)<1e-10&&(a=0);var r=.900316316158*this.a*a*Math.cos(e)+this.x0,o=1.4142135623731*this.a*Math.sin(e)+this.y0;return t.x=r,t.y=o,t},inverse:function(t){var s,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),s=Math.asin(i);var a=et(this.long0+t.x/(.900316316158*this.a*Math.cos(s)));a<-Math.PI&&(a=-Math.PI),a>Math.PI&&(a=Math.PI),i=(2*s+Math.sin(2*s))/Math.PI,Math.abs(i)>1&&(i=1);var e=Math.asin(i);return t.x=a,t.y=e,t},names:["Mollweide","moll"]};var As={init:function(){Math.abs(this.lat1+this.lat2)<1e-10||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=fs(this.es),this.e1=Ms(this.es),this.e2=ds(this.es),this.e3=ps(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=it(this.e,this.sinphi,this.cosphi),this.ml1=us(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<1e-10?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=it(this.e,this.sinphi,this.cosphi),this.ml2=us(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=us(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(t){var s,i=t.x,a=t.y;if(this.sphere)s=this.a*(this.g-a);else{var e=us(this.e0,this.e1,this.e2,this.e3,a);s=this.a*(this.g-e)}var h=this.ns*et(i-this.long0),n=this.x0+s*Math.sin(h),r=this.y0+this.rh-s*Math.cos(h);return t.x=n,t.y=r,t},inverse:function(t){var s,i,a,e;t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),s=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),s=-1);var h=0;if(0!==i&&(h=Math.atan2(s*t.x,s*t.y)),this.sphere)return e=et(this.long0+h/this.ns),a=ys(this.g-i/this.a),t.x=e,t.y=a,t;var n=this.g-i/this.a;return a=gs(n,this.e0,this.e1,this.e2,this.e3),e=et(this.long0+h/this.ns),t.x=e,t.y=a,t},names:["Equidistant_Conic","eqdc"]};var ks={init:function(){this.R=this.a},forward:function(t){var s,i,a=t.x,e=t.y,h=et(a-this.long0);Math.abs(e)<=1e-10&&(s=this.x0+this.R*h,i=this.y0);var n=xs(2*Math.abs(e/Math.PI));(Math.abs(h)<=1e-10||Math.abs(Math.abs(e)-N)<=1e-10)&&(s=this.x0,i=e>=0?this.y0+Math.PI*this.R*Math.tan(.5*n):this.y0+Math.PI*this.R*-Math.tan(.5*n));var r=.5*Math.abs(Math.PI/h-h/Math.PI),o=r*r,l=Math.sin(n),c=Math.cos(n),u=c/(l+c-1),f=u*u,M=u*(2/l-1),d=M*M,p=Math.PI*this.R*(r*(u-d)+Math.sqrt(o*(u-d)*(u-d)-(d+o)*(f-d)))/(d+o);h<0&&(p=-p),s=this.x0+p;var m=o+u;return p=Math.PI*this.R*(M*m-r*Math.sqrt((d+o)*(o+1)-m*m))/(d+o),i=e>=0?this.y0+p:this.y0-p,t.x=s,t.y=i,t},inverse:function(t){var s,i,a,e,h,n,r,o,l,c,u,f;return t.x-=this.x0,t.y-=this.y0,u=Math.PI*this.R,h=(a=t.x/u)*a+(e=t.y/u)*e,u=3*(e*e/(o=-2*(n=-Math.abs(e)*(1+h))+1+2*e*e+h*h)+(2*(r=n-2*e*e+a*a)*r*r/o/o/o-9*n*r/o/o)/27)/(l=(n-r*r/3/o)/o)/(c=2*Math.sqrt(-l/3)),Math.abs(u)>1&&(u=u>=0?1:-1),f=Math.acos(u)/3,i=t.y>=0?(-c*Math.cos(f+Math.PI/3)-r/3/o)*Math.PI:-(-c*Math.cos(f+Math.PI/3)-r/3/o)*Math.PI,s=Math.abs(a)<1e-10?this.long0:et(this.long0+Math.PI*(h-1+Math.sqrt(1+2*(a*a-e*e)+h*h))/2/a),t.x=s,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","vandg"]};var Rs={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)},forward:function(t){var s,i,a,e,h,n,r,o,l,c,u,f,M,d,p,m,y,g,_,b,v,x,w=t.x,S=t.y,E=Math.sin(t.y),I=Math.cos(t.y),P=et(w-this.long0);return this.sphere?Math.abs(this.sin_p12-1)<=1e-10?(t.x=this.x0+this.a*(N-S)*Math.sin(P),t.y=this.y0-this.a*(N-S)*Math.cos(P),t):Math.abs(this.sin_p12+1)<=1e-10?(t.x=this.x0+this.a*(N+S)*Math.sin(P),t.y=this.y0+this.a*(N+S)*Math.cos(P),t):(g=this.sin_p12*E+this.cos_p12*I*Math.cos(P),y=(m=Math.acos(g))?m/Math.sin(m):1,t.x=this.x0+this.a*y*I*Math.sin(P),t.y=this.y0+this.a*y*(this.cos_p12*E-this.sin_p12*I*Math.cos(P)),t):(s=fs(this.es),i=Ms(this.es),a=ds(this.es),e=ps(this.es),Math.abs(this.sin_p12-1)<=1e-10?(h=this.a*us(s,i,a,e,N),n=this.a*us(s,i,a,e,S),t.x=this.x0+(h-n)*Math.sin(P),t.y=this.y0-(h-n)*Math.cos(P),t):Math.abs(this.sin_p12+1)<=1e-10?(h=this.a*us(s,i,a,e,N),n=this.a*us(s,i,a,e,S),t.x=this.x0+(h+n)*Math.sin(P),t.y=this.y0+(h+n)*Math.cos(P),t):(r=E/I,o=ms(this.a,this.e,this.sin_p12),l=ms(this.a,this.e,E),c=Math.atan((1-this.es)*r+this.es*o*this.sin_p12/(l*I)),_=0===(u=Math.atan2(Math.sin(P),this.cos_p12*Math.tan(c)-this.sin_p12*Math.cos(P)))?Math.asin(this.cos_p12*Math.sin(c)-this.sin_p12*Math.cos(c)):Math.abs(Math.abs(u)-Math.PI)<=1e-10?-Math.asin(this.cos_p12*Math.sin(c)-this.sin_p12*Math.cos(c)):Math.asin(Math.sin(P)*Math.cos(c)/Math.sin(u)),f=this.e*this.sin_p12/Math.sqrt(1-this.es),m=o*_*(1-(b=_*_)*(p=(M=this.e*this.cos_p12*Math.cos(u)/Math.sqrt(1-this.es))*M)*(1-p)/6+(v=b*_)/8*(d=f*M)*(1-2*p)+(x=v*_)/120*(p*(4-7*p)-3*f*f*(1-7*p))-x*_/48*d),t.x=this.x0+m*Math.sin(u),t.y=this.y0+m*Math.cos(u),t))},inverse:function(t){var s,i,a,e,h,n,r,o,l,c,u,f,M,d,p,m,y,g,_,b,v,x,w;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((s=Math.sqrt(t.x*t.x+t.y*t.y))>2*N*this.a)return;return i=s/this.a,a=Math.sin(i),e=Math.cos(i),h=this.long0,Math.abs(s)<=1e-10?n=this.lat0:(n=xs(e*this.sin_p12+t.y*a*this.cos_p12/s),r=Math.abs(this.lat0)-N,h=Math.abs(r)<=1e-10?this.lat0>=0?et(this.long0+Math.atan2(t.x,-t.y)):et(this.long0-Math.atan2(-t.x,t.y)):et(this.long0+Math.atan2(t.x*a,s*this.cos_p12*e-t.y*this.sin_p12*a))),t.x=h,t.y=n,t}return o=fs(this.es),l=Ms(this.es),c=ds(this.es),u=ps(this.es),Math.abs(this.sin_p12-1)<=1e-10?(f=this.a*us(o,l,c,u,N),s=Math.sqrt(t.x*t.x+t.y*t.y),n=gs((f-s)/this.a,o,l,c,u),h=et(this.long0+Math.atan2(t.x,-1*t.y)),t.x=h,t.y=n,t):Math.abs(this.sin_p12+1)<=1e-10?(f=this.a*us(o,l,c,u,N),s=Math.sqrt(t.x*t.x+t.y*t.y),n=gs((s-f)/this.a,o,l,c,u),h=et(this.long0+Math.atan2(t.x,t.y)),t.x=h,t.y=n,t):(s=Math.sqrt(t.x*t.x+t.y*t.y),p=Math.atan2(t.x,t.y),M=ms(this.a,this.e,this.sin_p12),m=Math.cos(p),g=-(y=this.e*this.cos_p12*m)*y/(1-this.es),_=3*this.es*(1-g)*this.sin_p12*this.cos_p12*m/(1-this.es),x=1-g*(v=(b=s/M)-g*(1+g)*Math.pow(b,3)/6-_*(1+3*g)*Math.pow(b,4)/24)*v/2-b*v*v*v/6,d=Math.asin(this.sin_p12*Math.cos(v)+this.cos_p12*Math.sin(v)*m),h=et(this.long0+Math.asin(Math.sin(p)*Math.sin(v)/Math.cos(d))),w=Math.sin(d),n=Math.atan2((w-this.es*x*this.sin_p12)*Math.tan(d),w*(1-this.es)),t.x=h,t.y=n,t)},names:["Azimuthal_Equidistant","aeqd"]};var Ls={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var s,i,a,e,h,n,r,o=t.x,l=t.y;return a=et(o-this.long0),s=Math.sin(l),i=Math.cos(l),e=Math.cos(a),1,((h=this.sin_p14*s+this.cos_p14*i*e)>0||Math.abs(h)<=1e-10)&&(n=1*this.a*i*Math.sin(a),r=this.y0+1*this.a*(this.cos_p14*s-this.sin_p14*i*e)),t.x=n,t.y=r,t},inverse:function(t){var s,i,a,e,h,n,r;return t.x-=this.x0,t.y-=this.y0,s=Math.sqrt(t.x*t.x+t.y*t.y),i=xs(s/this.a),a=Math.sin(i),e=Math.cos(i),n=this.long0,Math.abs(s)<=1e-10?(r=this.lat0,t.x=n,t.y=r,t):(r=xs(e*this.sin_p14+t.y*a*this.cos_p14/s),h=Math.abs(this.lat0)-N,Math.abs(h)<=1e-10?(n=this.lat0>=0?et(this.long0+Math.atan2(t.x,-t.y)):et(this.long0-Math.atan2(-t.x,t.y)),t.x=n,t.y=r,t):(n=et(this.long0+Math.atan2(t.x*a,s*this.cos_p14*e-t.y*this.sin_p14*a)),t.x=n,t.y=r,t))},names:["ortho"]},qs=1,Ds=2,js=3,Bs=4,zs=5,Gs=6,Fs=1,Us=2,Ws=3,Qs=4;function Hs(t,s,i,a){var e;return t<1e-10?(a.value=Fs,e=0):(e=Math.atan2(s,i),Math.abs(e)<=O?a.value=Fs:e>O&&e<=N+O?(a.value=Us,e-=N):e>N+O||e<=-(N+O)?(a.value=Ws,e=e>=0?e-k:e+k):(a.value=Qs,e+=N)),e}function Xs(t,s){var i=t+s;return i<-k?i+=A:i>+k&&(i-=A),i}var Vs={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=N-O/2?this.face=zs:this.lat0<=-(N-O/2)?this.face=Gs:Math.abs(this.long0)<=O?this.face=qs:Math.abs(this.long0)<=N+O?this.face=this.long0>0?Ds:Bs:this.face=js,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var s,i,a,e,h,n,r={x:0,y:0},o={value:0};if(t.x-=this.long0,s=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===zs)e=N-s,i>=O&&i<=N+O?(o.value=Fs,a=i-N):i>N+O||i<=-(N+O)?(o.value=Us,a=i>0?i-k:i+k):i>-(N+O)&&i<=-O?(o.value=Ws,a=i+N):(o.value=Qs,a=i);else if(this.face===Gs)e=N+s,i>=O&&i<=N+O?(o.value=Fs,a=-i+N):i<O&&i>=-O?(o.value=Us,a=-i):i<-O&&i>=-(N+O)?(o.value=Ws,a=-i-N):(o.value=Qs,a=i>0?-i+k:-i-k);else{var l,c,u,f,M,d;this.face===Ds?i=Xs(i,+N):this.face===js?i=Xs(i,+k):this.face===Bs&&(i=Xs(i,-N)),f=Math.sin(s),M=Math.cos(s),d=Math.sin(i),l=M*Math.cos(i),c=M*d,u=f,this.face===qs?a=Hs(e=Math.acos(l),u,c,o):this.face===Ds?a=Hs(e=Math.acos(c),u,-l,o):this.face===js?a=Hs(e=Math.acos(-l),u,-c,o):this.face===Bs?a=Hs(e=Math.acos(-c),u,l,o):(e=a=0,o.value=Fs)}return n=Math.atan(12/k*(a+Math.acos(Math.sin(a)*Math.cos(O))-N)),h=Math.sqrt((1-Math.cos(e))/(Math.cos(n)*Math.cos(n))/(1-Math.cos(Math.atan(1/Math.cos(a))))),o.value===Us?n+=N:o.value===Ws?n+=k:o.value===Qs&&(n+=1.5*k),r.x=h*Math.cos(n),r.y=h*Math.sin(n),r.x=r.x*this.a+this.x0,r.y=r.y*this.a+this.y0,t.x=r.x,t.y=r.y,t},inverse:function(t){var s,i,a,e,h,n,r,o,l,c,u,f,M={lam:0,phi:0},d={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),s=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?d.value=Fs:t.y>=0&&t.y>=Math.abs(t.x)?(d.value=Us,s-=N):t.x<0&&-t.x>=Math.abs(t.y)?(d.value=Ws,s=s<0?s+k:s-k):(d.value=Qs,s+=N),l=k/12*Math.tan(s),h=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),n=Math.atan(h),(r=1-(a=Math.cos(s))*a*(e=Math.tan(i))*e*(1-Math.cos(Math.atan(1/Math.cos(n)))))<-1?r=-1:r>1&&(r=1),this.face===zs)o=Math.acos(r),M.phi=N-o,d.value===Fs?M.lam=n+N:d.value===Us?M.lam=n<0?n+k:n-k:d.value===Ws?M.lam=n-N:M.lam=n;else if(this.face===Gs)o=Math.acos(r),M.phi=o-N,d.value===Fs?M.lam=-n+N:d.value===Us?M.lam=-n:d.value===Ws?M.lam=-n-N:M.lam=n<0?-n-k:-n+k;else{var p,m,y;l=(p=r)*p,m=(l+=(y=l>=1?0:Math.sqrt(1-l)*Math.sin(n))*y)>=1?0:Math.sqrt(1-l),d.value===Us?(l=m,m=-y,y=l):d.value===Ws?(m=-m,y=-y):d.value===Qs&&(l=m,m=y,y=-l),this.face===Ds?(l=p,p=-m,m=l):this.face===js?(p=-p,m=-m):this.face===Bs&&(l=p,p=m,m=-l),M.phi=Math.acos(-y)-N,M.lam=Math.atan2(m,p),this.face===Ds?M.lam=Xs(M.lam,-N):this.face===js?M.lam=Xs(M.lam,-k):this.face===Bs&&(M.lam=Xs(M.lam,+N))}return 0!==this.es&&(c=M.phi<0?1:0,u=Math.tan(M.phi),f=this.b/Math.sqrt(u*u+this.one_minus_f_squared),M.phi=Math.atan(Math.sqrt(this.a*this.a-f*f)/(this.one_minus_f*f)),c&&(M.phi=-M.phi)),M.lam+=this.long0,t.x=M.lam,t.y=M.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},Ys=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Js=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Ks=T/5,Zs=function(t,s){return t[0]+s*(t[1]+s*(t[2]+s*t[3]))};var $s={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var s=et(t.x-this.long0),i=Math.abs(t.y),a=Math.floor(i*Ks);a<0?a=0:a>=18&&(a=17);var e={x:Zs(Ys[a],i=T*(i-.08726646259971647*a))*s,y:Zs(Js[a],i)};return t.y<0&&(e.y=-e.y),e.x=e.x*this.a*.8487+this.x0,e.y=e.y*this.a*1.3523+this.y0,e},inverse:function(t){var s={x:(t.x-this.x0)/(.8487*this.a),y:Math.abs(t.y-this.y0)/(1.3523*this.a)};if(s.y>=1)s.x/=Ys[18][0],s.y=t.y<0?-N:N;else{var i=Math.floor(18*s.y);for(i<0?i=0:i>=18&&(i=17);;)if(Js[i][0]>s.y)--i;else{if(!(Js[i+1][0]<=s.y))break;++i}var a=Js[i],e=5*(s.y-a[0])/(Js[i+1][0]-a[0]);e=function(t,s,i,a){for(var e=s;a;--a){var h=t(e);if(e-=h,Math.abs(h)<i)break}return e}((function(t){return(Zs(a,t)-s.y)/function(t,s){return t[1]+s*(2*t[2]+3*s*t[3])}(a,t)}),e,1e-10,100),s.x/=Zs(Ys[i],e),s.y=(5*i+e)*C,t.y<0&&(s.y=-s.y)}return s.x=et(s.x+this.long0),s},names:["Robinson","robin"]};var ti,si={init:function(){this.name="geocent"},forward:function(t){return _t(t,this.es,this.a)},inverse:function(t){return bt(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]};Tt.defaultDatum="WGS84",Tt.Proj=gt,Tt.WGS84=new Tt.Proj("WGS84"),Tt.Point=Wt,Tt.toPoint=St,Tt.defs=K,Tt.transform=It,Tt.mgrs=kt,Tt.version="__VERSION__",(ti=Tt).Proj.projections.add(Yt),ti.Proj.projections.add(ss),ti.Proj.projections.add(is),ti.Proj.projections.add(hs),ti.Proj.projections.add(ns),ti.Proj.projections.add(rs),ti.Proj.projections.add(os),ti.Proj.projections.add(ls),ti.Proj.projections.add(cs),ti.Proj.projections.add(_s),ti.Proj.projections.add(vs),ti.Proj.projections.add(ws),ti.Proj.projections.add(Ss),ti.Proj.projections.add(Es),ti.Proj.projections.add(Is),ti.Proj.projections.add(Ps),ti.Proj.projections.add(Ns),ti.Proj.projections.add(Cs),ti.Proj.projections.add(Ts),ti.Proj.projections.add(Os),ti.Proj.projections.add(As),ti.Proj.projections.add(ks),ti.Proj.projections.add(Rs),ti.Proj.projections.add(Ls),ti.Proj.projections.add(Vs),ti.Proj.projections.add($s),ti.Proj.projections.add(si);var ii=Tt;class ai{static defineProjectionAliases(t){const s=[];for(const i in t)s.push([i,t[i]]);ii.defs(s)}constructor({from:t="WGS84",to:s="WGS84"}){const i=ii(t,s);if(!i)throw new Error("Invalid projection");this.project=i.forward,this.unproject=i.inverse}}function ei(t,s){const i=Math.min(t.length,s.length);if(0===i)return null;const a=[t.slice(0,i),s.slice(0,i)];return t.splice(0,i),s.splice(0,i),a}function hi(t,s,i){return s in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}class ni{constructor(t,s){hi(this,"fields",void 0),hi(this,"metadata",void 0),function(t,s){if(!t)throw new Error(s||"loader assertion failed.")}(Array.isArray(t)),function(t){const s={};for(const i of t)s[i.name]&&console.warn("Schema: duplicated field name",i.name,i),s[i.name]=!0}(t),this.fields=t,this.metadata=s||new Map}compareTo(t){if(this.metadata!==t.metadata)return!1;if(this.fields.length!==t.fields.length)return!1;for(let s=0;s<this.fields.length;++s)if(!this.fields[s].compareTo(t.fields[s]))return!1;return!0}select(...t){const s=Object.create(null);for(const i of t)s[i]=!0;const i=this.fields.filter(t=>s[t.name]);return new ni(i,this.metadata)}selectAt(...t){const s=t.map(t=>this.fields[t]).filter(Boolean);return new ni(s,this.metadata)}assign(t){let s,i=this.metadata;if(t instanceof ni){const a=t;s=a.fields,i=ri(ri(new Map,this.metadata),a.metadata)}else s=t;const a=Object.create(null);for(const t of this.fields)a[t.name]=t;for(const t of s)a[t.name]=t;const e=Object.values(a);return new ni(e,i)}}function ri(t,s){return new Map([...t||new Map,...s||new Map])}function oi(t,s,i){return s in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}class li{constructor(t,s,i=!1,a=new Map){oi(this,"name",void 0),oi(this,"type",void 0),oi(this,"nullable",void 0),oi(this,"metadata",void 0),this.name=t,this.type=s,this.nullable=i,this.metadata=a}get typeId(){return this.type&&this.type.typeId}clone(){return new li(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}let ci,ui,fi,Mi,di,pi,mi,yi,gi;function _i(t,s,i){return s in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(ci||(ci={}));class bi{static isNull(t){return t&&t.typeId===ci.Null}static isInt(t){return t&&t.typeId===ci.Int}static isFloat(t){return t&&t.typeId===ci.Float}static isBinary(t){return t&&t.typeId===ci.Binary}static isUtf8(t){return t&&t.typeId===ci.Utf8}static isBool(t){return t&&t.typeId===ci.Bool}static isDecimal(t){return t&&t.typeId===ci.Decimal}static isDate(t){return t&&t.typeId===ci.Date}static isTime(t){return t&&t.typeId===ci.Time}static isTimestamp(t){return t&&t.typeId===ci.Timestamp}static isInterval(t){return t&&t.typeId===ci.Interval}static isList(t){return t&&t.typeId===ci.List}static isStruct(t){return t&&t.typeId===ci.Struct}static isUnion(t){return t&&t.typeId===ci.Union}static isFixedSizeBinary(t){return t&&t.typeId===ci.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===ci.FixedSizeList}static isMap(t){return t&&t.typeId===ci.Map}static isDictionary(t){return t&&t.typeId===ci.Dictionary}get typeId(){return ci.NONE}compareTo(t){return this===t}}Symbol.toStringTag;class vi extends bi{get typeId(){return ci.Bool}get[Symbol.toStringTag](){return"Bool"}toString(){return"Bool"}}ui=Symbol.toStringTag;const xi=64;fi=Symbol.toStringTag;class wi extends bi{constructor(t){super(),_i(this,"precision",void 0),this.precision=t}get typeId(){return ci.Float}get[fi](){return"Float"}toString(){return"Float"+this.precision}}class Si extends wi{constructor(){super(xi)}}Symbol.toStringTag;class Ei extends bi{get typeId(){return ci.Utf8}get[Symbol.toStringTag](){return"Utf8"}toString(){return"Utf8"}}Mi=Symbol.toStringTag;const Ii={SECOND:1,MILLISECOND:1e3,MICROSECOND:1e6,NANOSECOND:1e9};di=Symbol.toStringTag;pi=Symbol.toStringTag;class Pi extends bi{constructor(t,s=null){super(),_i(this,"unit",void 0),_i(this,"timezone",void 0),this.unit=t,this.timezone=s}get typeId(){return ci.Timestamp}get[pi](){return"Timestamp"}toString(){return`Timestamp<${Ii[this.unit]}${this.timezone?", "+this.timezone:""}>`}}class Ni extends Pi{constructor(t=null){super(Ii.MILLISECOND,t)}}mi=Symbol.toStringTag;yi=Symbol.toStringTag;gi=Symbol.toStringTag;function Ci(t,s,i){return s in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}var Ti;!function(t){t[t.START=0]="START",t[t.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",t[t.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",t[t.END=3]="END",t[t.ERROR=4]="ERROR"}(Ti||(Ti={}));class Oi{constructor({encoding:t}){Ci(this,"binaryReader",new e),Ci(this,"textDecoder",void 0),Ci(this,"state",Ti.START),Ci(this,"result",{data:[]}),this.textDecoder=new TextDecoder(t)}write(t){this.binaryReader.write(t),this.state=ki(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=ki(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==Ti.END&&(this.state=Ti.ERROR,this.result.error="DBF incomplete file")}}function Ai(t,s={}){const i=s.dbf||{},{encoding:a}=i,e=new Oi({encoding:a});e.write(t),e.end();const{data:h,schema:n}=e.result;switch(s.tables&&s.tables.format){case"table":return{schema:n,rows:h};case"rows":default:return h}}function ki(t,s,i,a){for(;;)try{switch(t){case Ti.ERROR:case Ti.END:return t;case Ti.START:const h=i.getDataView(32,"DBF header");if(!h)return t;s.dbfHeader={year:(e=h).getUint8(1)+1900,month:e.getUint8(2),day:e.getUint8(3),nRecords:e.getUint32(4,!0),headerLength:e.getUint16(8,!0),recordLength:e.getUint16(10,!0),languageDriver:e.getUint8(29)},s.progress={bytesUsed:0,rowsTotal:s.dbfHeader.nRecords,rows:0},t=Ti.FIELD_DESCRIPTORS;break;case Ti.FIELD_DESCRIPTORS:const n=i.getDataView(s.dbfHeader.headerLength-32,"DBF field descriptors");if(!n)return t;s.dbfFields=Ri(n,a),s.schema=new ni(s.dbfFields.map(t=>ji(t))),t=Ti.FIELD_PROPERTIES,i.skip(1);break;case Ti.FIELD_PROPERTIES:const{recordLength:r=0,nRecords:o=0}=(null==s?void 0:s.dbfHeader)||{};for(;s.data.length<o;){const e=i.getDataView(r-1);if(!e)return t;i.skip(1);const h=Li(e,s.dbfFields,a);s.data.push(h),s.progress.rows=s.data.length}t=Ti.END;break;default:return t=Ti.ERROR,s.error="illegal parser state "+t,t}}catch(i){return t=Ti.ERROR,s.error="DBF parsing failed: "+i.message,t}var e}function Ri(t,s){const i=(t.byteLength-1)/32,a=[];let e=0;for(let h=0;h<i;h++){const i=s.decode(new Uint8Array(t.buffer,t.byteOffset+e,11)).replace(/\u0000/g,"");a.push({name:i,dataType:String.fromCharCode(t.getUint8(e+11)),fieldLength:t.getUint8(e+16),decimal:t.getUint8(e+17)}),e+=32}return a}function Li(t,s,i){const a={};let e=0;for(const h of s){const s=i.decode(new Uint8Array(t.buffer,t.byteOffset+e,h.fieldLength));a[h.name]=qi(s,h.dataType),e+=h.fieldLength}return a}function qi(t,s){switch(s){case"B":return Di(t);case"C":return function(t){return t.trim()||null}(t);case"F":case"N":case"O":return Di(t);case"D":return a=t,Date.UTC(a.slice(0,4),parseInt(a.slice(4,6),10)-1,a.slice(6,8));case"L":return!/^[nf]$/i.test(i=t)&&(!!/^[yt]$/i.test(i)||null);default:throw new Error("Unsupported data type")}var i,a}function Di(t){const s=parseFloat(t);return isNaN(s)?null:s}function ji({name:t,dataType:s,fieldLength:i,decimal:a}){switch(s){case"B":return new li(t,new Si,!0);case"C":return new li(t,new Ei,!0);case"F":case"N":case"O":return new li(t,new Si,!0);case"D":return new li(t,new Ni,!0);case"L":return new li(t,new vi,!0);default:throw new Error("Unsupported data type")}}const Bi={name:"DBF",id:"dbf",module:"shapefile",version:"3.1.0-alpha.4",worker:!0,category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"],options:{dbf:{encoding:"latin1"}}},zi={...Bi,parse:async(t,s)=>Ai(t,s),parseSync:Ai,parseInBatches:async function*(t,s={}){const i=s.dbf||{},{encoding:a}=i,e=new Oi({encoding:a});let h=!1;for await(const s of t)e.write(s),!h&&e.result.dbfHeader&&(h=!0,yield e.result.dbfHeader),e.result.data.length>0&&(yield e.result.data,e.result.data=[]);e.end(),e.result.data.length>0&&(yield e.result.data)}};function Gi(t){const s=[];for(const i of t)s.push(S(i));return s}function Fi(t,s){const i=[];for(let a=0;a<t.length;a++){const e={type:"Feature",geometry:t[a],properties:s&&s[a]||{}};i.push(e)}return i}function Ui(t,s,i){const a=new ai({from:s||"WGS84",to:i||"WGS84"});return function(t,s){for(const i of t)i.geometry.coordinates=I(i.geometry.coordinates,s);return t}(t,t=>a.project(t))}async function Wi(t,s){const{url:i,fetch:a}=s,e=a(Qi(i,"shx")),n=a(Qi(i,"cpg")),r=a(Qi(i,"prj"));let o,l,c;await Promise.all([e,n,r]);const u=await e;if(u.ok){o=function(t){const s=h(new DataView(t,0,100)).length-100,i=new DataView(t,100,s),a=new Int32Array(s),e=new Int32Array(s);for(let t=0;t<s/8;t++)a[t]=i.getInt32(8*t,!1),e[t]=i.getInt32(8*t+4,!1);return{offsets:a,lengths:e}}(await u.arrayBuffer())}const f=await n;f.ok&&(l=await f.text());const M=await r;return M.ok&&(c=await M.text()),{shx:o,cpg:l,prj:c}}function Qi(t,s){const i=function(t){const s=t&&t.lastIndexOf(".");if("number"==typeof s)return s>=0?t.substr(0,s):"";return s}(t),a=function(t){const s=t&&t.lastIndexOf(".");if("number"==typeof s)return s>=0?t.substr(s+1):"";return s}(t);return a===a.toUpperCase()&&(s=s.toUpperCase()),`${i}.${s}`}const Hi={name:"Shapefile",id:"shapefile",module:"shapefile",version:"3.1.0-alpha.4",category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(v).buffer],options:{shapefile:{},shp:{_maxDimensions:4}},parse:async function(t,s,i){const{reproject:a=!1,_targetCrs:e="WGS84"}=(null==s?void 0:s.gis)||{},{shx:h,cpg:n,prj:r}=await Wi(s,i),{header:o,geometries:l}=await i.parse(t,w,s),c=Gi(l);let u=[];const f=await i.fetch(Qi(i.url,"dbf"));f.ok&&(u=await i.parse(f,zi,{dbf:{encoding:n||"latin1"}}));let M=Fi(c,u);return a&&(M=Ui(M,r,e)),{encoding:n,prj:r,shx:h,header:o,data:M}},parseInBatches:async function*(t,s,i){const{reproject:a=!1,_targetCrs:e="WGS84"}=(null==s?void 0:s.gis)||{},{shx:h,cpg:n,prj:r}=await Wi(s,i),o=await i.parseInBatches(t,w,s);let l;const c=await i.fetch(Qi((null==i?void 0:i.url)||"","dbf"));c.ok&&(l=await i.parseInBatches(c,zi,{...s,dbf:{encoding:n||"latin1"}}));let u=(await o.next()).value;u&&"metadata"===u.batchType&&(u=(await o.next()).value);let f,M={};l&&(M=(await l.next()).value,M&&"metadata"===M.batchType&&(M=(await l.next()).value)),f=l?async function*(t,s){let i=[],a=[],e=!1,h=!1;for(;!e&&!h;){if(0!==i.length||e){if(0===a.length&&!h){const{value:t,done:i}=await s.next();i?h=!0:a=t}}else{const{value:s,done:a}=await t.next();a?e=!0:i=s}const n=ei(i,a);n&&(yield n)}}(o,l):o;for await(const t of f){let s,i;l?[s,i]=t:s=t;let o=Fi(Gi(s),i);a&&(o=Ui(o,r,e)),yield{encoding:n,prj:r,shx:h,header:u,data:o}}}}}])}));
2
- //# sourceMappingURL=dist.min.js.map