pwaLUPMIS2/dist/assets/shpjs-CNrRgkgn.js
ekke ef12e4477b Offline tile cache, polygon Divide, topographic layer integrations
Major feature batch covering drawing-tool improvements, layer additions,
and offline-first capabilities. Largest changes in MapView.js (+1700),
main.js (+1500), public/sw.js (+367), and new modules under src/.

Drawing & editing toolkit
  * Polygon Divide tool — sub-button under Split, divides a polygon into
    N equal-area pieces via binary search; user picks the cutting edge
  * UPN pick phase after Split and Divide — non-picked pieces have their
    identifier fields cleared automatically
  * Improved Merge algorithm — vertex-to-edge proximity (5 m tol.) with
    hybrid lockstep extension; bold A/B labels on selected polygons
  * Persistent vertex highlights — all vertices of the selected polygon
    rendered as dots while edit mode is on, without subclassing ol-ext
  * Toast notifications for merge/split/divide outcomes
  * Shapefile import — addGeoJSONLayer now includes an image style so
    Point features render (previously invisible)

Background & overlay layers
  * DEAfrica Coastlines v0.4 (WMS) in Biophysical Environment
  * DEAfrica Slope (SRTM 30m, style_slope) — semi-transparent background
  * Contours hillshade — get_contours_hillshade.php → local SQLite cache
  * OSM_roads — get_osm_roads.php → local SQLite cache, casing-stroke
    style (black 3.5 px outer, #F0F1F0 1.5 px inner)
  * External Source dialog — green + button in LayerSwitcher lets users
    add WMS / WFS / XYZ layers at runtime
  * Generic addWMSLayer / addXYZLayer with style, opacity, zIndex,
    legendUrl, onlineOnly options
  * TileWMS replaces ImageWMS (fixes 'Width exceeds 512' WMS errors)
  * Legend panel — bottom-right, auto-shown for visible layers that
    register a legendUrl
  * Default base map setting in Settings, persisted in localStorage;
    setBaseMap() on MapView

Offline tile cache (Phase 1 + 2)
  * Service worker: per-host tile caches (osm / topo / satellite /
    carto-light / carto-dark), counter-based eviction to prevent
    iOS Safari memory-pressure reloads, GET_TILE_STATS /
    CLEAR_TILE_CACHES message API
  * pwa.js helpers: getActiveServiceWorker, onServiceWorkerControllerChange,
    getTileCacheStats, clearTileCaches, getStorageEstimate
  * Settings: Offline Map Tiles card with per-provider stats + clear
  * Phase 2 download dialog: form to pick base map, area (current view /
    district / Ghana), zoom range; live tile-count + size estimate;
    progress bar with cancel; OfflineTileDownloader class with
    concurrency + throttling

Local database management
  * osm_roads table + saveOSMRoads / getLocalOSMRoads helpers
  * CACHED_LAYER_TABLES allow-list with clearTable / clearAllCachedLayers
  * Local Database Tables card: per-row Clear button (cached layers
    only) + 'Refresh cached layers' header button with reload prompt

Build & infrastructure
  * Shpjs lazy-loaded via dynamic import (saves ~140 kB from initial JS)
  * chunkSizeWarningLimit raised to 900 kB (openlayers + sqlite3.wasm
    can't be split further)
  * Toast notification module (src/toast.js)
  * Units module (src/units.js) for metric / imperial conversions
  * PDF export module (src/pdf-export.js)

Documentation & SQL
  * Topographic_Background_Layers_for_LUPMIS2.docx — research report
  * OpenTopography_Workflow.svg/.png — ETL pipeline diagram
  * LUPMIS2_Development_Status_Report.docx — April update section
  * sql/create_landuse_parcels.sql — PostgreSQL schema for the LUSPA
    land-use parcel specification (Feb 2026, revised), with PostGIS
    geometry column and standard indices

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 10:55:30 +02:00

6 lines
137 KiB
JavaScript

function As(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");for(var i=1;i<=60;++i)t("EPSG:"+(32600+i),"+proj=utm +zone="+i+" +datum=WGS84 +units=m"),t("EPSG:"+(32700+i),"+proj=utm +zone="+i+" +south +datum=WGS84 +units=m");t("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}var st=1,at=2,ct=3,ps=4,ai=5,xi=6378137,Ns=6356752314e-3,Gi=.0066943799901413165,wt=484813681109536e-20,M=Math.PI/2,Is=.16666666666666666,Cs=.04722222222222222,Rs=.022156084656084655,y=1e-10,I=.017453292519943295,k=57.29577951308232,b=Math.PI/4,Gt=Math.PI*2,C=3.14159265359,$={};$.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;const Os={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var bi=/[\s_\-\/\(\)]/g;function Z(t,i){if(t[i])return t[i];for(var s=Object.keys(t),a=i.toLowerCase().replace(bi,""),e=-1,r,h;++e<s.length;)if(r=s[e],h=r.toLowerCase().replace(bi,""),h===a)return t[r]}function ei(t){var i={},s=t.split("+").map(function(n){return n.trim()}).filter(function(n){return n}).reduce(function(n,o){var l=o.split("=");return l.push(!0),n[l[0].toLowerCase()]=l[1],n},{}),a,e,r,h={proj:"projName",datum:"datumCode",rf:function(n){i.rf=parseFloat(n)},lat_0:function(n){i.lat0=n*I},lat_1:function(n){i.lat1=n*I},lat_2:function(n){i.lat2=n*I},lat_ts:function(n){i.lat_ts=n*I},lon_0:function(n){i.long0=n*I},lon_1:function(n){i.long1=n*I},lon_2:function(n){i.long2=n*I},alpha:function(n){i.alpha=parseFloat(n)*I},gamma:function(n){i.rectified_grid_angle=parseFloat(n)*I},lonc:function(n){i.longc=n*I},x_0:function(n){i.x0=parseFloat(n)},y_0:function(n){i.y0=parseFloat(n)},k_0:function(n){i.k0=parseFloat(n)},k:function(n){i.k0=parseFloat(n)},a:function(n){i.a=parseFloat(n)},b:function(n){i.b=parseFloat(n)},r:function(n){i.a=i.b=parseFloat(n)},r_a:function(){i.R_A=!0},zone:function(n){i.zone=parseInt(n,10)},south:function(){i.utmSouth=!0},towgs84:function(n){i.datum_params=n.split(",").map(function(o){return parseFloat(o)})},to_meter:function(n){i.to_meter=parseFloat(n)},units:function(n){i.units=n;var o=Z(Os,n);o&&(i.to_meter=o.to_meter)},from_greenwich:function(n){i.from_greenwich=n*I},pm:function(n){var o=Z($,n);i.from_greenwich=(o||parseFloat(n))*I},nadgrids:function(n){n==="@null"?i.datumCode="none":i.nadgrids=n},axis:function(n){var o="ewnsud";n.length===3&&o.indexOf(n.substr(0,1))!==-1&&o.indexOf(n.substr(1,1))!==-1&&o.indexOf(n.substr(2,1))!==-1&&(i.axis=n)},approx:function(){i.approx=!0},over:function(){i.over=!0}};for(a in s)e=s[a],a in h?(r=h[a],typeof r=="function"?r(e):i[r]=e):i[a]=e;return typeof i.datumCode=="string"&&i.datumCode!=="WGS84"&&(i.datumCode=i.datumCode.toLowerCase()),i.projStr=t,i}class Ji{static getId(i){const s=i.find(a=>Array.isArray(a)&&a[0]==="ID");return s&&s.length>=3?{authority:s[1],code:parseInt(s[2],10)}:null}static convertUnit(i,s="unit"){if(!i||i.length<3)return{type:s,name:"unknown",conversion_factor:null};const a=i[1],e=parseFloat(i[2])||null,r=i.find(n=>Array.isArray(n)&&n[0]==="ID"),h=r?{authority:r[1],code:parseInt(r[2],10)}:null;return{type:s,name:a,conversion_factor:e,id:h}}static convertAxis(i){const s=i[1]||"Unknown";let a;const e=s.match(/^\((.)\)$/);if(e){const l=e[1].toUpperCase();if(l==="E")a="east";else if(l==="N")a="north";else if(l==="U")a="up";else throw new Error(`Unknown axis abbreviation: ${l}`)}else a=i[2]?i[2].toLowerCase():"unknown";const r=i.find(l=>Array.isArray(l)&&l[0]==="ORDER"),h=r?parseInt(r[1],10):null,n=i.find(l=>Array.isArray(l)&&(l[0]==="LENGTHUNIT"||l[0]==="ANGLEUNIT"||l[0]==="SCALEUNIT")),o=this.convertUnit(n);return{name:s,direction:a,unit:o,order:h}}static extractAxes(i){return i.filter(s=>Array.isArray(s)&&s[0]==="AXIS").map(s=>this.convertAxis(s)).sort((s,a)=>(s.order||0)-(a.order||0))}static convert(i,s={}){switch(i[0]){case"PROJCRS":s.type="ProjectedCRS",s.name=i[1],s.base_crs=i.find(f=>Array.isArray(f)&&f[0]==="BASEGEOGCRS")?this.convert(i.find(f=>Array.isArray(f)&&f[0]==="BASEGEOGCRS")):null,s.conversion=i.find(f=>Array.isArray(f)&&f[0]==="CONVERSION")?this.convert(i.find(f=>Array.isArray(f)&&f[0]==="CONVERSION")):null;const a=i.find(f=>Array.isArray(f)&&f[0]==="CS");a&&(s.coordinate_system={type:a[1],axis:this.extractAxes(i)});const e=i.find(f=>Array.isArray(f)&&f[0]==="LENGTHUNIT");if(e){const f=this.convertUnit(e);s.coordinate_system.unit=f}s.id=this.getId(i);break;case"BASEGEOGCRS":case"GEOGCRS":s.type="GeographicCRS",s.name=i[1];const r=i.find(f=>Array.isArray(f)&&(f[0]==="DATUM"||f[0]==="ENSEMBLE"));if(r){const f=this.convert(r);r[0]==="ENSEMBLE"?s.datum_ensemble=f:s.datum=f;const _=i.find(g=>Array.isArray(g)&&g[0]==="PRIMEM");_&&_[1]!=="Greenwich"&&(f.prime_meridian={name:_[1],longitude:parseFloat(_[2])})}s.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(i)},s.id=this.getId(i);break;case"DATUM":s.type="GeodeticReferenceFrame",s.name=i[1],s.ellipsoid=i.find(f=>Array.isArray(f)&&f[0]==="ELLIPSOID")?this.convert(i.find(f=>Array.isArray(f)&&f[0]==="ELLIPSOID")):null;break;case"ENSEMBLE":s.type="DatumEnsemble",s.name=i[1],s.members=i.filter(f=>Array.isArray(f)&&f[0]==="MEMBER").map(f=>({type:"DatumEnsembleMember",name:f[1],id:this.getId(f)}));const h=i.find(f=>Array.isArray(f)&&f[0]==="ENSEMBLEACCURACY");h&&(s.accuracy=parseFloat(h[1]));const n=i.find(f=>Array.isArray(f)&&f[0]==="ELLIPSOID");n&&(s.ellipsoid=this.convert(n)),s.id=this.getId(i);break;case"ELLIPSOID":s.type="Ellipsoid",s.name=i[1],s.semi_major_axis=parseFloat(i[2]),s.inverse_flattening=parseFloat(i[3]),i.find(f=>Array.isArray(f)&&f[0]==="LENGTHUNIT")&&this.convert(i.find(f=>Array.isArray(f)&&f[0]==="LENGTHUNIT"),s);break;case"CONVERSION":s.type="Conversion",s.name=i[1],s.method=i.find(f=>Array.isArray(f)&&f[0]==="METHOD")?this.convert(i.find(f=>Array.isArray(f)&&f[0]==="METHOD")):null,s.parameters=i.filter(f=>Array.isArray(f)&&f[0]==="PARAMETER").map(f=>this.convert(f));break;case"METHOD":s.type="Method",s.name=i[1],s.id=this.getId(i);break;case"PARAMETER":s.type="Parameter",s.name=i[1],s.value=parseFloat(i[2]),s.unit=this.convertUnit(i.find(f=>Array.isArray(f)&&(f[0]==="LENGTHUNIT"||f[0]==="ANGLEUNIT"||f[0]==="SCALEUNIT"))),s.id=this.getId(i);break;case"BOUNDCRS":s.type="BoundCRS";const o=i.find(f=>Array.isArray(f)&&f[0]==="SOURCECRS");if(o){const f=o.find(_=>Array.isArray(_));s.source_crs=f?this.convert(f):null}const l=i.find(f=>Array.isArray(f)&&f[0]==="TARGETCRS");if(l){const f=l.find(_=>Array.isArray(_));s.target_crs=f?this.convert(f):null}const u=i.find(f=>Array.isArray(f)&&f[0]==="ABRIDGEDTRANSFORMATION");u?s.transformation=this.convert(u):s.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(s.type="Transformation",s.name=i[1],s.method=i.find(f=>Array.isArray(f)&&f[0]==="METHOD")?this.convert(i.find(f=>Array.isArray(f)&&f[0]==="METHOD")):null,s.parameters=i.filter(f=>Array.isArray(f)&&(f[0]==="PARAMETER"||f[0]==="PARAMETERFILE")).map(f=>{if(f[0]==="PARAMETER")return this.convert(f);if(f[0]==="PARAMETERFILE")return{name:f[1],value:f[2],id:{authority:"EPSG",code:8656}}}),s.parameters.length===7){const f=s.parameters[6];f.name==="Scale difference"&&(f.value=Math.round((f.value-1)*1e12)/1e6)}s.id=this.getId(i);break;case"AXIS":s.coordinate_system||(s.coordinate_system={type:"unspecified",axis:[]}),s.coordinate_system.axis.push(this.convertAxis(i));break;case"LENGTHUNIT":const c=this.convertUnit(i,"LinearUnit");s.coordinate_system&&s.coordinate_system.axis&&s.coordinate_system.axis.forEach(f=>{f.unit||(f.unit=c)}),c.conversion_factor&&c.conversion_factor!==1&&s.semi_major_axis&&(s.semi_major_axis={value:s.semi_major_axis,unit:c});break;default:s.keyword=i[0];break}return s}}class Ts extends Ji{static convert(i,s={}){return super.convert(i,s),s.coordinate_system&&s.coordinate_system.subtype==="Cartesian"&&delete s.coordinate_system,s.usage&&delete s.usage,s}}class Ls extends Ji{static convert(i,s={}){super.convert(i,s);const a=i.find(r=>Array.isArray(r)&&r[0]==="CS");a&&(s.coordinate_system={subtype:a[1],axis:this.extractAxes(i)});const e=i.find(r=>Array.isArray(r)&&r[0]==="USAGE");if(e){const r=e.find(o=>Array.isArray(o)&&o[0]==="SCOPE"),h=e.find(o=>Array.isArray(o)&&o[0]==="AREA"),n=e.find(o=>Array.isArray(o)&&o[0]==="BBOX");s.usage={},r&&(s.usage.scope=r[1]),h&&(s.usage.area=h[1]),n&&(s.usage.bbox=n.slice(1))}return s}}function qs(t){return t.find(i=>Array.isArray(i)&&i[0]==="USAGE")?"2019":(t.find(i=>Array.isArray(i)&&i[0]==="CS")||t[0]==="BOUNDCRS"||t[0]==="PROJCRS"||t[0]==="GEOGCRS","2015")}function Us(t){return(qs(t)==="2019"?Ls:Ts).convert(t)}function Fs(t){const i=t.toUpperCase();return i.includes("PROJCRS")||i.includes("GEOGCRS")||i.includes("BOUNDCRS")||i.includes("VERTCRS")||i.includes("LENGTHUNIT")||i.includes("ANGLEUNIT")||i.includes("SCALEUNIT")?"WKT2":(i.includes("PROJCS")||i.includes("GEOGCS")||i.includes("LOCAL_CS")||i.includes("VERT_CS")||i.includes("UNIT"),"WKT1")}var bt=1,Ki=2,Zi=3,jt=4,Yi=5,fi=-1,Ds=/\s/,ks=/[A-Za-z]/,$s=/[A-Za-z84_]/,Jt=/[,\]]/,ts=/[\d\.E\-\+]/;function V(t){if(typeof t!="string")throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=bt}V.prototype.readCharicter=function(){var t=this.text[this.place++];if(this.state!==jt)for(;Ds.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case bt:return this.neutral(t);case Ki:return this.keyword(t);case jt:return this.quoted(t);case Yi:return this.afterquote(t);case Zi:return this.number(t);case fi:return}};V.prototype.afterquote=function(t){if(t==='"'){this.word+='"',this.state=jt;return}if(Jt.test(t)){this.word=this.word.trim(),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in afterquote yet, index '+this.place)};V.prototype.afterItem=function(t){if(t===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=bt;return}if(t==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=bt,this.currentObject=this.stack.pop(),this.currentObject||(this.state=fi);return}};V.prototype.number=function(t){if(ts.test(t)){this.word+=t;return}if(Jt.test(t)){this.word=parseFloat(this.word),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in number yet, index '+this.place)};V.prototype.quoted=function(t){if(t==='"'){this.state=Yi;return}this.word+=t};V.prototype.keyword=function(t){if($s.test(t)){this.word+=t;return}if(t==="["){var i=[];i.push(this.word),this.level++,this.root===null?this.root=i:this.currentObject.push(i),this.stack.push(this.currentObject),this.currentObject=i,this.state=bt;return}if(Jt.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in keyword yet, index '+this.place)};V.prototype.neutral=function(t){if(ks.test(t)){this.word=t,this.state=Ki;return}if(t==='"'){this.word="",this.state=jt;return}if(ts.test(t)){this.word=t,this.state=Zi;return}if(Jt.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in neutral yet, index '+this.place)};V.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===fi)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function js(t){var i=new V(t);return i.output()}function Zt(t,i,s){Array.isArray(i)&&(s.unshift(i),i=null);var a=i?{}:t,e=s.reduce(function(r,h){return ht(h,r),r},a);i&&(t[i]=e)}function ht(t,i){if(!Array.isArray(t)){i[t]=!0;return}var s=t.shift();if(s==="PARAMETER"&&(s=t.shift()),t.length===1){if(Array.isArray(t[0])){i[s]={},ht(t[0],i[s]);return}i[s]=t[0];return}if(!t.length){i[s]=!0;return}if(s==="TOWGS84"){i[s]=t;return}if(s==="AXIS"){s in i||(i[s]=[]),i[s].push(t);return}Array.isArray(s)||(i[s]={});var a;switch(s){case"UNIT":case"PRIMEM":case"VERT_DATUM":i[s]={name:t[0].toLowerCase(),convert:t[1]},t.length===3&&ht(t[2],i[s]);return;case"SPHEROID":case"ELLIPSOID":i[s]={name:t[0],a:t[1],rf:t[2]},t.length===4&&ht(t[3],i[s]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":t[0]=["name",t[0]],Zt(i,s,t);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":t[0]=["name",t[0]],Zt(i,s,t),i[s].type=s;return;default:for(a=-1;++a<t.length;)if(!Array.isArray(t[a]))return ht(t,i[s]);return Zt(i,s,t)}}var Bs=.017453292519943295;function W(t){return t*Bs}function is(t){const i=(t.projName||"").toLowerCase().replace(/_/g," ");!t.long0&&t.longc&&(i==="albers conic equal area"||i==="lambert azimuthal equal area")&&(t.long0=t.longc),!t.lat_ts&&t.lat1&&(i==="stereographic south pole"||i==="polar stereographic (variant b)")?(t.lat0=W(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1):!t.lat_ts&&t.lat0&&(i==="polar stereographic"||i==="polar stereographic (variant a)")&&(t.lat_ts=t.lat0,t.lat0=W(t.lat0>0?90:-90),delete t.lat1)}function Ai(t){let i={units:null,to_meter:void 0};return typeof t=="string"?(i.units=t.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.units==="meter"&&(i.to_meter=1)):t&&t.name&&(i.units=t.name.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.to_meter=t.conversion_factor),i}function pi(t){return typeof t=="object"?t.value*t.unit.conversion_factor:t}function Ni(t,i){t.ellipsoid.radius?(i.a=t.ellipsoid.radius,i.rf=0):(i.a=pi(t.ellipsoid.semi_major_axis),t.ellipsoid.inverse_flattening!==void 0?i.rf=t.ellipsoid.inverse_flattening:t.ellipsoid.semi_major_axis!==void 0&&t.ellipsoid.semi_minor_axis!==void 0&&(i.rf=i.a/(i.a-pi(t.ellipsoid.semi_minor_axis))))}function Bt(t,i={}){return!t||typeof t!="object"?t:t.type==="BoundCRS"?(Bt(t.source_crs,i),t.transformation&&(t.transformation.method&&t.transformation.method.name==="NTv2"?i.nadgrids=t.transformation.parameters[0].value:i.datum_params=t.transformation.parameters.map(s=>s.value)),i):(Object.keys(t).forEach(s=>{const a=t[s];if(a!==null)switch(s){case"name":if(i.srsCode)break;i.name=a,i.srsCode=a;break;case"type":a==="GeographicCRS"?i.projName="longlat":a==="ProjectedCRS"&&t.conversion&&t.conversion.method&&(i.projName=t.conversion.method.name);break;case"datum":case"datum_ensemble":a.ellipsoid&&(i.ellps=a.ellipsoid.name,Ni(a,i)),a.prime_meridian&&(i.from_greenwich=a.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":i.ellps=a.name,Ni(a,i);break;case"prime_meridian":i.long0=(a.longitude||0)*Math.PI/180;break;case"coordinate_system":if(a.axis){if(i.axis=a.axis.map(e=>{const r=e.direction;if(r==="east")return"e";if(r==="north")return"n";if(r==="west")return"w";if(r==="south")return"s";throw new Error(`Unknown axis direction: ${r}`)}).join("")+"u",a.unit){const{units:e,to_meter:r}=Ai(a.unit);i.units=e,i.to_meter=r}else if(a.axis[0]&&a.axis[0].unit){const{units:e,to_meter:r}=Ai(a.axis[0].unit);i.units=e,i.to_meter=r}}break;case"id":a.authority&&a.code&&(i.title=a.authority+":"+a.code);break;case"conversion":a.method&&a.method.name&&(i.projName=a.method.name),a.parameters&&a.parameters.forEach(e=>{const r=e.name.toLowerCase().replace(/\s+/g,"_"),h=e.value;e.unit&&e.unit.conversion_factor?i[r]=h*e.unit.conversion_factor:e.unit==="degree"?i[r]=h*Math.PI/180:i[r]=h});break;case"unit":a.name&&(i.units=a.name.toLowerCase(),i.units==="metre"&&(i.units="meter")),a.conversion_factor&&(i.to_meter=a.conversion_factor);break;case"base_crs":Bt(a,i),i.datumCode=a.id?a.id.authority+"_"+a.id.code:a.name;break}}),i.latitude_of_false_origin!==void 0&&(i.lat0=i.latitude_of_false_origin),i.longitude_of_false_origin!==void 0&&(i.long0=i.longitude_of_false_origin),i.latitude_of_standard_parallel!==void 0&&(i.lat0=i.latitude_of_standard_parallel,i.lat1=i.latitude_of_standard_parallel),i.latitude_of_1st_standard_parallel!==void 0&&(i.lat1=i.latitude_of_1st_standard_parallel),i.latitude_of_2nd_standard_parallel!==void 0&&(i.lat2=i.latitude_of_2nd_standard_parallel),i.latitude_of_projection_centre!==void 0&&(i.lat0=i.latitude_of_projection_centre),i.longitude_of_projection_centre!==void 0&&(i.longc=i.longitude_of_projection_centre),i.easting_at_false_origin!==void 0&&(i.x0=i.easting_at_false_origin),i.northing_at_false_origin!==void 0&&(i.y0=i.northing_at_false_origin),i.latitude_of_natural_origin!==void 0&&(i.lat0=i.latitude_of_natural_origin),i.longitude_of_natural_origin!==void 0&&(i.long0=i.longitude_of_natural_origin),i.longitude_of_origin!==void 0&&(i.long0=i.longitude_of_origin),i.false_easting!==void 0&&(i.x0=i.false_easting),i.easting_at_projection_centre&&(i.x0=i.easting_at_projection_centre),i.false_northing!==void 0&&(i.y0=i.false_northing),i.northing_at_projection_centre&&(i.y0=i.northing_at_projection_centre),i.standard_parallel_1!==void 0&&(i.lat1=i.standard_parallel_1),i.standard_parallel_2!==void 0&&(i.lat2=i.standard_parallel_2),i.scale_factor_at_natural_origin!==void 0&&(i.k0=i.scale_factor_at_natural_origin),i.scale_factor_at_projection_centre!==void 0&&(i.k0=i.scale_factor_at_projection_centre),i.scale_factor_on_pseudo_standard_parallel!==void 0&&(i.k0=i.scale_factor_on_pseudo_standard_parallel),i.azimuth!==void 0&&(i.alpha=i.azimuth),i.azimuth_at_projection_centre!==void 0&&(i.alpha=i.azimuth_at_projection_centre),i.angle_from_rectified_to_skew_grid&&(i.rectified_grid_angle=i.angle_from_rectified_to_skew_grid),is(i),i)}var zs=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Ws(t,i){var s=i[0],a=i[1];!(s in t)&&a in t&&(t[s]=t[a],i.length===3&&(t[s]=i[2](t[s])))}function ss(t){for(var i=Object.keys(t),s=0,a=i.length;s<a;++s){var e=i[s];zs.indexOf(e)!==-1&&Hs(t[e]),typeof t[e]=="object"&&ss(t[e])}}function Hs(t){if(t.AUTHORITY){var i=Object.keys(t.AUTHORITY)[0];i&&i in t.AUTHORITY&&(t.title=i+":"+t.AUTHORITY[i])}if(t.type==="GEOGCS"?t.projName="longlat":t.type==="LOCAL_CS"?(t.projName="identity",t.local=!0):typeof t.PROJECTION=="object"?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var s="",a=0,e=t.AXIS.length;a<e;++a){var r=[t.AXIS[a][0].toLowerCase(),t.AXIS[a][1].toLowerCase()];r[0].indexOf("north")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="north"?s+="n":r[0].indexOf("south")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="south"?s+="s":r[0].indexOf("east")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="east"?s+="e":(r[0].indexOf("west")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="west")&&(s+="w")}s.length===2&&(s+="u"),s.length===3&&(t.axis=s)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.UNIT.convert&&(t.type==="GEOGCS"?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var h=t.GEOGCS;t.type==="GEOGCS"&&(h=t),h&&(h.DATUM?t.datumCode=h.DATUM.name.toLowerCase():t.datumCode=h.name.toLowerCase(),t.datumCode.slice(0,2)==="d_"&&(t.datumCode=t.datumCode.slice(2)),t.datumCode==="new_zealand_1949"&&(t.datumCode="nzgd49"),(t.datumCode==="wgs_1984"||t.datumCode==="world_geodetic_system_1984")&&(t.PROJECTION==="Mercator_Auxiliary_Sphere"&&(t.sphere=!0),t.datumCode="wgs84"),t.datumCode==="belge_1972"&&(t.datumCode="rnb72"),h.DATUM&&h.DATUM.SPHEROID&&(t.ellps=h.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),t.ellps.toLowerCase().slice(0,13)==="international"&&(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"),t.datumCode==="ch1903+"&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),t.rectified_grid_angle&&(t.rectified_grid_angle=W(t.rectified_grid_angle));function n(u){var c=t.to_meter||1;return u*c}var o=function(u){return Ws(t,u)},l=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",W],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",W],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",W],["lat0","latitude_of_origin",W],["lat0","standard_parallel_1",W],["lat1","standard_parallel_1",W],["lat2","standard_parallel_2",W],["azimuth","Azimuth"],["alpha","azimuth",W],["srsCode","name"]];l.forEach(o),is(t)}function zt(t){if(typeof t=="object")return Bt(t);const i=Fs(t);var s=js(t);if(i==="WKT2"){const r=Us(s);return Bt(r)}var a=s[0],e={};return ht(s,e),ss(e),e[a]}function T(t){var i=this;if(arguments.length===2){var s=arguments[1];typeof s=="string"?s.charAt(0)==="+"?T[t]=ei(arguments[1]):T[t]=zt(arguments[1]):s&&typeof s=="object"&&!("projName"in s)?T[t]=zt(arguments[1]):(T[t]=s,s||delete T[t])}else if(arguments.length===1){if(Array.isArray(t))return t.map(function(a){return Array.isArray(a)?T.apply(i,a):T(a)});if(typeof t=="string"){if(t in T)return T[t]}else"EPSG"in t?T["EPSG:"+t.EPSG]=t:"ESRI"in t?T["ESRI:"+t.ESRI]=t:"IAU2000"in t?T["IAU2000:"+t.IAU2000]=t:console.log(t);return}}As(T);function Qs(t){return typeof t=="string"}function Vs(t){return t in T}function Xs(t){return t.indexOf("+")!==0&&t.indexOf("[")!==-1||typeof t=="object"&&!("srsCode"in t)}var Ii=["3857","900913","3785","102113"];function Js(t){if(t.title)return t.title.toLowerCase().indexOf("epsg:")===0&&Ii.indexOf(t.title.substr(5))>-1;var i=Z(t,"authority");if(i){var s=Z(i,"epsg");return s&&Ii.indexOf(s)>-1}}function Ks(t){var i=Z(t,"extension");if(i)return Z(i,"proj4")}function Zs(t){return t[0]==="+"}function Ys(t){if(Qs(t)){if(Vs(t))return T[t];if(Xs(t)){var i=zt(t);if(Js(i))return T["EPSG:3857"];var s=Ks(i);return s?ei(s):i}if(Zs(t))return ei(t)}else return"projName"in t?t:zt(t)}function Ci(t,i){t=t||{};var s,a;if(!i)return t;for(a in i)s=i[a],s!==void 0&&(t[a]=s);return t}function Q(t,i,s){var a=t*i;return s/Math.sqrt(1-a*a)}function It(t){return t<0?-1:1}function m(t,i){return i||Math.abs(t)<=C?t:t-It(t)*Gt}function H(t,i,s){var a=t*s,e=.5*t;return a=Math.pow((1-a)/(1+a),e),Math.tan(.5*(M-i))/a}function At(t,i){for(var s=.5*t,a,e,r=M-2*Math.atan(i),h=0;h<=15;h++)if(a=t*Math.sin(r),e=M-2*Math.atan(i*Math.pow((1-a)/(1+a),s))-r,r+=e,Math.abs(e)<=1e-10)return r;return-9999}function ta(){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=Q(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function ia(t){var i=t.x,s=t.y;if(s*k>90&&s*k<-90&&i*k>180&&i*k<-180)return null;var a,e;if(Math.abs(Math.abs(s)-M)<=y)return null;if(this.sphere)a=this.x0+this.a*this.k0*m(i-this.long0,this.over),e=this.y0+this.a*this.k0*Math.log(Math.tan(b+.5*s));else{var r=Math.sin(s),h=H(this.e,s,r);a=this.x0+this.a*this.k0*m(i-this.long0,this.over),e=this.y0-this.a*this.k0*Math.log(h)}return t.x=a,t.y=e,t}function sa(t){var i=t.x-this.x0,s=t.y-this.y0,a,e;if(this.sphere)e=M-2*Math.atan(Math.exp(-s/(this.a*this.k0)));else{var r=Math.exp(-s/(this.a*this.k0));if(e=At(this.e,r),e===-9999)return null}return a=m(this.long0+i/(this.a*this.k0),this.over),t.x=a,t.y=e,t}var aa=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"];const ea={init:ta,forward:ia,inverse:sa,names:aa};function ra(){}function Ri(t){return t}var as=["longlat","identity"];const na={init:ra,forward:Ri,inverse:Ri,names:as};var ha=[ea,na],it={},ot=[];function es(t,i){var s=ot.length;return t.names?(ot[s]=t,t.names.forEach(function(a){it[a.toLowerCase()]=s}),this):(console.log(i),!0)}function rs(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}function oa(t){if(!t)return!1;var i=t.toLowerCase();if(typeof it[i]<"u"&&ot[it[i]]||(i=rs(i),i in it&&ot[it[i]]))return ot[it[i]]}function la(){ha.forEach(es)}const fa={start:la,add:es,get:oa};var ns={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}};const ca=ns.WGS84;function ua(t,i,s,a){var e=t*t,r=i*i,h=(e-r)/e,n=0;a?(t*=1-h*(Is+h*(Cs+h*Rs)),e=t*t,h=0):n=Math.sqrt(h);var o=(e-r)/r;return{es:h,e:n,ep2:o}}function _a(t,i,s,a,e){if(!t){var r=Z(ns,a);r||(r=ca),t=r.a,i=r.b,s=r.rf}return s&&!i&&(i=(1-1/s)*t),(s===0||Math.abs(t-i)<y)&&(e=!0,i=t),{a:t,b:i,rf:s,sphere:e}}var Ft={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.0276,-0.2167,0.2147,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-1.91514,1.60363,-9.09546,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243649,-1.158827,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,32.39344,-153.25684,-96.2266,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-8.393,0.749,-10.276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,1.25033e-7,4.6785e-8,5.6529e-8,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"61.55,-10.87,-40.19,39.4924,32.7221,32.8979,-9.994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"374,150,588"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"}};for(var ga in Ft){var Yt=Ft[ga];Yt.datumName&&(Ft[Yt.datumName]=Yt)}function Ma(t,i,s,a,e,r,h){var n={};return t===void 0||t==="none"?n.datum_type=ai:n.datum_type=ps,i&&(n.datum_params=i.map(parseFloat),(n.datum_params[0]!==0||n.datum_params[1]!==0||n.datum_params[2]!==0)&&(n.datum_type=st),n.datum_params.length>3&&(n.datum_params[3]!==0||n.datum_params[4]!==0||n.datum_params[5]!==0||n.datum_params[6]!==0)&&(n.datum_type=at,n.datum_params[3]*=wt,n.datum_params[4]*=wt,n.datum_params[5]*=wt,n.datum_params[6]=n.datum_params[6]/1e6+1)),h&&(n.datum_type=ct,n.grids=h),n.a=s,n.b=a,n.es=e,n.ep2=r,n}var ci={};function va(t,i,s){return i instanceof ArrayBuffer?da(t,i,s):{ready:ya(t,i)}}function da(t,i,s){var a=!0;s!==void 0&&s.includeErrorFields===!1&&(a=!1);var e=new DataView(i),r=Ea(e),h=Sa(e,r),n=Pa(e,h,r,a),o={header:h,subgrids:n};return ci[t]=o,o}async function ya(t,i){for(var s=[],a=await i.getImageCount(),e=a-1;e>=0;e--){var r=await i.getImage(e),h=await r.readRasters(),n=h,o=[r.getWidth(),r.getHeight()],l=r.getBoundingBox().map(Oi),u=[r.fileDirectory.ModelPixelScale[0],r.fileDirectory.ModelPixelScale[1]].map(Oi),c=l[0]+(o[0]-1)*u[0],f=l[3]-(o[1]-1)*u[1],_=n[0],g=n[1],v=[];for(let E=o[1]-1;E>=0;E--)for(let S=o[0]-1;S>=0;S--){var d=E*o[0]+S;v.push([-J(g[d]),J(_[d])])}s.push({del:u,lim:o,ll:[-c,f],cvs:v})}var w={header:{nSubgrids:a},subgrids:s};return ci[t]=w,w}function ma(t){if(t===void 0)return null;var i=t.split(",");return i.map(wa)}function wa(t){if(t.length===0)return null;var i=t[0]==="@";return i&&(t=t.slice(1)),t==="null"?{name:"null",mandatory:!i,grid:null,isNull:!0}:{name:t,mandatory:!i,grid:ci[t]||null,isNull:!1}}function Oi(t){return t*Math.PI/180}function J(t){return t/3600*Math.PI/180}function Ea(t){var i=t.getInt32(8,!1);return i===11?!1:(i=t.getInt32(8,!0),i!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function Sa(t,i){return{nFields:t.getInt32(8,i),nSubgridFields:t.getInt32(24,i),nSubgrids:t.getInt32(40,i),shiftType:ri(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,i),fromSemiMinorAxis:t.getFloat64(136,i),toSemiMajorAxis:t.getFloat64(152,i),toSemiMinorAxis:t.getFloat64(168,i)}}function ri(t,i,s){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(i,s)))}function Pa(t,i,s,a){for(var e=176,r=[],h=0;h<i.nSubgrids;h++){var n=Ga(t,e,s),o=ba(t,e,n,s,a),l=Math.round(1+(n.upperLongitude-n.lowerLongitude)/n.longitudeInterval),u=Math.round(1+(n.upperLatitude-n.lowerLatitude)/n.latitudeInterval);r.push({ll:[J(n.lowerLongitude),J(n.lowerLatitude)],del:[J(n.longitudeInterval),J(n.latitudeInterval)],lim:[l,u],count:n.gridNodeCount,cvs:xa(o)});var c=16;a===!1&&(c=8),e+=176+n.gridNodeCount*c}return r}function xa(t){return t.map(function(i){return[J(i.longitudeShift),J(i.latitudeShift)]})}function Ga(t,i,s){return{name:ri(t,i+8,i+16).trim(),parent:ri(t,i+24,i+24+8).trim(),lowerLatitude:t.getFloat64(i+72,s),upperLatitude:t.getFloat64(i+88,s),lowerLongitude:t.getFloat64(i+104,s),upperLongitude:t.getFloat64(i+120,s),latitudeInterval:t.getFloat64(i+136,s),longitudeInterval:t.getFloat64(i+152,s),gridNodeCount:t.getInt32(i+168,s)}}function ba(t,i,s,a,e){var r=i+176,h=16;e===!1&&(h=8);for(var n=[],o=0;o<s.gridNodeCount;o++){var l={latitudeShift:t.getFloat32(r+o*h,a),longitudeShift:t.getFloat32(r+o*h+4,a)};e!==!1&&(l.latitudeAccuracy=t.getFloat32(r+o*h+8,a),l.longitudeAccuracy=t.getFloat32(r+o*h+12,a)),n.push(l)}return n}function z(t,i){if(!(this instanceof z))return new z(t);this.forward=null,this.inverse=null,this.init=null,this.name,this.names=null,this.title,i=i||function(l){if(l)throw l};var s=Ys(t);if(typeof s!="object"){i("Could not parse to valid json: "+t);return}var a=z.projections.get(s.projName);if(!a){i("Could not get projection name from: "+t);return}if(s.datumCode&&s.datumCode!=="none"){var e=Z(Ft,s.datumCode);e&&(s.datum_params=s.datum_params||(e.towgs84?e.towgs84.split(","):null),s.ellps=e.ellipse,s.datumName=e.datumName?e.datumName:s.datumCode)}s.k0=s.k0||1,s.axis=s.axis||"enu",s.ellps=s.ellps||"wgs84",s.lat1=s.lat1||s.lat0;var r=_a(s.a,s.b,s.rf,s.ellps,s.sphere),h=ua(r.a,r.b,r.rf,s.R_A),n=ma(s.nadgrids),o=s.datum||Ma(s.datumCode,s.datum_params,r.a,r.b,h.es,h.ep2,n);Ci(this,s),Ci(this,a),this.a=r.a,this.b=r.b,this.rf=r.rf,this.sphere=r.sphere,this.es=h.es,this.e=h.e,this.ep2=h.ep2,this.datum=o,"init"in this&&typeof this.init=="function"&&this.init(),i(null,this)}z.projections=fa;z.projections.start();function Aa(t,i){return t.datum_type!==i.datum_type||t.a!==i.a||Math.abs(t.es-i.es)>5e-11?!1:t.datum_type===st?t.datum_params[0]===i.datum_params[0]&&t.datum_params[1]===i.datum_params[1]&&t.datum_params[2]===i.datum_params[2]:t.datum_type===at?t.datum_params[0]===i.datum_params[0]&&t.datum_params[1]===i.datum_params[1]&&t.datum_params[2]===i.datum_params[2]&&t.datum_params[3]===i.datum_params[3]&&t.datum_params[4]===i.datum_params[4]&&t.datum_params[5]===i.datum_params[5]&&t.datum_params[6]===i.datum_params[6]:!0}function hs(t,i,s){var a=t.x,e=t.y,r=t.z?t.z:0,h,n,o,l;if(e<-M&&e>-1.001*M)e=-M;else if(e>M&&e<1.001*M)e=M;else{if(e<-M)return{x:-1/0,y:-1/0,z:t.z};if(e>M)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),n=Math.sin(e),l=Math.cos(e),o=n*n,h=s/Math.sqrt(1-i*o),{x:(h+r)*l*Math.cos(a),y:(h+r)*l*Math.sin(a),z:(h*(1-i)+r)*n}}function os(t,i,s,a){var e=1e-12,r=e*e,h=30,n,o,l,u,c,f,_,g,v,d,w,E,S,x=t.x,P=t.y,G=t.z?t.z:0,p,L,O;if(n=Math.sqrt(x*x+P*P),o=Math.sqrt(x*x+P*P+G*G),n/s<e){if(p=0,o/s<e)return L=M,O=-a,{x:t.x,y:t.y,z:t.z}}else p=Math.atan2(P,x);l=G/o,u=n/o,c=1/Math.sqrt(1-i*(2-i)*u*u),g=u*(1-i)*c,v=l*c,S=0;do S++,_=s/Math.sqrt(1-i*v*v),O=n*g+G*v-_*(1-i*v*v),f=i*_/(_+O),c=1/Math.sqrt(1-f*(2-f)*u*u),d=u*(1-f)*c,w=l*c,E=w*g-d*v,g=d,v=w;while(E*E>r&&S<h);return L=Math.atan(w/Math.abs(d)),{x:p,y:L,z:O}}function pa(t,i,s){if(i===st)return{x:t.x+s[0],y:t.y+s[1],z:t.z+s[2]};if(i===at){var a=s[0],e=s[1],r=s[2],h=s[3],n=s[4],o=s[5],l=s[6];return{x:l*(t.x-o*t.y+n*t.z)+a,y:l*(o*t.x+t.y-h*t.z)+e,z:l*(-n*t.x+h*t.y+t.z)+r}}}function Na(t,i,s){if(i===st)return{x:t.x-s[0],y:t.y-s[1],z:t.z-s[2]};if(i===at){var a=s[0],e=s[1],r=s[2],h=s[3],n=s[4],o=s[5],l=s[6],u=(t.x-a)/l,c=(t.y-e)/l,f=(t.z-r)/l;return{x:u+o*c-n*f,y:-o*u+c+h*f,z:n*u-h*c+f}}}function Lt(t){return t===st||t===at}function Ia(t,i,s){if(Aa(t,i)||t.datum_type===ai||i.datum_type===ai)return s;var a=t.a,e=t.es;if(t.datum_type===ct){var r=Ti(t,!1,s);if(r!==0)return;a=xi,e=Gi}var h=i.a,n=i.b,o=i.es;if(i.datum_type===ct&&(h=xi,n=Ns,o=Gi),e===o&&a===h&&!Lt(t.datum_type)&&!Lt(i.datum_type))return s;if(s=hs(s,e,a),Lt(t.datum_type)&&(s=pa(s,t.datum_type,t.datum_params)),Lt(i.datum_type)&&(s=Na(s,i.datum_type,i.datum_params)),s=os(s,o,h,n),i.datum_type===ct){var l=Ti(i,!0,s);if(l!==0)return}return s}function Ti(t,i,s){if(t.grids===null||t.grids.length===0)return console.log("Grid shift grids not found"),-1;var a={x:-s.x,y:s.y},e={x:Number.NaN,y:Number.NaN},r=[];t:for(var h=0;h<t.grids.length;h++){var n=t.grids[h];if(r.push(n.name),n.isNull){e=a;break}if(n.grid===null){if(n.mandatory)return console.log("Unable to find mandatory grid '"+n.name+"'"),-1;continue}for(var o=n.grid.subgrids,l=0,u=o.length;l<u;l++){var c=o[l],f=(Math.abs(c.del[1])+Math.abs(c.del[0]))/1e4,_=c.ll[0]-f,g=c.ll[1]-f,v=c.ll[0]+(c.lim[0]-1)*c.del[0]+f,d=c.ll[1]+(c.lim[1]-1)*c.del[1]+f;if(!(g>a.y||_>a.x||d<a.y||v<a.x)&&(e=Ca(a,i,c),!isNaN(e.x)))break t}}return isNaN(e.x)?(console.log("Failed to find a grid shift table for location '"+-a.x*k+" "+a.y*k+" tried: '"+r+"'"),-1):(s.x=-e.x,s.y=e.y,0)}function Ca(t,i,s){var a={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return a;var e={x:t.x,y:t.y};e.x-=s.ll[0],e.y-=s.ll[1],e.x=m(e.x-Math.PI)+Math.PI;var r=Li(e,s);if(i){if(isNaN(r.x))return a;r.x=e.x-r.x,r.y=e.y-r.y;var h=9,n=1e-12,o,l;do{if(l=Li(r,s),isNaN(l.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:e.x-(l.x+r.x),y:e.y-(l.y+r.y)},r.x+=o.x,r.y+=o.y}while(h--&&Math.abs(o.x)>n&&Math.abs(o.y)>n);if(h<0)return console.log("Inverse grid shift iterator failed to converge."),a;a.x=m(r.x+s.ll[0]),a.y=r.y+s.ll[1]}else isNaN(r.x)||(a.x=t.x+r.x,a.y=t.y+r.y);return a}function Li(t,i){var s={x:t.x/i.del[0],y:t.y/i.del[1]},a={x:Math.floor(s.x),y:Math.floor(s.y)},e={x:s.x-1*a.x,y:s.y-1*a.y},r={x:Number.NaN,y:Number.NaN},h;if(a.x<0||a.x>=i.lim[0]||a.y<0||a.y>=i.lim[1])return r;h=a.y*i.lim[0]+a.x;var n={x:i.cvs[h][0],y:i.cvs[h][1]};h++;var o={x:i.cvs[h][0],y:i.cvs[h][1]};h+=i.lim[0];var l={x:i.cvs[h][0],y:i.cvs[h][1]};h--;var u={x:i.cvs[h][0],y:i.cvs[h][1]},c=e.x*e.y,f=e.x*(1-e.y),_=(1-e.x)*(1-e.y),g=(1-e.x)*e.y;return r.x=_*n.x+f*o.x+g*u.x+c*l.x,r.y=_*n.y+f*o.y+g*u.y+c*l.y,r}function qi(t,i,s){var a=s.x,e=s.y,r=s.z||0,h,n,o,l={};for(o=0;o<3;o++)if(!(i&&o===2&&s.z===void 0))switch(o===0?(h=a,"ew".indexOf(t.axis[o])!==-1?n="x":n="y"):o===1?(h=e,"ns".indexOf(t.axis[o])!==-1?n="y":n="x"):(h=r,n="z"),t.axis[o]){case"e":l[n]=h;break;case"w":l[n]=-h;break;case"n":l[n]=h;break;case"s":l[n]=-h;break;case"u":s[n]!==void 0&&(l.z=h);break;case"d":s[n]!==void 0&&(l.z=-h);break;default:return null}return l}function ls(t){var i={x:t[0],y:t[1]};return t.length>2&&(i.z=t[2]),t.length>3&&(i.m=t[3]),i}function Ra(t){Ui(t.x),Ui(t.y)}function Ui(t){if(typeof Number.isFinite=="function"){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if(typeof t!="number"||t!==t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function Oa(t,i){return(t.datum.datum_type===st||t.datum.datum_type===at||t.datum.datum_type===ct)&&i.datumCode!=="WGS84"||(i.datum.datum_type===st||i.datum.datum_type===at||i.datum.datum_type===ct)&&t.datumCode!=="WGS84"}function Wt(t,i,s,a){var e;Array.isArray(s)?s=ls(s):s={x:s.x,y:s.y,z:s.z,m:s.m};var r=s.z!==void 0;if(Ra(s),t.datum&&i.datum&&Oa(t,i)&&(e=new z("WGS84"),s=Wt(t,e,s,a),t=e),a&&t.axis!=="enu"&&(s=qi(t,!1,s)),t.projName==="longlat")s={x:s.x*I,y:s.y*I,z:s.z||0};else if(t.to_meter&&(s={x:s.x*t.to_meter,y:s.y*t.to_meter,z:s.z||0}),s=t.inverse(s),!s)return;if(t.from_greenwich&&(s.x+=t.from_greenwich),s=Ia(t.datum,i.datum,s),!!s)return s=s,i.from_greenwich&&(s={x:s.x-i.from_greenwich,y:s.y,z:s.z||0}),i.projName==="longlat"?s={x:s.x*k,y:s.y*k,z:s.z||0}:(s=i.forward(s),i.to_meter&&(s={x:s.x/i.to_meter,y:s.y/i.to_meter,z:s.z||0})),a&&i.axis!=="enu"?qi(i,!0,s):(s&&!r&&delete s.z,s)}var Fi=z("WGS84");function ti(t,i,s,a){var e,r,h;return Array.isArray(s)?(e=Wt(t,i,s,a)||{x:NaN,y:NaN},s.length>2?typeof t.name<"u"&&t.name==="geocent"||typeof i.name<"u"&&i.name==="geocent"?typeof e.z=="number"?[e.x,e.y,e.z].concat(s.slice(3)):[e.x,e.y,s[2]].concat(s.slice(3)):[e.x,e.y].concat(s.slice(2)):[e.x,e.y]):(r=Wt(t,i,s,a),h=Object.keys(s),h.length===2||h.forEach(function(n){if(typeof t.name<"u"&&t.name==="geocent"||typeof i.name<"u"&&i.name==="geocent"){if(n==="x"||n==="y"||n==="z")return}else if(n==="x"||n==="y")return;r[n]=s[n]}),r)}function qt(t){return t instanceof z?t:typeof t=="object"&&"oProj"in t?t.oProj:z(t)}function Ta(t,i,s){var a,e,r=!1,h;return typeof i>"u"?(e=qt(t),a=Fi,r=!0):(typeof i.x<"u"||Array.isArray(i))&&(s=i,e=qt(t),a=Fi,r=!0),a||(a=qt(t)),e||(e=qt(i)),s?ti(a,e,s):(h={forward:function(n,o){return ti(a,e,n,o)},inverse:function(n,o){return ti(e,a,n,o)}},r&&(h.oProj=e),h)}var Di=6,fs="AJSAJS",cs="AFAFAF",lt=65,F=73,B=79,dt=86,yt=90;const La={forward:us,inverse:qa,toPoint:_s};function us(t,i){return i=i||5,Da(Ua({lat:t[1],lon:t[0]}),i)}function qa(t){var i=ui(Ms(t.toUpperCase()));return i.lat&&i.lon?[i.lon,i.lat,i.lon,i.lat]:[i.left,i.bottom,i.right,i.top]}function _s(t){var i=ui(Ms(t.toUpperCase()));return i.lat&&i.lon?[i.lon,i.lat]:[(i.left+i.right)/2,(i.top+i.bottom)/2]}function ii(t){return t*(Math.PI/180)}function ki(t){return 180*(t/Math.PI)}function Ua(t){var i=t.lat,s=t.lon,a=6378137,e=.00669438,r=.9996,h,n,o,l,u,c,f,_=ii(i),g=ii(s),v,d;d=Math.floor((s+180)/6)+1,s===180&&(d=60),i>=56&&i<64&&s>=3&&s<12&&(d=32),i>=72&&i<84&&(s>=0&&s<9?d=31:s>=9&&s<21?d=33:s>=21&&s<33?d=35:s>=33&&s<42&&(d=37)),h=(d-1)*6-180+3,v=ii(h),n=e/(1-e),o=a/Math.sqrt(1-e*Math.sin(_)*Math.sin(_)),l=Math.tan(_)*Math.tan(_),u=n*Math.cos(_)*Math.cos(_),c=Math.cos(_)*(g-v),f=a*((1-e/4-3*e*e/64-5*e*e*e/256)*_-(3*e/8+3*e*e/32+45*e*e*e/1024)*Math.sin(2*_)+(15*e*e/256+45*e*e*e/1024)*Math.sin(4*_)-35*e*e*e/3072*Math.sin(6*_));var w=r*o*(c+(1-l+u)*c*c*c/6+(5-18*l+l*l+72*u-58*n)*c*c*c*c*c/120)+5e5,E=r*(f+o*Math.tan(_)*(c*c/2+(5-l+9*u+4*u*u)*c*c*c*c/24+(61-58*l+l*l+600*u-330*n)*c*c*c*c*c*c/720));return i<0&&(E+=1e7),{northing:Math.round(E),easting:Math.round(w),zoneNumber:d,zoneLetter:Fa(i)}}function ui(t){var i=t.northing,s=t.easting,a=t.zoneLetter,e=t.zoneNumber;if(e<0||e>60)return null;var r=.9996,h=6378137,n=.00669438,o,l=(1-Math.sqrt(1-n))/(1+Math.sqrt(1-n)),u,c,f,_,g,v,d,w,E,S=s-5e5,x=i;a<"N"&&(x-=1e7),d=(e-1)*6-180+3,o=n/(1-n),v=x/r,w=v/(h*(1-n/4-3*n*n/64-5*n*n*n/256)),E=w+(3*l/2-27*l*l*l/32)*Math.sin(2*w)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*w)+151*l*l*l/96*Math.sin(6*w),u=h/Math.sqrt(1-n*Math.sin(E)*Math.sin(E)),c=Math.tan(E)*Math.tan(E),f=o*Math.cos(E)*Math.cos(E),_=h*(1-n)/Math.pow(1-n*Math.sin(E)*Math.sin(E),1.5),g=S/(u*r);var P=E-u*Math.tan(E)/_*(g*g/2-(5+3*c+10*f-4*f*f-9*o)*g*g*g*g/24+(61+90*c+298*f+45*c*c-252*o-3*f*f)*g*g*g*g*g*g/720);P=ki(P);var G=(g-(1+2*c+f)*g*g*g/6+(5-2*f+28*c-3*f*f+8*o+24*c*c)*g*g*g*g*g/120)/Math.cos(E);G=d+ki(G);var p;if(t.accuracy){var L=ui({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});p={top:L.lat,right:L.lon,bottom:P,left:G}}else p={lat:P,lon:G};return p}function Fa(t){var i="Z";return 84>=t&&t>=72?i="X":72>t&&t>=64?i="W":64>t&&t>=56?i="V":56>t&&t>=48?i="U":48>t&&t>=40?i="T":40>t&&t>=32?i="S":32>t&&t>=24?i="R":24>t&&t>=16?i="Q":16>t&&t>=8?i="P":8>t&&t>=0?i="N":0>t&&t>=-8?i="M":-8>t&&t>=-16?i="L":-16>t&&t>=-24?i="K":-24>t&&t>=-32?i="J":-32>t&&t>=-40?i="H":-40>t&&t>=-48?i="G":-48>t&&t>=-56?i="F":-56>t&&t>=-64?i="E":-64>t&&t>=-72?i="D":-72>t&&t>=-80&&(i="C"),i}function Da(t,i){var s="00000"+t.easting,a="00000"+t.northing;return t.zoneNumber+t.zoneLetter+ka(t.easting,t.northing,t.zoneNumber)+s.substr(s.length-5,i)+a.substr(a.length-5,i)}function ka(t,i,s){var a=gs(s),e=Math.floor(t/1e5),r=Math.floor(i/1e5)%20;return $a(e,r,a)}function gs(t){var i=t%Di;return i===0&&(i=Di),i}function $a(t,i,s){var a=s-1,e=fs.charCodeAt(a),r=cs.charCodeAt(a),h=e+t-1,n=r+i,o=!1;h>yt&&(h=h-yt+lt-1,o=!0),(h===F||e<F&&h>F||(h>F||e<F)&&o)&&h++,(h===B||e<B&&h>B||(h>B||e<B)&&o)&&(h++,h===F&&h++),h>yt&&(h=h-yt+lt-1),n>dt?(n=n-dt+lt-1,o=!0):o=!1,(n===F||r<F&&n>F||(n>F||r<F)&&o)&&n++,(n===B||r<B&&n>B||(n>B||r<B)&&o)&&(n++,n===F&&n++),n>dt&&(n=n-dt+lt-1);var l=String.fromCharCode(h)+String.fromCharCode(n);return l}function Ms(t){if(t&&t.length===0)throw"MGRSPoint coverting from nothing";for(var i=t.length,s=null,a="",e,r=0;!/[A-Z]/.test(e=t.charAt(r));){if(r>=2)throw"MGRSPoint bad conversion from: "+t;a+=e,r++}var h=parseInt(a,10);if(r===0||r+3>i)throw"MGRSPoint bad conversion from: "+t;var n=t.charAt(r++);if(n<="A"||n==="B"||n==="Y"||n>="Z"||n==="I"||n==="O")throw"MGRSPoint zone letter "+n+" not handled: "+t;s=t.substring(r,r+=2);for(var o=gs(h),l=ja(s.charAt(0),o),u=Ba(s.charAt(1),o);u<za(n);)u+=2e6;var c=i-r;if(c%2!==0)throw`MGRSPoint has to have an even number
of digits after the zone letter and two 100km letters - front
half for easting meters, second half for
northing meters`+t;var f=c/2,_=0,g=0,v,d,w,E,S;return f>0&&(v=1e5/Math.pow(10,f),d=t.substring(r,r+f),_=parseFloat(d)*v,w=t.substring(r+f),g=parseFloat(w)*v),E=_+l,S=g+u,{easting:E,northing:S,zoneLetter:n,zoneNumber:h,accuracy:v}}function ja(t,i){for(var s=fs.charCodeAt(i-1),a=1e5,e=!1;s!==t.charCodeAt(0);){if(s++,s===F&&s++,s===B&&s++,s>yt){if(e)throw"Bad character: "+t;s=lt,e=!0}a+=1e5}return a}function Ba(t,i){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var s=cs.charCodeAt(i-1),a=0,e=!1;s!==t.charCodeAt(0);){if(s++,s===F&&s++,s===B&&s++,s>dt){if(e)throw"Bad character: "+t;s=lt,e=!0}a+=1e5}return a}function za(t){var i;switch(t){case"C":i=11e5;break;case"D":i=2e6;break;case"E":i=28e5;break;case"F":i=37e5;break;case"G":i=46e5;break;case"H":i=55e5;break;case"J":i=64e5;break;case"K":i=73e5;break;case"L":i=82e5;break;case"M":i=91e5;break;case"N":i=0;break;case"P":i=8e5;break;case"Q":i=17e5;break;case"R":i=26e5;break;case"S":i=35e5;break;case"T":i=44e5;break;case"U":i=53e5;break;case"V":i=62e5;break;case"W":i=7e6;break;case"X":i=79e5;break;default:i=-1}if(i>=0)return i;throw"Invalid zone letter: "+t}function _t(t,i,s){if(!(this instanceof _t))return new _t(t,i,s);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if(typeof t=="object")this.x=t.x,this.y=t.y,this.z=t.z||0;else if(typeof t=="string"&&typeof i>"u"){var a=t.split(",");this.x=parseFloat(a[0]),this.y=parseFloat(a[1]),this.z=parseFloat(a[2])||0}else this.x=t,this.y=i,this.z=s||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}_t.fromMGRS=function(t){return new _t(_s(t))};_t.prototype.toMGRS=function(t){return us([this.x,this.y],t)};var Wa=1,Ha=.25,$i=.046875,ji=.01953125,Bi=.01068115234375,Qa=.75,Va=.46875,Xa=.013020833333333334,Ja=.007120768229166667,Ka=.3645833333333333,Za=.005696614583333333,Ya=.3076171875;function _i(t){var i=[];i[0]=Wa-t*(Ha+t*($i+t*(ji+t*Bi))),i[1]=t*(Qa-t*($i+t*(ji+t*Bi)));var s=t*t;return i[2]=s*(Va-t*(Xa+t*Ja)),s*=t,i[3]=s*(Ka-t*Za),i[4]=s*t*Ya,i}function Mt(t,i,s,a){return s*=i,i*=i,a[0]*t-s*(a[1]+i*(a[2]+i*(a[3]+i*a[4])))}var te=20;function gi(t,i,s){for(var a=1/(1-i),e=t,r=te;r;--r){var h=Math.sin(e),n=1-i*h*h;if(n=(Mt(e,h,Math.cos(e),s)-t)*(n*Math.sqrt(n))*a,e-=n,Math.abs(n)<y)return e}return e}function ie(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=_i(this.es),this.ml0=Mt(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function se(t){var i=t.x,s=t.y,a=m(i-this.long0,this.over),e,r,h,n=Math.sin(s),o=Math.cos(s);if(this.es){var u=o*a,c=Math.pow(u,2),f=this.ep2*Math.pow(o,2),_=Math.pow(f,2),g=Math.abs(o)>y?Math.tan(s):0,v=Math.pow(g,2),d=Math.pow(v,2);e=1-this.es*Math.pow(n,2),u=u/Math.sqrt(e);var w=Mt(s,n,o,this.en);r=this.a*(this.k0*u*(1+c/6*(1-v+f+c/20*(5-18*v+d+14*f-58*v*f+c/42*(61+179*d-d*v-479*v)))))+this.x0,h=this.a*(this.k0*(w-this.ml0+n*a*u/2*(1+c/12*(5-v+9*f+4*_+c/30*(61+d-58*v+270*f-330*v*f+c/56*(1385+543*d-d*v-3111*v))))))+this.y0}else{var l=o*Math.sin(a);if(Math.abs(Math.abs(l)-1)<y)return 93;if(r=.5*this.a*this.k0*Math.log((1+l)/(1-l))+this.x0,h=o*Math.cos(a)/Math.sqrt(1-Math.pow(l,2)),l=Math.abs(h),l>=1){if(l-1>y)return 93;h=0}else h=Math.acos(h);s<0&&(h=-h),h=this.a*this.k0*(h-this.lat0)+this.y0}return t.x=r,t.y=h,t}function ae(t){var i,s,a,e,r=(t.x-this.x0)*(1/this.a),h=(t.y-this.y0)*(1/this.a);if(this.es)if(i=this.ml0+h/this.k0,s=gi(i,this.es,this.en),Math.abs(s)<M){var c=Math.sin(s),f=Math.cos(s),_=Math.abs(f)>y?Math.tan(s):0,g=this.ep2*Math.pow(f,2),v=Math.pow(g,2),d=Math.pow(_,2),w=Math.pow(d,2);i=1-this.es*Math.pow(c,2);var E=r*Math.sqrt(i)/this.k0,S=Math.pow(E,2);i=i*_,a=s-i*S/(1-this.es)*.5*(1-S/12*(5+3*d-9*g*d+g-4*v-S/30*(61+90*d-252*g*d+45*w+46*g-S/56*(1385+3633*d+4095*w+1574*w*d)))),e=m(this.long0+E*(1-S/6*(1+2*d+g-S/20*(5+28*d+24*w+8*g*d+6*g-S/42*(61+662*d+1320*w+720*w*d))))/f,this.over)}else a=M*It(h),e=0;else{var n=Math.exp(r/this.k0),o=.5*(n-1/n),l=this.lat0+h/this.k0,u=Math.cos(l);i=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(o,2))),a=Math.asin(i),h<0&&(a=-a),o===0&&u===0?e=0:e=m(Math.atan2(o,u)+this.long0,this.over)}return t.x=e,t.y=a,t}var ee=["Fast_Transverse_Mercator","Fast Transverse Mercator"];const Dt={init:ie,forward:se,inverse:ae,names:ee};function vs(t){var i=Math.exp(t);return i=(i-1/i)/2,i}function D(t,i){t=Math.abs(t),i=Math.abs(i);var s=Math.max(t,i),a=Math.min(t,i)/(s||1);return s*Math.sqrt(1+Math.pow(a,2))}function re(t){var i=1+t,s=i-1;return s===0?t:t*Math.log(i)/s}function ne(t){var i=Math.abs(t);return i=re(i*(1+i/(D(1,i)+1))),t<0?-i:i}function Mi(t,i){for(var s=2*Math.cos(2*i),a=t.length-1,e=t[a],r=0,h;--a>=0;)h=-r+s*e+t[a],r=e,e=h;return i+h*Math.sin(2*i)}function he(t,i){for(var s=2*Math.cos(i),a=t.length-1,e=t[a],r=0,h;--a>=0;)h=-r+s*e+t[a],r=e,e=h;return Math.sin(i)*h}function oe(t){var i=Math.exp(t);return i=(i+1/i)/2,i}function ds(t,i,s){for(var a=Math.sin(i),e=Math.cos(i),r=vs(s),h=oe(s),n=2*e*h,o=-2*a*r,l=t.length-1,u=t[l],c=0,f=0,_=0,g,v;--l>=0;)g=f,v=c,f=u,c=_,u=-g+n*f-o*c+t[l],_=-v+o*f+n*c;return n=a*h,o=e*r,[n*u-o*_,n*_+o*u]}function le(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Dt.init.apply(this),this.forward=Dt.forward,this.inverse=Dt.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),i=t/(2-t),s=i;this.cgb[0]=i*(2+i*(-2/3+i*(-2+i*(116/45+i*(26/45+i*(-2854/675)))))),this.cbg[0]=i*(-2+i*(2/3+i*(4/3+i*(-82/45+i*(32/45+i*(4642/4725)))))),s=s*i,this.cgb[1]=s*(7/3+i*(-8/5+i*(-227/45+i*(2704/315+i*(2323/945))))),this.cbg[1]=s*(5/3+i*(-16/15+i*(-13/9+i*(904/315+i*(-1522/945))))),s=s*i,this.cgb[2]=s*(56/15+i*(-136/35+i*(-1262/105+i*(73814/2835)))),this.cbg[2]=s*(-26/15+i*(34/21+i*(8/5+i*(-12686/2835)))),s=s*i,this.cgb[3]=s*(4279/630+i*(-332/35+i*(-399572/14175))),this.cbg[3]=s*(1237/630+i*(-12/5+i*(-24832/14175))),s=s*i,this.cgb[4]=s*(4174/315+i*(-144838/6237)),this.cbg[4]=s*(-734/315+i*(109598/31185)),s=s*i,this.cgb[5]=s*(601676/22275),this.cbg[5]=s*(444337/155925),s=Math.pow(i,2),this.Qn=this.k0/(1+i)*(1+s*(1/4+s*(1/64+s/256))),this.utg[0]=i*(-.5+i*(2/3+i*(-37/96+i*(1/360+i*(81/512+i*(-96199/604800)))))),this.gtu[0]=i*(.5+i*(-2/3+i*(5/16+i*(41/180+i*(-127/288+i*(7891/37800)))))),this.utg[1]=s*(-1/48+i*(-1/15+i*(437/1440+i*(-46/105+i*(1118711/3870720))))),this.gtu[1]=s*(13/48+i*(-3/5+i*(557/1440+i*(281/630+i*(-1983433/1935360))))),s=s*i,this.utg[2]=s*(-17/480+i*(37/840+i*(209/4480+i*(-5569/90720)))),this.gtu[2]=s*(61/240+i*(-103/140+i*(15061/26880+i*(167603/181440)))),s=s*i,this.utg[3]=s*(-4397/161280+i*(11/504+i*(830251/7257600))),this.gtu[3]=s*(49561/161280+i*(-179/168+i*(6601661/7257600))),s=s*i,this.utg[4]=s*(-4583/161280+i*(108847/3991680)),this.gtu[4]=s*(34729/80640+i*(-3418889/1995840)),s=s*i,this.utg[5]=s*(-20648693/638668800),this.gtu[5]=s*(212378941/319334400);var a=Mi(this.cbg,this.lat0);this.Zb=-this.Qn*(a+he(this.gtu,2*a))}function fe(t){var i=m(t.x-this.long0,this.over),s=t.y;s=Mi(this.cbg,s);var a=Math.sin(s),e=Math.cos(s),r=Math.sin(i),h=Math.cos(i);s=Math.atan2(a,h*e),i=Math.atan2(r*e,D(a,e*h)),i=ne(Math.tan(i));var n=ds(this.gtu,2*s,2*i);s=s+n[0],i=i+n[1];var o,l;return Math.abs(i)<=2.623395162778?(o=this.a*(this.Qn*i)+this.x0,l=this.a*(this.Qn*s+this.Zb)+this.y0):(o=1/0,l=1/0),t.x=o,t.y=l,t}function ce(t){var i=(t.x-this.x0)*(1/this.a),s=(t.y-this.y0)*(1/this.a);s=(s-this.Zb)/this.Qn,i=i/this.Qn;var a,e;if(Math.abs(i)<=2.623395162778){var r=ds(this.utg,2*s,2*i);s=s+r[0],i=i+r[1],i=Math.atan(vs(i));var h=Math.sin(s),n=Math.cos(s),o=Math.sin(i),l=Math.cos(i);s=Math.atan2(h*l,D(o,l*n)),i=Math.atan2(o,l*n),a=m(i+this.long0,this.over),e=Mi(this.cgb,s)}else a=1/0,e=1/0;return t.x=a,t.y=e,t}var ue=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"];const kt={init:le,forward:fe,inverse:ce,names:ue};function _e(t,i){if(t===void 0){if(t=Math.floor((m(i)+Math.PI)*30/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t}var ge="etmerc";function Me(){var t=_e(this.zone,this.long0);if(t===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*I,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,kt.init.apply(this),this.forward=kt.forward,this.inverse=kt.inverse}var ve=["Universal Transverse Mercator System","utm"];const de={init:Me,names:ve,dependsOn:ge};function vi(t,i){return Math.pow((1-t)/(1+t),i)}var ye=20;function me(){var t=Math.sin(this.lat0),i=Math.cos(this.lat0);i*=i,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*i*i/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+b)/(Math.pow(Math.tan(.5*this.lat0+b),this.C)*vi(this.e*t,this.ratexp))}function we(t){var i=t.x,s=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*s+b),this.C)*vi(this.e*Math.sin(s),this.ratexp))-M,t.x=this.C*i,t}function Ee(t){for(var i=1e-14,s=t.x/this.C,a=t.y,e=Math.pow(Math.tan(.5*a+b)/this.K,1/this.C),r=ye;r>0&&(a=2*Math.atan(e*vi(this.e*Math.sin(t.y),-.5*this.e))-M,!(Math.abs(a-t.y)<i));--r)t.y=a;return r?(t.x=s,t.y=a,t):null}const di={init:me,forward:we,inverse:Ee};function Se(){di.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function Pe(t){var i,s,a,e;return t.x=m(t.x-this.long0,this.over),di.forward.apply(this,[t]),i=Math.sin(t.y),s=Math.cos(t.y),a=Math.cos(t.x),e=this.k0*this.R2/(1+this.sinc0*i+this.cosc0*s*a),t.x=e*s*Math.sin(t.x),t.y=e*(this.cosc0*i-this.sinc0*s*a),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function xe(t){var i,s,a,e,r;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,r=D(t.x,t.y)){var h=2*Math.atan2(r,this.R2);i=Math.sin(h),s=Math.cos(h),e=Math.asin(s*this.sinc0+t.y*i*this.cosc0/r),a=Math.atan2(t.x*i,r*this.cosc0*s-t.y*this.sinc0*i)}else e=this.phic0,a=0;return t.x=a,t.y=e,di.inverse.apply(this,[t]),t.x=m(t.x+this.long0,this.over),t}var Ge=["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"];const be={init:Se,forward:Pe,inverse:xe,names:Ge};function yi(t,i,s){return i*=s,Math.tan(.5*(M+t))*Math.pow((1-i)/(1+i),.5*s)}function Ae(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=y&&(this.k0=.5*(1+It(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=y&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=y&&Math.abs(Math.cos(this.lat_ts))>y&&(this.k0=.5*this.cons*Q(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/H(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Q(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(yi(this.lat0,this.sinlat0,this.e))-M,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function pe(t){var i=t.x,s=t.y,a=Math.sin(s),e=Math.cos(s),r,h,n,o,l,u,c=m(i-this.long0,this.over);return Math.abs(Math.abs(i-this.long0)-Math.PI)<=y&&Math.abs(s+this.lat0)<=y?(t.x=NaN,t.y=NaN,t):this.sphere?(r=2*this.k0/(1+this.sinlat0*a+this.coslat0*e*Math.cos(c)),t.x=this.a*r*e*Math.sin(c)+this.x0,t.y=this.a*r*(this.coslat0*a-this.sinlat0*e*Math.cos(c))+this.y0,t):(h=2*Math.atan(yi(s,a,this.e))-M,o=Math.cos(h),n=Math.sin(h),Math.abs(this.coslat0)<=y?(l=H(this.e,s*this.con,this.con*a),u=2*this.a*this.k0*l/this.cons,t.x=this.x0+u*Math.sin(i-this.long0),t.y=this.y0-this.con*u*Math.cos(i-this.long0),t):(Math.abs(this.sinlat0)<y?(r=2*this.a*this.k0/(1+o*Math.cos(c)),t.y=r*n):(r=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*n+this.cosX0*o*Math.cos(c))),t.y=r*(this.cosX0*n-this.sinX0*o*Math.cos(c))+this.y0),t.x=r*o*Math.sin(c)+this.x0,t))}function Ne(t){t.x-=this.x0,t.y-=this.y0;var i,s,a,e,r,h=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var n=2*Math.atan(h/(2*this.a*this.k0));return i=this.long0,s=this.lat0,h<=y?(t.x=i,t.y=s,t):(s=Math.asin(Math.cos(n)*this.sinlat0+t.y*Math.sin(n)*this.coslat0/h),Math.abs(this.coslat0)<y?this.lat0>0?i=m(this.long0+Math.atan2(t.x,-1*t.y),this.over):i=m(this.long0+Math.atan2(t.x,t.y),this.over):i=m(this.long0+Math.atan2(t.x*Math.sin(n),h*this.coslat0*Math.cos(n)-t.y*this.sinlat0*Math.sin(n)),this.over),t.x=i,t.y=s,t)}else if(Math.abs(this.coslat0)<=y){if(h<=y)return s=this.lat0,i=this.long0,t.x=i,t.y=s,t;t.x*=this.con,t.y*=this.con,a=h*this.cons/(2*this.a*this.k0),s=this.con*At(this.e,a),i=this.con*m(this.con*this.long0+Math.atan2(t.x,-1*t.y),this.over)}else e=2*Math.atan(h*this.cosX0/(2*this.a*this.k0*this.ms1)),i=this.long0,h<=y?r=this.X0:(r=Math.asin(Math.cos(e)*this.sinX0+t.y*Math.sin(e)*this.cosX0/h),i=m(this.long0+Math.atan2(t.x*Math.sin(e),h*this.cosX0*Math.cos(e)-t.y*this.sinX0*Math.sin(e)),this.over)),s=-1*At(this.e,Math.tan(.5*(M+r)));return t.x=i,t.y=s,t}var Ie=["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"];const Ce={init:Ae,forward:pe,inverse:Ne,names:Ie,ssfn_:yi};function Re(){var t=this.lat0;this.lambda0=this.long0;var i=Math.sin(t),s=this.a,a=this.rf,e=1/a,r=2*e-Math.pow(e,2),h=this.e=Math.sqrt(r);this.R=this.k0*s*Math.sqrt(1-r)/(1-r*Math.pow(i,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(i/this.alpha);var n=Math.log(Math.tan(Math.PI/4+this.b0/2)),o=Math.log(Math.tan(Math.PI/4+t/2)),l=Math.log((1+h*i)/(1-h*i));this.K=n-this.alpha*o+this.alpha*h/2*l}function Oe(t){var i=Math.log(Math.tan(Math.PI/4-t.y/2)),s=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),a=-this.alpha*(i+s)+this.K,e=2*(Math.atan(Math.exp(a))-Math.PI/4),r=this.alpha*(t.x-this.lambda0),h=Math.atan(Math.sin(r)/(Math.sin(this.b0)*Math.tan(e)+Math.cos(this.b0)*Math.cos(r))),n=Math.asin(Math.cos(this.b0)*Math.sin(e)-Math.sin(this.b0)*Math.cos(e)*Math.cos(r));return t.y=this.R/2*Math.log((1+Math.sin(n))/(1-Math.sin(n)))+this.y0,t.x=this.R*h+this.x0,t}function Te(t){for(var i=t.x-this.x0,s=t.y-this.y0,a=i/this.R,e=2*(Math.atan(Math.exp(s/this.R))-Math.PI/4),r=Math.asin(Math.cos(this.b0)*Math.sin(e)+Math.sin(this.b0)*Math.cos(e)*Math.cos(a)),h=Math.atan(Math.sin(a)/(Math.cos(this.b0)*Math.cos(a)-Math.sin(this.b0)*Math.tan(e))),n=this.lambda0+h/this.alpha,o=0,l=r,u=-1e3,c=0;Math.abs(l-u)>1e-7;){if(++c>20)return;o=1/this.alpha*(Math.log(Math.tan(Math.PI/4+r/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),u=l,l=2*Math.atan(Math.exp(o))-Math.PI/2}return t.x=n,t.y=l,t}var Le=["somerc"];const qe={init:Re,forward:Oe,inverse:Te,names:Le};var nt=1e-7;function Ue(t){var i=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],s=typeof t.projName=="object"?Object.keys(t.projName)[0]:t.projName;return"no_uoff"in t||"no_off"in t||i.indexOf(s)!==-1||i.indexOf(rs(s))!==-1}function Fe(){var t,i,s,a,e,r,h,n,o,l,u=0,c,f=0,_=0,g=0,v=0,d=0,w=0;this.no_off=Ue(this),this.no_rot="no_rot"in this;var E=!1;"alpha"in this&&(E=!0);var S=!1;if("rectified_grid_angle"in this&&(S=!0),E&&(w=this.alpha),S&&(u=this.rectified_grid_angle),E||S)f=this.longc;else if(_=this.long1,v=this.lat1,g=this.long2,d=this.lat2,Math.abs(v-d)<=nt||(t=Math.abs(v))<=nt||Math.abs(t-M)<=nt||Math.abs(Math.abs(this.lat0)-M)<=nt||Math.abs(Math.abs(d)-M)<=nt)throw new Error;var x=1-this.es;i=Math.sqrt(x),Math.abs(this.lat0)>y?(n=Math.sin(this.lat0),s=Math.cos(this.lat0),t=1-this.es*n*n,this.B=s*s,this.B=Math.sqrt(1+this.es*this.B*this.B/x),this.A=this.B*this.k0*i/t,a=this.B*i/(s*Math.sqrt(t)),e=a*a-1,e<=0?e=0:(e=Math.sqrt(e),this.lat0<0&&(e=-e)),this.E=e+=a,this.E*=Math.pow(H(this.e,this.lat0,n),this.B)):(this.B=1/i,this.A=this.k0,this.E=a=e=1),E||S?(E?(c=Math.asin(Math.sin(w)/a),S||(u=w)):(c=u,w=Math.asin(a*Math.sin(c))),this.lam0=f-Math.asin(.5*(e-1/e)*Math.tan(c))/this.B):(r=Math.pow(H(this.e,v,Math.sin(v)),this.B),h=Math.pow(H(this.e,d,Math.sin(d)),this.B),e=this.E/r,o=(h-r)/(h+r),l=this.E*this.E,l=(l-h*r)/(l+h*r),t=_-g,t<-Math.PI?g-=Gt:t>Math.PI&&(g+=Gt),this.lam0=m(.5*(_+g)-Math.atan(l*Math.tan(.5*this.B*(_-g))/o)/this.B,this.over),c=Math.atan(2*Math.sin(this.B*m(_-this.lam0,this.over))/(e-1/e)),u=w=Math.asin(a*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(u),this.cosrot=Math.cos(u),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(a*a-1)/Math.cos(w))),this.lat0<0&&(this.u_0=-this.u_0)),e=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(b-e)),this.v_pole_s=this.ArB*Math.log(Math.tan(b+e))}function De(t){var i={},s,a,e,r,h,n,o,l;if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-M)>y){if(h=this.E/Math.pow(H(this.e,t.y,Math.sin(t.y)),this.B),n=1/h,s=.5*(h-n),a=.5*(h+n),r=Math.sin(this.B*t.x),e=(s*this.singam-r*this.cosgam)/a,Math.abs(Math.abs(e)-1)<y)throw new Error;l=.5*this.ArB*Math.log((1-e)/(1+e)),n=Math.cos(this.B*t.x),Math.abs(n)<nt?o=this.A*t.x:o=this.ArB*Math.atan2(s*this.cosgam+r*this.singam,n)}else l=t.y>0?this.v_pole_n:this.v_pole_s,o=this.ArB*t.y;return this.no_rot?(i.x=o,i.y=l):(o-=this.u_0,i.x=l*this.cosrot+o*this.sinrot,i.y=o*this.cosrot-l*this.sinrot),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function ke(t){var i,s,a,e,r,h,n,o={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(s=t.y,i=t.x):(s=t.x*this.cosrot-t.y*this.sinrot,i=t.y*this.cosrot+t.x*this.sinrot+this.u_0),a=Math.exp(-this.BrA*s),e=.5*(a-1/a),r=.5*(a+1/a),h=Math.sin(this.BrA*i),n=(h*this.cosgam+e*this.singam)/r,Math.abs(Math.abs(n)-1)<y)o.x=0,o.y=n<0?-M:M;else{if(o.y=this.E/Math.sqrt((1+n)/(1-n)),o.y=At(this.e,Math.pow(o.y,1/this.B)),o.y===1/0)throw new Error;o.x=-this.rB*Math.atan2(e*this.cosgam-h*this.singam,Math.cos(this.BrA*i))}return o.x+=this.lam0,o}var $e=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"];const je={init:Fe,forward:De,inverse:ke,names:$e};function Be(){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)<y)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var i=Math.sin(this.lat1),s=Math.cos(this.lat1),a=Q(this.e,i,s),e=H(this.e,this.lat1,i),r=Math.sin(this.lat2),h=Math.cos(this.lat2),n=Q(this.e,r,h),o=H(this.e,this.lat2,r),l=Math.abs(Math.abs(this.lat0)-M)<y?0:H(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>y?this.ns=Math.log(a/n)/Math.log(e/o):this.ns=i,isNaN(this.ns)&&(this.ns=i),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")}}function ze(t){var i=t.x,s=t.y;Math.abs(2*Math.abs(s)-Math.PI)<=y&&(s=It(s)*(M-2*y));var a=Math.abs(Math.abs(s)-M),e,r;if(a>y)e=H(this.e,s,Math.sin(s)),r=this.a*this.f0*Math.pow(e,this.ns);else{if(a=s*this.ns,a<=0)return null;r=0}var h=this.ns*m(i-this.long0,this.over);return t.x=this.k0*(r*Math.sin(h))+this.x0,t.y=this.k0*(this.rh-r*Math.cos(h))+this.y0,t}function We(t){var i,s,a,e,r,h=(t.x-this.x0)/this.k0,n=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(i=Math.sqrt(h*h+n*n),s=1):(i=-Math.sqrt(h*h+n*n),s=-1);var o=0;if(i!==0&&(o=Math.atan2(s*h,s*n)),i!==0||this.ns>0){if(s=1/this.ns,a=Math.pow(i/(this.a*this.f0),s),e=At(this.e,a),e===-9999)return null}else e=-M;return r=m(o/this.ns+this.long0,this.over),t.x=r,t.y=e,t}var He=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"];const Qe={init:Be,forward:ze,inverse:We,names:He};function Ve(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),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}function Xe(t){var i,s,a,e,r,h,n,o=t.x,l=t.y,u=m(o-this.long0,this.over);return i=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),s=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/i)-this.s45),a=-u*this.alfa,e=Math.asin(Math.cos(this.ad)*Math.sin(s)+Math.sin(this.ad)*Math.cos(s)*Math.cos(a)),r=Math.asin(Math.cos(s)*Math.sin(a)/Math.cos(e)),h=this.n*r,n=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=n*Math.cos(h)/1,t.x=n*Math.sin(h)/1,this.czech||(t.y*=-1,t.x*=-1),t}function Je(t){var i,s,a,e,r,h,n,o,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),h=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x),e=r/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),i=Math.asin(Math.cos(this.ad)*Math.sin(a)-Math.sin(this.ad)*Math.cos(a)*Math.cos(e)),s=Math.asin(Math.cos(a)*Math.sin(e)/Math.cos(i)),t.x=this.long0-s/this.alfa,n=i,o=0;var u=0;do t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(i/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&&(o=1),n=t.y,u+=1;while(o===0&&u<15);return u>=15?null:t}var Ke=["Krovak","krovak"];const Ze={init:Ve,forward:Xe,inverse:Je,names:Ke};function U(t,i,s,a,e){return t*e-i*Math.sin(2*e)+s*Math.sin(4*e)-a*Math.sin(6*e)}function Ct(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function Rt(t){return .375*t*(1+.25*t*(1+.46875*t))}function Ot(t){return .05859375*t*t*(1+.75*t)}function Tt(t){return t*t*t*(35/3072)}function mi(t,i,s){var a=i*s;return t/Math.sqrt(1-a*a)}function tt(t){return Math.abs(t)<M?t:t-It(t)*Math.PI}function Ht(t,i,s,a,e){var r,h;r=t/i;for(var n=0;n<15;n++)if(h=(t-(i*r-s*Math.sin(2*r)+a*Math.sin(4*r)-e*Math.sin(6*r)))/(i-2*s*Math.cos(2*r)+4*a*Math.cos(4*r)-6*e*Math.cos(6*r)),r+=h,Math.abs(h)<=1e-10)return r;return NaN}function Ye(){this.sphere||(this.e0=Ct(this.es),this.e1=Rt(this.es),this.e2=Ot(this.es),this.e3=Tt(this.es),this.ml0=this.a*U(this.e0,this.e1,this.e2,this.e3,this.lat0))}function tr(t){var i,s,a=t.x,e=t.y;if(a=m(a-this.long0,this.over),this.sphere)i=this.a*Math.asin(Math.cos(e)*Math.sin(a)),s=this.a*(Math.atan2(Math.tan(e),Math.cos(a))-this.lat0);else{var r=Math.sin(e),h=Math.cos(e),n=mi(this.a,this.e,r),o=Math.tan(e)*Math.tan(e),l=a*Math.cos(e),u=l*l,c=this.es*h*h/(1-this.es),f=this.a*U(this.e0,this.e1,this.e2,this.e3,e);i=n*l*(1-u*o*(1/6-(8-o+8*c)*u/120)),s=f-this.ml0+n*r/h*u*(.5+(5-o+6*c)*u/24)}return t.x=i+this.x0,t.y=s+this.y0,t}function ir(t){t.x-=this.x0,t.y-=this.y0;var i=t.x/this.a,s=t.y/this.a,a,e;if(this.sphere){var r=s+this.lat0;a=Math.asin(Math.sin(r)*Math.cos(i)),e=Math.atan2(Math.tan(i),Math.cos(r))}else{var h=this.ml0/this.a+s,n=Ht(h,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(n)-M)<=y)return t.x=this.long0,t.y=M,s<0&&(t.y*=-1),t;var o=mi(this.a,this.e,Math.sin(n)),l=o*o*o/this.a/this.a*(1-this.es),u=Math.pow(Math.tan(n),2),c=i*this.a/o,f=c*c;a=n-o*Math.tan(n)/l*c*c*(.5-(1+3*u)*c*c/24),e=c*(1-f*(u/3+(1+3*u)*u*f/15))/Math.cos(n)}return t.x=m(e+this.long0,this.over),t.y=tt(a),t}var sr=["Cassini","Cassini_Soldner","cass"];const ar={init:Ye,forward:tr,inverse:ir,names:sr};function K(t,i){var s;return t>1e-7?(s=t*i,(1-t*t)*(i/(1-s*s)-.5/t*Math.log((1-s)/(1+s)))):2*i}var ni=1,hi=2,oi=3,$t=4;function er(){var t=Math.abs(this.lat0);if(Math.abs(t-M)<y?this.mode=this.lat0<0?ni:hi:Math.abs(t)<y?this.mode=oi:this.mode=$t,this.es>0){var i;switch(this.qp=K(this.e,1),this.mmf=.5/(1-this.es),this.apa=_r(this.es),this.mode){case hi:this.dd=1;break;case ni:this.dd=1;break;case oi:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case $t:this.rq=Math.sqrt(.5*this.qp),i=Math.sin(this.lat0),this.sinb1=K(this.e,i)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*i*i)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===$t&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function rr(t){var i,s,a,e,r,h,n,o,l,u,c=t.x,f=t.y;if(c=m(c-this.long0,this.over),this.sphere){if(r=Math.sin(f),u=Math.cos(f),a=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(s=this.mode===this.EQUIT?1+u*a:1+this.sinph0*r+this.cosph0*u*a,s<=y)return null;s=Math.sqrt(2/s),i=s*u*Math.sin(c),s*=this.mode===this.EQUIT?r:this.cosph0*r-this.sinph0*u*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)<y)return null;s=b-f*.5,s=2*(this.mode===this.S_POLE?Math.cos(s):Math.sin(s)),i=s*Math.sin(c),s*=a}}else{switch(n=0,o=0,l=0,a=Math.cos(c),e=Math.sin(c),r=Math.sin(f),h=K(this.e,r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(n=h/this.qp,o=Math.sqrt(1-n*n)),this.mode){case this.OBLIQ:l=1+this.sinb1*n+this.cosb1*o*a;break;case this.EQUIT:l=1+o*a;break;case this.N_POLE:l=M+f,h=this.qp-h;break;case this.S_POLE:l=f-M,h=this.qp+h;break}if(Math.abs(l)<y)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),this.mode===this.OBLIQ?s=this.ymf*l*(this.cosb1*n-this.sinb1*o*a):s=(l=Math.sqrt(2/(1+o*a)))*n*this.ymf,i=this.xmf*l*o*e;break;case this.N_POLE:case this.S_POLE:h>=0?(i=(l=Math.sqrt(h))*e,s=a*(this.mode===this.S_POLE?l:-l)):i=s=0;break}}return t.x=this.a*i+this.x0,t.y=this.a*s+this.y0,t}function nr(t){t.x-=this.x0,t.y-=this.y0;var i=t.x/this.a,s=t.y/this.a,a,e,r,h,n,o,l;if(this.sphere){var u=0,c,f=0;if(c=Math.sqrt(i*i+s*s),e=c*.5,e>1)return null;switch(e=2*Math.asin(e),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(f=Math.sin(e),u=Math.cos(e)),this.mode){case this.EQUIT:e=Math.abs(c)<=y?0:Math.asin(s*f/c),i*=f,s=u*c;break;case this.OBLIQ:e=Math.abs(c)<=y?this.lat0:Math.asin(u*this.sinph0+s*f*this.cosph0/c),i*=f*this.cosph0,s=(u-Math.sin(e)*this.sinph0)*c;break;case this.N_POLE:s=-s,e=M-e;break;case this.S_POLE:e-=M;break}a=s===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(i,s)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(i/=this.dd,s*=this.dd,o=Math.sqrt(i*i+s*s),o<y)return t.x=this.long0,t.y=this.lat0,t;h=2*Math.asin(.5*o/this.rq),r=Math.cos(h),i*=h=Math.sin(h),this.mode===this.OBLIQ?(l=r*this.sinb1+s*h*this.cosb1/o,n=this.qp*l,s=o*this.cosb1*r-s*this.sinb1*h):(l=s*h/o,n=this.qp*l,s=o*r)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),n=i*i+s*s,!n)return t.x=this.long0,t.y=this.lat0,t;l=1-n/this.qp,this.mode===this.S_POLE&&(l=-l)}a=Math.atan2(i,s),e=gr(Math.asin(l),this.apa)}return t.x=m(this.long0+a,this.over),t.y=e,t}var hr=.3333333333333333,or=.17222222222222222,lr=.10257936507936508,fr=.06388888888888888,cr=.0664021164021164,ur=.016415012942191543;function _r(t){var i,s=[];return s[0]=t*hr,i=t*t,s[0]+=i*or,s[1]=i*fr,i*=t,s[0]+=i*lr,s[1]+=i*cr,s[2]=i*ur,s}function gr(t,i){var s=t+t;return t+i[0]*Math.sin(s)+i[1]*Math.sin(s+s)+i[2]*Math.sin(s+s+s)}var Mr=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"];const vr={init:er,forward:rr,inverse:nr,names:Mr,S_POLE:ni,N_POLE:hi,EQUIT:oi,OBLIQ:$t};function Y(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}function dr(){Math.abs(this.lat1+this.lat2)<y||(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=Q(this.e3,this.sin_po,this.cos_po),this.qs1=K(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Q(this.e3,this.sin_po,this.cos_po),this.qs2=K(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=K(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>y?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)}function yr(t){var i=t.x,s=t.y;this.sin_phi=Math.sin(s),this.cos_phi=Math.cos(s);var a=K(this.e3,this.sin_phi),e=this.a*Math.sqrt(this.c-this.ns0*a)/this.ns0,r=this.ns0*m(i-this.long0,this.over),h=e*Math.sin(r)+this.x0,n=this.rh-e*Math.cos(r)+this.y0;return t.x=h,t.y=n,t}function mr(t){var i,s,a,e,r,h;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),a=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),a=-1),e=0,i!==0&&(e=Math.atan2(a*t.x,a*t.y)),a=i*this.ns0/this.a,this.sphere?h=Math.asin((this.c-a*a)/(2*this.ns0)):(s=(this.c-a*a)/this.ns0,h=this.phi1z(this.e3,s)),r=m(e/this.ns0+this.long0,this.over),t.x=r,t.y=h,t}function wr(t,i){var s,a,e,r,h,n=Y(.5*i);if(t<y)return n;for(var o=t*t,l=1;l<=25;l++)if(s=Math.sin(n),a=Math.cos(n),e=t*s,r=1-e*e,h=.5*r*r/a*(i/(1-o)-s/r+.5/t*Math.log((1-e)/(1+e))),n=n+h,Math.abs(h)<=1e-7)return n;return null}var Er=["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"];const Sr={init:dr,forward:yr,inverse:mr,names:Er,phi1z:wr};function Pr(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function xr(t){var i,s,a,e,r,h,n,o,l=t.x,u=t.y;return a=m(l-this.long0,this.over),i=Math.sin(u),s=Math.cos(u),e=Math.cos(a),h=this.sin_p14*i+this.cos_p14*s*e,r=1,h>0||Math.abs(h)<=y?(n=this.x0+this.a*r*s*Math.sin(a)/h,o=this.y0+this.a*r*(this.cos_p14*i-this.sin_p14*s*e)/h):(n=this.x0+this.infinity_dist*s*Math.sin(a),o=this.y0+this.infinity_dist*(this.cos_p14*i-this.sin_p14*s*e)),t.x=n,t.y=o,t}function Gr(t){var i,s,a,e,r,h;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,(i=Math.sqrt(t.x*t.x+t.y*t.y))?(e=Math.atan2(i,this.rc),s=Math.sin(e),a=Math.cos(e),h=Y(a*this.sin_p14+t.y*s*this.cos_p14/i),r=Math.atan2(t.x*s,i*this.cos_p14*a-t.y*this.sin_p14*s),r=m(this.long0+r,this.over)):(h=this.phic0,r=0),t.x=r,t.y=h,t}var br=["gnom"];const Ar={init:Pr,forward:xr,inverse:Gr,names:br};function pr(t,i){var s=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(i)-s)<1e-6)return i<0?-1*M:M;for(var a=Math.asin(.5*i),e,r,h,n,o=0;o<30;o++)if(r=Math.sin(a),h=Math.cos(a),n=t*r,e=Math.pow(1-n*n,2)/(2*h)*(i/(1-t*t)-r/(1-n*n)+.5/t*Math.log((1-n)/(1+n))),a+=e,Math.abs(e)<=1e-10)return a;return NaN}function Nr(){this.sphere||(this.k0=Q(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Ir(t){var i=t.x,s=t.y,a,e,r=m(i-this.long0,this.over);if(this.sphere)a=this.x0+this.a*r*Math.cos(this.lat_ts),e=this.y0+this.a*Math.sin(s)/Math.cos(this.lat_ts);else{var h=K(this.e,Math.sin(s));a=this.x0+this.a*this.k0*r,e=this.y0+this.a*h*.5/this.k0}return t.x=a,t.y=e,t}function Cr(t){t.x-=this.x0,t.y-=this.y0;var i,s;return this.sphere?(i=m(this.long0+t.x/this.a/Math.cos(this.lat_ts),this.over),s=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(s=pr(this.e,2*t.y*this.k0/this.a),i=m(this.long0+t.x/(this.a*this.k0),this.over)),t.x=i,t.y=s,t}var Rr=["cea"];const Or={init:Nr,forward:Ir,inverse:Cr,names:Rr};function Tr(){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)}function Lr(t){var i=t.x,s=t.y,a=m(i-this.long0,this.over),e=tt(s-this.lat0);return t.x=this.x0+this.a*a*this.rc,t.y=this.y0+this.a*e,t}function qr(t){var i=t.x,s=t.y;return t.x=m(this.long0+(i-this.x0)/(this.a*this.rc),this.over),t.y=tt(this.lat0+(s-this.y0)/this.a),t}var Ur=["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"];const Fr={init:Tr,forward:Lr,inverse:qr,names:Ur};var zi=20;function Dr(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Ct(this.es),this.e1=Rt(this.es),this.e2=Ot(this.es),this.e3=Tt(this.es),this.ml0=this.a*U(this.e0,this.e1,this.e2,this.e3,this.lat0)}function kr(t){var i=t.x,s=t.y,a,e,r,h=m(i-this.long0,this.over);if(r=h*Math.sin(s),this.sphere)Math.abs(s)<=y?(a=this.a*h,e=-1*this.a*this.lat0):(a=this.a*Math.sin(r)/Math.tan(s),e=this.a*(tt(s-this.lat0)+(1-Math.cos(r))/Math.tan(s)));else if(Math.abs(s)<=y)a=this.a*h,e=-1*this.ml0;else{var n=mi(this.a,this.e,Math.sin(s))/Math.tan(s);a=n*Math.sin(r),e=this.a*U(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+n*(1-Math.cos(r))}return t.x=a+this.x0,t.y=e+this.y0,t}function $r(t){var i,s,a,e,r,h,n,o,l;if(a=t.x-this.x0,e=t.y-this.y0,this.sphere)if(Math.abs(e+this.a*this.lat0)<=y)i=m(a/this.a+this.long0,this.over),s=0;else{h=this.lat0+e/this.a,n=a*a/this.a/this.a+h*h,o=h;var u;for(r=zi;r;--r)if(u=Math.tan(o),l=-1*(h*(o*u+1)-o-.5*(o*o+n)*u)/((o-h)/u-1),o+=l,Math.abs(l)<=y){s=o;break}i=m(this.long0+Math.asin(a*Math.tan(o)/this.a)/Math.sin(s),this.over)}else if(Math.abs(e+this.ml0)<=y)s=0,i=m(this.long0+a/this.a,this.over);else{h=(this.ml0+e)/this.a,n=a*a/this.a/this.a+h*h,o=h;var c,f,_,g,v;for(r=zi;r;--r)if(v=this.e*Math.sin(o),c=Math.sqrt(1-v*v)*Math.tan(o),f=this.a*U(this.e0,this.e1,this.e2,this.e3,o),_=this.e0-2*this.e1*Math.cos(2*o)+4*this.e2*Math.cos(4*o)-6*this.e3*Math.cos(6*o),g=f/this.a,l=(h*(c*g+1)-g-.5*c*(g*g+n))/(this.es*Math.sin(2*o)*(g*g+n-2*h*g)/(4*c)+(h-g)*(c*_-2/Math.sin(2*o))-_),o-=l,Math.abs(l)<=y){s=o;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(s),2))*Math.tan(s),i=m(this.long0+Math.asin(a*c/this.a)/Math.sin(s),this.over)}return t.x=i,t.y=s,t}var jr=["Polyconic","American_Polyconic","poly"];const Br={init:Dr,forward:kr,inverse:$r,names:jr};function zr(){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}function Wr(t){var i,s=t.x,a=t.y,e=a-this.lat0,r=s-this.long0,h=e/wt*1e-5,n=r,o=1,l=0;for(i=1;i<=10;i++)o=o*h,l=l+this.A[i]*o;var u=l,c=n,f=1,_=0,g,v,d=0,w=0;for(i=1;i<=6;i++)g=f*u-_*c,v=_*u+f*c,f=g,_=v,d=d+this.B_re[i]*f-this.B_im[i]*_,w=w+this.B_im[i]*f+this.B_re[i]*_;return t.x=w*this.a+this.x0,t.y=d*this.a+this.y0,t}function Hr(t){var i,s=t.x,a=t.y,e=s-this.x0,r=a-this.y0,h=r/this.a,n=e/this.a,o=1,l=0,u,c,f=0,_=0;for(i=1;i<=6;i++)u=o*h-l*n,c=l*h+o*n,o=u,l=c,f=f+this.C_re[i]*o-this.C_im[i]*l,_=_+this.C_im[i]*o+this.C_re[i]*l;for(var g=0;g<this.iterations;g++){var v=f,d=_,w,E,S=h,x=n;for(i=2;i<=6;i++)w=v*f-d*_,E=d*f+v*_,v=w,d=E,S=S+(i-1)*(this.B_re[i]*v-this.B_im[i]*d),x=x+(i-1)*(this.B_im[i]*v+this.B_re[i]*d);v=1,d=0;var P=this.B_re[1],G=this.B_im[1];for(i=2;i<=6;i++)w=v*f-d*_,E=d*f+v*_,v=w,d=E,P=P+i*(this.B_re[i]*v-this.B_im[i]*d),G=G+i*(this.B_im[i]*v+this.B_re[i]*d);var p=P*P+G*G;f=(S*P+x*G)/p,_=(x*P-S*G)/p}var L=f,O=_,X=1,j=0;for(i=1;i<=9;i++)X=X*L,j=j+this.D[i]*X;var et=this.lat0+j*wt*1e5,rt=this.long0+O;return t.x=rt,t.y=et,t}var Qr=["New_Zealand_Map_Grid","nzmg"];const Vr={init:zr,forward:Wr,inverse:Hr,names:Qr};function Xr(){}function Jr(t){var i=t.x,s=t.y,a=m(i-this.long0,this.over),e=this.x0+this.a*a,r=this.y0+this.a*Math.log(Math.tan(Math.PI/4+s/2.5))*1.25;return t.x=e,t.y=r,t}function Kr(t){t.x-=this.x0,t.y-=this.y0;var i=m(this.long0+t.x/this.a,this.over),s=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=i,t.y=s,t}var Zr=["Miller_Cylindrical","mill"];const Yr={init:Xr,forward:Jr,inverse:Kr,names:Zr};var tn=20;function sn(){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=_i(this.es)}function an(t){var i,s,a=t.x,e=t.y;if(a=m(a-this.long0,this.over),this.sphere){if(!this.m)e=this.n!==1?Math.asin(this.n*Math.sin(e)):e;else for(var r=this.n*Math.sin(e),h=tn;h;--h){var n=(this.m*e+Math.sin(e)-r)/(this.m+Math.cos(e));if(e-=n,Math.abs(n)<y)break}i=this.a*this.C_x*a*(this.m+Math.cos(e)),s=this.a*this.C_y*e}else{var o=Math.sin(e),l=Math.cos(e);s=this.a*Mt(e,o,l,this.en),i=this.a*a*l/Math.sqrt(1-this.es*o*o)}return t.x=i,t.y=s,t}function en(t){var i,s,a,e;return t.x-=this.x0,a=t.x/this.a,t.y-=this.y0,i=t.y/this.a,this.sphere?(i/=this.C_y,a=a/(this.C_x*(this.m+Math.cos(i))),this.m?i=Y((this.m*i+Math.sin(i))/this.n):this.n!==1&&(i=Y(Math.sin(i)/this.n)),a=m(a+this.long0,this.over),i=tt(i)):(i=gi(t.y/this.a,this.es,this.en),e=Math.abs(i),e<M?(e=Math.sin(i),s=this.long0+t.x*Math.sqrt(1-this.es*e*e)/(this.a*Math.cos(i)),a=m(s,this.over)):e-y<M&&(a=this.long0)),t.x=a,t.y=i,t}var rn=["Sinusoidal","sinu"];const nn={init:sn,forward:an,inverse:en,names:rn};function hn(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0}function on(t){for(var i=t.x,s=t.y,a=m(i-this.long0,this.over),e=s,r=Math.PI*Math.sin(s);;){var h=-(e+Math.sin(e)-r)/(1+Math.cos(e));if(e+=h,Math.abs(h)<y)break}e/=2,Math.PI/2-Math.abs(s)<y&&(a=0);var n=.900316316158*this.a*a*Math.cos(e)+this.x0,o=1.4142135623731*this.a*Math.sin(e)+this.y0;return t.x=n,t.y=o,t}function ln(t){var i,s;t.x-=this.x0,t.y-=this.y0,s=t.y/(1.4142135623731*this.a),Math.abs(s)>.999999999999&&(s=.999999999999),i=Math.asin(s);var a=m(this.long0+t.x/(.900316316158*this.a*Math.cos(i)),this.over);a<-Math.PI&&(a=-Math.PI),a>Math.PI&&(a=Math.PI),s=(2*i+Math.sin(2*i))/Math.PI,Math.abs(s)>1&&(s=1);var e=Math.asin(s);return t.x=a,t.y=e,t}var fn=["Mollweide","moll"];const cn={init:hn,forward:on,inverse:ln,names:fn};function un(){Math.abs(this.lat1+this.lat2)<y||(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=Ct(this.es),this.e1=Rt(this.es),this.e2=Ot(this.es),this.e3=Tt(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Q(this.e,this.sin_phi,this.cos_phi),this.ml1=U(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<y?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Q(this.e,this.sin_phi,this.cos_phi),this.ml2=U(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=U(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function _n(t){var i=t.x,s=t.y,a;if(this.sphere)a=this.a*(this.g-s);else{var e=U(this.e0,this.e1,this.e2,this.e3,s);a=this.a*(this.g-e)}var r=this.ns*m(i-this.long0,this.over),h=this.x0+a*Math.sin(r),n=this.y0+this.rh-a*Math.cos(r);return t.x=h,t.y=n,t}function gn(t){t.x-=this.x0,t.y=this.rh-t.y+this.y0;var i,s,a,e;this.ns>=0?(s=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(s=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1);var r=0;if(s!==0&&(r=Math.atan2(i*t.x,i*t.y)),this.sphere)return e=m(this.long0+r/this.ns,this.over),a=tt(this.g-s/this.a),t.x=e,t.y=a,t;var h=this.g-s/this.a;return a=Ht(h,this.e0,this.e1,this.e2,this.e3),e=m(this.long0+r/this.ns,this.over),t.x=e,t.y=a,t}var Mn=["Equidistant_Conic","eqdc"];const vn={init:un,forward:_n,inverse:gn,names:Mn};function dn(){this.R=this.a}function yn(t){var i=t.x,s=t.y,a=m(i-this.long0,this.over),e,r;Math.abs(s)<=y&&(e=this.x0+this.R*a,r=this.y0);var h=Y(2*Math.abs(s/Math.PI));(Math.abs(a)<=y||Math.abs(Math.abs(s)-M)<=y)&&(e=this.x0,s>=0?r=this.y0+Math.PI*this.R*Math.tan(.5*h):r=this.y0+Math.PI*this.R*-Math.tan(.5*h));var n=.5*Math.abs(Math.PI/a-a/Math.PI),o=n*n,l=Math.sin(h),u=Math.cos(h),c=u/(l+u-1),f=c*c,_=c*(2/l-1),g=_*_,v=Math.PI*this.R*(n*(c-g)+Math.sqrt(o*(c-g)*(c-g)-(g+o)*(f-g)))/(g+o);a<0&&(v=-v),e=this.x0+v;var d=o+c;return v=Math.PI*this.R*(_*d-n*Math.sqrt((g+o)*(o+1)-d*d))/(g+o),s>=0?r=this.y0+v:r=this.y0-v,t.x=e,t.y=r,t}function mn(t){var i,s,a,e,r,h,n,o,l,u,c,f,_;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,a=t.x/c,e=t.y/c,r=a*a+e*e,h=-Math.abs(e)*(1+r),n=h-2*e*e+a*a,o=-2*h+1+2*e*e+r*r,_=e*e/o+(2*n*n*n/o/o/o-9*h*n/o/o)/27,l=(h-n*n/3/o)/o,u=2*Math.sqrt(-l/3),c=3*_/l/u,Math.abs(c)>1&&(c>=0?c=1:c=-1),f=Math.acos(c)/3,t.y>=0?s=(-u*Math.cos(f+Math.PI/3)-n/3/o)*Math.PI:s=-(-u*Math.cos(f+Math.PI/3)-n/3/o)*Math.PI,Math.abs(a)<y?i=this.long0:i=m(this.long0+Math.PI*(r-1+Math.sqrt(1+2*(a*a-e*e)+r*r))/2/a,this.over),t.x=i,t.y=s,t}var wn=["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"];const En={init:dn,forward:yn,inverse:mn,names:wn};function Sn(t,i,s,a,e,r){const h=a-i,n=Math.atan((1-r)*Math.tan(t)),o=Math.atan((1-r)*Math.tan(s)),l=Math.sin(n),u=Math.cos(n),c=Math.sin(o),f=Math.cos(o);let _=h,g,v=100,d,w,E,S,x,P,G,p,L,O,X,j,et,rt;do{if(d=Math.sin(_),w=Math.cos(_),E=Math.sqrt(f*d*(f*d)+(u*c-l*f*w)*(u*c-l*f*w)),E===0)return{azi1:0,s12:0};S=l*c+u*f*w,x=Math.atan2(E,S),P=u*f*d/E,G=1-P*P,p=G!==0?S-2*l*c/G:0,L=r/16*G*(4+r*(4-3*G)),g=_,_=h+(1-L)*r*P*(x+L*E*(p+L*S*(-1+2*p*p)))}while(Math.abs(_-g)>1e-12&&--v>0);return v===0?{azi1:NaN,s12:NaN}:(O=G*(e*e-e*(1-r)*(e*(1-r)))/(e*(1-r)*(e*(1-r))),X=1+O/16384*(4096+O*(-768+O*(320-175*O))),j=O/1024*(256+O*(-128+O*(74-47*O))),et=j*E*(p+j/4*(S*(-1+2*p*p)-j/6*p*(-3+4*E*E)*(-3+4*p*p))),rt=e*(1-r)*X*(x-et),{azi1:Math.atan2(f*d,u*c-l*f*w),s12:rt})}function Pn(t,i,s,a,e,r){const h=Math.atan((1-r)*Math.tan(t)),n=Math.sin(h),o=Math.cos(h),l=Math.sin(s),u=Math.cos(s),c=Math.atan2(n,o*u),f=o*l,_=1-f*f,g=_*(e*e-e*(1-r)*(e*(1-r)))/(e*(1-r)*(e*(1-r))),v=1+g/16384*(4096+g*(-768+g*(320-175*g))),d=g/1024*(256+g*(-128+g*(74-47*g)));let w=a/(e*(1-r)*v),E,S=100,x,P,G,p;do x=Math.cos(2*c+w),P=Math.sin(w),G=Math.cos(w),p=d*P*(x+d/4*(G*(-1+2*x*x)-d/6*x*(-3+4*P*P)*(-3+4*x*x))),E=w,w=a/(e*(1-r)*v)+p;while(Math.abs(w-E)>1e-12&&--S>0);if(S===0)return{lat2:NaN,lon2:NaN};const L=n*P-o*G*u,O=Math.atan2(n*G+o*P*u,(1-r)*Math.sqrt(f*f+L*L)),X=Math.atan2(P*l,o*G-n*P*u),j=r/16*_*(4+r*(4-3*_)),et=X-(1-j)*r*f*(w+j*P*(x+j*G*(-1+2*x*x))),rt=i+et;return{lat2:O,lon2:rt}}function xn(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))}function Gn(t){var i=t.x,s=t.y,a=Math.sin(t.y),e=Math.cos(t.y),r=m(i-this.long0,this.over),h,n,o,l,u,c,f,_,g,v,d;return this.sphere?Math.abs(this.sin_p12-1)<=y?(t.x=this.x0+this.a*(M-s)*Math.sin(r),t.y=this.y0-this.a*(M-s)*Math.cos(r),t):Math.abs(this.sin_p12+1)<=y?(t.x=this.x0+this.a*(M+s)*Math.sin(r),t.y=this.y0+this.a*(M+s)*Math.cos(r),t):(g=this.sin_p12*a+this.cos_p12*e*Math.cos(r),f=Math.acos(g),_=f?f/Math.sin(f):1,t.x=this.x0+this.a*_*e*Math.sin(r),t.y=this.y0+this.a*_*(this.cos_p12*a-this.sin_p12*e*Math.cos(r)),t):(h=Ct(this.es),n=Rt(this.es),o=Ot(this.es),l=Tt(this.es),Math.abs(this.sin_p12-1)<=y?(u=this.a*U(h,n,o,l,M),c=this.a*U(h,n,o,l,s),t.x=this.x0+(u-c)*Math.sin(r),t.y=this.y0-(u-c)*Math.cos(r),t):Math.abs(this.sin_p12+1)<=y?(u=this.a*U(h,n,o,l,M),c=this.a*U(h,n,o,l,s),t.x=this.x0+(u+c)*Math.sin(r),t.y=this.y0+(u+c)*Math.cos(r),t):Math.abs(i)<y&&Math.abs(s-this.lat0)<y?(t.x=t.y=0,t):(v=Sn(this.lat0,this.long0,s,i,this.a,this.f),d=v.azi1,t.x=v.s12*Math.sin(d),t.y=v.s12*Math.cos(d),t))}function bn(t){t.x-=this.x0,t.y-=this.y0;var i,s,a,e,r,h,n,o,l,u,c,f,_,g,v,d;return this.sphere?(i=Math.sqrt(t.x*t.x+t.y*t.y),i>2*M*this.a?void 0:(s=i/this.a,a=Math.sin(s),e=Math.cos(s),r=this.long0,Math.abs(i)<=y?h=this.lat0:(h=Y(e*this.sin_p12+t.y*a*this.cos_p12/i),n=Math.abs(this.lat0)-M,Math.abs(n)<=y?this.lat0>=0?r=m(this.long0+Math.atan2(t.x,-t.y),this.over):r=m(this.long0-Math.atan2(-t.x,t.y),this.over):r=m(this.long0+Math.atan2(t.x*a,i*this.cos_p12*e-t.y*this.sin_p12*a),this.over)),t.x=r,t.y=h,t)):(o=Ct(this.es),l=Rt(this.es),u=Ot(this.es),c=Tt(this.es),Math.abs(this.sin_p12-1)<=y?(f=this.a*U(o,l,u,c,M),i=Math.sqrt(t.x*t.x+t.y*t.y),_=f-i,h=Ht(_/this.a,o,l,u,c),r=m(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=r,t.y=h,t):Math.abs(this.sin_p12+1)<=y?(f=this.a*U(o,l,u,c,M),i=Math.sqrt(t.x*t.x+t.y*t.y),_=i-f,h=Ht(_/this.a,o,l,u,c),r=m(this.long0+Math.atan2(t.x,t.y),this.over),t.x=r,t.y=h,t):(g=Math.atan2(t.x,t.y),v=Math.sqrt(t.x*t.x+t.y*t.y),d=Pn(this.lat0,this.long0,g,v,this.a,this.f),t.x=d.lon2,t.y=d.lat2,t))}var An=["Azimuthal_Equidistant","aeqd"];const pn={init:xn,forward:Gn,inverse:bn,names:An};function Nn(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function In(t){var i,s,a,e,r,h,n,o,l=t.x,u=t.y;return a=m(l-(this.long0||0),this.over),i=Math.sin(u),s=Math.cos(u),e=Math.cos(a),h=this.sin_p14*i+this.cos_p14*s*e,r=1,(h>0||Math.abs(h)<=y)&&(n=this.a*r*s*Math.sin(a),o=(this.y0||0)+this.a*r*(this.cos_p14*i-this.sin_p14*s*e)),t.x=n,t.y=o,t}function Cn(t){var i,s,a,e,r,h,n,o,l;return t.x-=this.x0||0,t.y-=this.y0||0,i=Math.sqrt(t.x*t.x+t.y*t.y),s=Y(i/this.a),a=Math.sin(s),e=Math.cos(s),o=this.long0||0,l=this.lat0||0,h=o,Math.abs(i)<=y?(n=l,t.x=h,t.y=n,t):(n=Y(e*this.sin_p14+t.y*a*this.cos_p14/i),r=Math.abs(l)-M,Math.abs(r)<=y?(l>=0?h=m(o+Math.atan2(t.x,-t.y),this.over):h=m(o-Math.atan2(-t.x,t.y),this.over),t.x=h,t.y=n,t):(h=m(o+Math.atan2(t.x*a,i*this.cos_p14*e-t.y*this.sin_p14*a),this.over),t.x=h,t.y=n,t))}var Rn=["ortho"];const On={init:Nn,forward:In,inverse:Cn,names:Rn};var N={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},A={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Tn(){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>=M-b/2?this.face=N.TOP:this.lat0<=-(M-b/2)?this.face=N.BOTTOM:Math.abs(this.long0)<=b?this.face=N.FRONT:Math.abs(this.long0)<=M+b?this.face=this.long0>0?N.RIGHT:N.LEFT:this.face=N.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function Ln(t){var i={x:0,y:0},s,a,e,r,h,n,o={value:0};if(t.x-=this.long0,this.es!==0?s=Math.atan(this.one_minus_f_squared*Math.tan(t.y)):s=t.y,a=t.x,this.face===N.TOP)r=M-s,a>=b&&a<=M+b?(o.value=A.AREA_0,e=a-M):a>M+b||a<=-(M+b)?(o.value=A.AREA_1,e=a>0?a-C:a+C):a>-(M+b)&&a<=-b?(o.value=A.AREA_2,e=a+M):(o.value=A.AREA_3,e=a);else if(this.face===N.BOTTOM)r=M+s,a>=b&&a<=M+b?(o.value=A.AREA_0,e=-a+M):a<b&&a>=-b?(o.value=A.AREA_1,e=-a):a<-b&&a>=-(M+b)?(o.value=A.AREA_2,e=-a-M):(o.value=A.AREA_3,e=a>0?-a+C:-a-C);else{var l,u,c,f,_,g,v;this.face===N.RIGHT?a=ut(a,+M):this.face===N.BACK?a=ut(a,+C):this.face===N.LEFT&&(a=ut(a,-M)),f=Math.sin(s),_=Math.cos(s),g=Math.sin(a),v=Math.cos(a),l=_*v,u=_*g,c=f,this.face===N.FRONT?(r=Math.acos(l),e=Ut(r,c,u,o)):this.face===N.RIGHT?(r=Math.acos(u),e=Ut(r,c,-l,o)):this.face===N.BACK?(r=Math.acos(-l),e=Ut(r,c,-u,o)):this.face===N.LEFT?(r=Math.acos(-u),e=Ut(r,c,l,o)):(r=e=0,o.value=A.AREA_0)}return n=Math.atan(12/C*(e+Math.acos(Math.sin(e)*Math.cos(b))-M)),h=Math.sqrt((1-Math.cos(r))/(Math.cos(n)*Math.cos(n))/(1-Math.cos(Math.atan(1/Math.cos(e))))),o.value===A.AREA_1?n+=M:o.value===A.AREA_2?n+=C:o.value===A.AREA_3&&(n+=1.5*C),i.x=h*Math.cos(n),i.y=h*Math.sin(n),i.x=i.x*this.a+this.x0,i.y=i.y*this.a+this.y0,t.x=i.x,t.y=i.y,t}function qn(t){var i={lam:0,phi:0},s,a,e,r,h,n,o,l,u,c={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,a=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)?c.value=A.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(c.value=A.AREA_1,s-=M):t.x<0&&-t.x>=Math.abs(t.y)?(c.value=A.AREA_2,s=s<0?s+C:s-C):(c.value=A.AREA_3,s+=M),u=C/12*Math.tan(s),h=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),n=Math.atan(h),e=Math.cos(s),r=Math.tan(a),o=1-e*e*r*r*(1-Math.cos(Math.atan(1/Math.cos(n)))),o<-1?o=-1:o>1&&(o=1),this.face===N.TOP)l=Math.acos(o),i.phi=M-l,c.value===A.AREA_0?i.lam=n+M:c.value===A.AREA_1?i.lam=n<0?n+C:n-C:c.value===A.AREA_2?i.lam=n-M:i.lam=n;else if(this.face===N.BOTTOM)l=Math.acos(o),i.phi=l-M,c.value===A.AREA_0?i.lam=-n+M:c.value===A.AREA_1?i.lam=-n:c.value===A.AREA_2?i.lam=-n-M:i.lam=n<0?-n-C:-n+C;else{var f,_,g;f=o,u=f*f,u>=1?g=0:g=Math.sqrt(1-u)*Math.sin(n),u+=g*g,u>=1?_=0:_=Math.sqrt(1-u),c.value===A.AREA_1?(u=_,_=-g,g=u):c.value===A.AREA_2?(_=-_,g=-g):c.value===A.AREA_3&&(u=_,_=g,g=-u),this.face===N.RIGHT?(u=f,f=-_,_=u):this.face===N.BACK?(f=-f,_=-_):this.face===N.LEFT&&(u=f,f=_,_=-u),i.phi=Math.acos(-g)-M,i.lam=Math.atan2(_,f),this.face===N.RIGHT?i.lam=ut(i.lam,-M):this.face===N.BACK?i.lam=ut(i.lam,-C):this.face===N.LEFT&&(i.lam=ut(i.lam,+M))}if(this.es!==0){var v,d,w;v=i.phi<0?1:0,d=Math.tan(i.phi),w=this.b/Math.sqrt(d*d+this.one_minus_f_squared),i.phi=Math.atan(Math.sqrt(this.a*this.a-w*w)/(this.one_minus_f*w)),v&&(i.phi=-i.phi)}return i.lam+=this.long0,t.x=i.lam,t.y=i.phi,t}function Ut(t,i,s,a){var e;return t<y?(a.value=A.AREA_0,e=0):(e=Math.atan2(i,s),Math.abs(e)<=b?a.value=A.AREA_0:e>b&&e<=M+b?(a.value=A.AREA_1,e-=M):e>M+b||e<=-(M+b)?(a.value=A.AREA_2,e=e>=0?e-C:e+C):(a.value=A.AREA_3,e+=M)),e}function ut(t,i){var s=t+i;return s<-C?s+=Gt:s>+C&&(s-=Gt),s}var Un=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"];const Fn={init:Tn,forward:Ln,inverse:qn,names:Un};var li=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.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,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.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]],mt=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],ys=.8487,ms=1.3523,ws=k/5,Dn=1/ws,ft=18,Qt=function(t,i){return t[0]+i*(t[1]+i*(t[2]+i*t[3]))},kn=function(t,i){return t[1]+i*(2*t[2]+i*3*t[3])};function $n(t,i,s,a){for(var e=i;a;--a){var r=t(e);if(e-=r,Math.abs(r)<s)break}return e}function jn(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function Bn(t){var i=m(t.x-this.long0,this.over),s=Math.abs(t.y),a=Math.floor(s*ws);a<0?a=0:a>=ft&&(a=ft-1),s=k*(s-Dn*a);var e={x:Qt(li[a],s)*i,y:Qt(mt[a],s)};return t.y<0&&(e.y=-e.y),e.x=e.x*this.a*ys+this.x0,e.y=e.y*this.a*ms+this.y0,e}function zn(t){var i={x:(t.x-this.x0)/(this.a*ys),y:Math.abs(t.y-this.y0)/(this.a*ms)};if(i.y>=1)i.x/=li[ft][0],i.y=t.y<0?-M:M;else{var s=Math.floor(i.y*ft);for(s<0?s=0:s>=ft&&(s=ft-1);;)if(mt[s][0]>i.y)--s;else if(mt[s+1][0]<=i.y)++s;else break;var a=mt[s],e=5*(i.y-a[0])/(mt[s+1][0]-a[0]);e=$n(function(r){return(Qt(a,r)-i.y)/kn(a,r)},e,y,100),i.x/=Qt(li[s],e),i.y=(5*s+e)*I,t.y<0&&(i.y=-i.y)}return i.x=m(i.x+this.long0,this.over),i}var Wn=["Robinson","robin"];const Hn={init:jn,forward:Bn,inverse:zn,names:Wn};function Qn(){this.name="geocent"}function Vn(t){var i=hs(t,this.es,this.a);return i}function Xn(t){var i=os(t,this.es,this.a,this.b);return i}var Jn=["Geocentric","geocentric","geocent","Geocent"];const Kn={init:Qn,forward:Vn,inverse:Xn,names:Jn};var q={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},vt={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function Zn(){if(Object.keys(vt).forEach(function(s){if(typeof this[s]>"u")this[s]=vt[s].def;else{if(vt[s].num&&isNaN(this[s]))throw new Error("Invalid parameter value, must be numeric "+s+" = "+this[s]);vt[s].num&&(this[s]=parseFloat(this[s]))}vt[s].degrees&&(this[s]=this[s]*I)}.bind(this)),Math.abs(Math.abs(this.lat0)-M)<y?this.mode=this.lat0<0?q.S_POLE:q.N_POLE:Math.abs(this.lat0)<y?this.mode=q.EQUIT:(this.mode=q.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var t=this.tilt,i=this.azi;this.cg=Math.cos(i),this.sg=Math.sin(i),this.cw=Math.cos(t),this.sw=Math.sin(t)}function Yn(t){t.x-=this.long0;var i=Math.sin(t.y),s=Math.cos(t.y),a=Math.cos(t.x),e,r;switch(this.mode){case q.OBLIQ:r=this.sinph0*i+this.cosph0*s*a;break;case q.EQUIT:r=s*a;break;case q.S_POLE:r=-i;break;case q.N_POLE:r=i;break}switch(r=this.pn1/(this.p-r),e=r*s*Math.sin(t.x),this.mode){case q.OBLIQ:r*=this.cosph0*i-this.sinph0*s*a;break;case q.EQUIT:r*=i;break;case q.N_POLE:r*=-(s*a);break;case q.S_POLE:r*=s*a;break}var h,n;return h=r*this.cg+e*this.sg,n=1/(h*this.sw*this.h1+this.cw),e=(e*this.cg-r*this.sg)*this.cw*n,r=h*n,t.x=e*this.a,t.y=r*this.a,t}function th(t){t.x/=this.a,t.y/=this.a;var i={x:t.x,y:t.y},s,a,e;e=1/(this.pn1-t.y*this.sw),s=this.pn1*t.x*e,a=this.pn1*t.y*this.cw*e,t.x=s*this.cg+a*this.sg,t.y=a*this.cg-s*this.sg;var r=D(t.x,t.y);if(Math.abs(r)<y)i.x=0,i.y=t.y;else{var h,n;switch(n=1-r*r*this.pfact,n=(this.p-Math.sqrt(n))/(this.pn1/r+r/this.pn1),h=Math.sqrt(1-n*n),this.mode){case q.OBLIQ:i.y=Math.asin(h*this.sinph0+t.y*n*this.cosph0/r),t.y=(h-this.sinph0*Math.sin(i.y))*r,t.x*=n*this.cosph0;break;case q.EQUIT:i.y=Math.asin(t.y*n/r),t.y=h*r,t.x*=n;break;case q.N_POLE:i.y=Math.asin(h),t.y=-t.y;break;case q.S_POLE:i.y=-Math.asin(h);break}i.x=Math.atan2(t.x,t.y)}return t.x=i.x+this.long0,t.y=i.y,t}var ih=["Tilted_Perspective","tpers"];const sh={init:Zn,forward:Yn,inverse:th,names:ih};function ah(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var t=1-this.es,i=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=i,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function eh(t){var i=t.x,s=t.y,a,e,r,h;if(i=i-this.long0,this.shape==="ellipse"){s=Math.atan(this.radius_p2*Math.tan(s));var n=this.radius_p/D(this.radius_p*Math.cos(s),Math.sin(s));if(e=n*Math.cos(i)*Math.cos(s),r=n*Math.sin(i)*Math.cos(s),h=n*Math.sin(s),(this.radius_g-e)*e-r*r-h*h*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;a=this.radius_g-e,this.flip_axis?(t.x=this.radius_g_1*Math.atan(r/D(h,a)),t.y=this.radius_g_1*Math.atan(h/a)):(t.x=this.radius_g_1*Math.atan(r/a),t.y=this.radius_g_1*Math.atan(h/D(r,a)))}else this.shape==="sphere"&&(a=Math.cos(s),e=Math.cos(i)*a,r=Math.sin(i)*a,h=Math.sin(s),a=this.radius_g-e,this.flip_axis?(t.x=this.radius_g_1*Math.atan(r/D(h,a)),t.y=this.radius_g_1*Math.atan(h/a)):(t.x=this.radius_g_1*Math.atan(r/a),t.y=this.radius_g_1*Math.atan(h/D(r,a))));return t.x=t.x*this.a,t.y=t.y*this.a,t}function rh(t){var i=-1,s=0,a=0,e,r,h,n;if(t.x=t.x/this.a,t.y=t.y/this.a,this.shape==="ellipse"){this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),s=Math.tan(t.x/this.radius_g_1)*D(1,a)):(s=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*D(1,s));var o=a/this.radius_p;if(e=s*s+o*o+i*i,r=2*this.radius_g*i,h=r*r-4*e*this.C,h<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-r-Math.sqrt(h))/(2*e),i=this.radius_g+n*i,s*=n,a*=n,t.x=Math.atan2(s,i),t.y=Math.atan(a*Math.cos(t.x)/i),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if(this.shape==="sphere"){if(this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),s=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+a*a)):(s=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+s*s)),e=s*s+a*a+i*i,r=2*this.radius_g*i,h=r*r-4*e*this.C,h<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-r-Math.sqrt(h))/(2*e),i=this.radius_g+n*i,s*=n,a*=n,t.x=Math.atan2(s,i),t.y=Math.atan(a*Math.cos(t.x)/i)}return t.x=t.x+this.long0,t}var nh=["Geostationary Satellite View","Geostationary_Satellite","geos"];const hh={init:ah,forward:eh,inverse:rh,names:nh};var Et=1.340264,St=-.081106,Pt=893e-6,xt=.003796,Vt=Math.sqrt(3)/2;function oh(){this.es=0,this.long0=this.long0!==void 0?this.long0:0,this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0}function lh(t){var i=m(t.x-this.long0,this.over),s=t.y,a=Math.asin(Vt*Math.sin(s)),e=a*a,r=e*e*e;return t.x=i*Math.cos(a)/(Vt*(Et+3*St*e+r*(7*Pt+9*xt*e))),t.y=a*(Et+St*e+r*(Pt+xt*e)),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function fh(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a;var i=1e-9,s=12,a=t.y,e,r,h,n,o,l;for(l=0;l<s&&(e=a*a,r=e*e*e,h=a*(Et+St*e+r*(Pt+xt*e))-t.y,n=Et+3*St*e+r*(7*Pt+9*xt*e),a-=o=h/n,!(Math.abs(o)<i));++l);return e=a*a,r=e*e*e,t.x=Vt*t.x*(Et+3*St*e+r*(7*Pt+9*xt*e))/Math.cos(a),t.y=Math.asin(Math.sin(a)/Vt),t.x=m(t.x+this.long0,this.over),t}var ch=["eqearth","Equal Earth","Equal_Earth"];const uh={init:oh,forward:lh,inverse:fh,names:ch};var pt=1e-10;function _h(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<pt)throw new Error;this.es?(this.en=_i(this.es),this.m1=Mt(this.phi1,this.am1=Math.sin(this.phi1),t=Math.cos(this.phi1),this.en),this.am1=t/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=Mh,this.forward=gh):(Math.abs(this.phi1)+pt>=M?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=dh,this.forward=vh)}function gh(t){var i=m(t.x-(this.long0||0),this.over),s=t.y,a,e,r;return a=this.am1+this.m1-Mt(s,e=Math.sin(s),r=Math.cos(s),this.en),e=r*i/(a*Math.sqrt(1-this.es*e*e)),t.x=a*Math.sin(e),t.y=this.am1-a*Math.cos(e),t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function Mh(t){t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var i,s,a,e;if(s=D(t.x,t.y=this.am1-t.y),e=gi(this.am1+this.m1-s,this.es,this.en),(i=Math.abs(e))<M)i=Math.sin(e),a=s*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*i*i)/Math.cos(e);else if(Math.abs(i-M)<=pt)a=0;else throw new Error;return t.x=m(a+(this.long0||0),this.over),t.y=tt(e),t}function vh(t){var i=m(t.x-(this.long0||0),this.over),s=t.y,a,e;return e=this.cphi1+this.phi1-s,Math.abs(e)>pt?(t.x=e*Math.sin(a=i*Math.cos(s)/e),t.y=this.cphi1-e*Math.cos(a)):t.x=t.y=0,t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function dh(t){t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var i,s,a=D(t.x,t.y=this.cphi1-t.y);if(s=this.cphi1+this.phi1-a,Math.abs(s)>M)throw new Error;return Math.abs(Math.abs(s)-M)<=pt?i=0:i=a*Math.atan2(t.x,t.y)/Math.cos(s),t.x=m(i+(this.long0||0),this.over),t.y=tt(s),t}var yh=["bonne","Bonne (Werner lat_1=90)"];const mh={init:_h,names:yh},Wi={OBLIQUE:{forward:xh,inverse:bh},TRANSVERSE:{forward:Gh,inverse:Ah}},Xt={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}};function wh(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=as.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if(this.o_proj==="ob_tran")throw new Error("Invalid value for o_proj: "+this.o_proj);const t=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),i=z(t);if(!i)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);i.long0=0,this.obliqueProjection=i;let s;const a=Object.keys(Xt),e=n=>{if(typeof this[n]>"u")return;const o=parseFloat(this[n])*I;if(isNaN(o))throw new Error("Invalid value for "+n+": "+this[n]);return o};for(let n=0;n<a.length;n++){const o=a[n],l=Xt[o],u=Object.entries(l);if(u.some(([f])=>typeof this[f]<"u")){s=l;for(let f=0;f<u.length;f++){const[_,g]=u[f],v=e(_);if(typeof v>"u")throw new Error("Missing parameter: "+_+".");this[g]=v}break}}if(!s)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:r,phip:h}=Ph(this,s);this.lamp=r,Math.abs(h)>y?(this.cphip=Math.cos(h),this.sphip=Math.sin(h),this.projectionType=Wi.OBLIQUE):this.projectionType=Wi.TRANSVERSE}function Eh(t){return this.projectionType.forward(this,t)}function Sh(t){return this.projectionType.inverse(this,t)}function Ph(t,i){let s,a;if(i===Xt.ROTATE){let e=t.oLongC,r=t.oLatC,h=t.oAlpha;if(Math.abs(Math.abs(r)-M)<=y)throw new Error("Invalid value for o_lat_c: "+t.o_lat_c+" should be < 90°");a=e+Math.atan2(-1*Math.cos(h),-1*Math.sin(h)*Math.sin(r)),s=Math.asin(Math.cos(r)*Math.sin(h))}else if(i===Xt.NEW_POLE)a=t.oLongP,s=t.oLatP;else{let e=t.oLong1,r=t.oLat1,h=t.oLong2,n=t.oLat2,o=Math.abs(r);if(Math.abs(r)>M-y)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(n)>M-y)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(r-n)<y)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(o<y)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");a=Math.atan2(Math.cos(r)*Math.sin(n)*Math.cos(e)-Math.sin(r)*Math.cos(n)*Math.cos(h),Math.sin(r)*Math.cos(n)*Math.sin(h)-Math.cos(r)*Math.sin(n)*Math.sin(e)),s=Math.atan(-1*Math.cos(a-e)/Math.tan(r))}return{lamp:a,phip:s}}function xh(t,i){let{x:s,y:a}=i;s+=t.long0;const e=Math.cos(s),r=Math.sin(a),h=Math.cos(a);i.x=m(Math.atan2(h*Math.sin(s),t.sphip*h*e+t.cphip*r)+t.lamp),i.y=Math.asin(t.sphip*r-t.cphip*h*e);const n=t.obliqueProjection.forward(i);return t.isIdentity&&(n.x*=k,n.y*=k),n}function Gh(t,i){let{x:s,y:a}=i;s+=t.long0;const e=Math.cos(a),r=Math.cos(s);i.x=m(Math.atan2(e*Math.sin(s),Math.sin(a))+t.lamp),i.y=Math.asin(-1*e*r);const h=t.obliqueProjection.forward(i);return t.isIdentity&&(h.x*=k,h.y*=k),h}function bh(t,i){t.isIdentity&&(i.x*=I,i.y*=I);const s=t.obliqueProjection.inverse(i);let{x:a,y:e}=s;if(a<Number.MAX_VALUE){a-=t.lamp;const r=Math.cos(a),h=Math.sin(e),n=Math.cos(e);i.x=Math.atan2(n*Math.sin(a),t.sphip*n*r-t.cphip*h),i.y=Math.asin(t.sphip*h+t.cphip*n*r)}return i.x=m(i.x+t.long0),i}function Ah(t,i){t.isIdentity&&(i.x*=I,i.y*=I);const s=t.obliqueProjection.inverse(i);let{x:a,y:e}=s;if(a<Number.MAX_VALUE){const r=Math.cos(e);a-=t.lamp,i.x=Math.atan2(r*Math.sin(a),-1*Math.sin(e)),i.y=Math.asin(r*Math.cos(a))}return i.x=m(i.x+t.long0),i}var ph=["General Oblique Transformation","General_Oblique_Transformation","ob_tran"];const Nh={init:wh,forward:Eh,inverse:Sh,names:ph};function Ih(t){t.Proj.projections.add(Dt),t.Proj.projections.add(kt),t.Proj.projections.add(de),t.Proj.projections.add(be),t.Proj.projections.add(Ce),t.Proj.projections.add(qe),t.Proj.projections.add(je),t.Proj.projections.add(Qe),t.Proj.projections.add(Ze),t.Proj.projections.add(ar),t.Proj.projections.add(vr),t.Proj.projections.add(Sr),t.Proj.projections.add(Ar),t.Proj.projections.add(Or),t.Proj.projections.add(Fr),t.Proj.projections.add(Br),t.Proj.projections.add(Vr),t.Proj.projections.add(Yr),t.Proj.projections.add(nn),t.Proj.projections.add(cn),t.Proj.projections.add(vn),t.Proj.projections.add(En),t.Proj.projections.add(pn),t.Proj.projections.add(On),t.Proj.projections.add(Fn),t.Proj.projections.add(Hn),t.Proj.projections.add(Kn),t.Proj.projections.add(sh),t.Proj.projections.add(hh),t.Proj.projections.add(uh),t.Proj.projections.add(mh),t.Proj.projections.add(Nh)}const Kt=Object.assign(Ta,{defaultDatum:"WGS84",Proj:z,WGS84:new z("WGS84"),Point:_t,toPoint:ls,defs:T,nadgrid:va,transform:Wt,mgrs:La,version:"__VERSION__"});Ih(Kt);try{let t=()=>new DecompressionStream("deflate-raw"),i=s=>new Response(s);t(),Es=s=>i(i(s).body.pipeThrough(t())).arrayBuffer().then(a=>new Uint8Array(a))}catch{}var Es,Hi=new TextDecoder,si=t=>{throw Error("but-unzip~"+t)};function*Ch(t,i=Es){let s=t.length-21,a=s-65536,e=new DataView(t.buffer,t.byteOffset),r=o=>e.getUint16(o+s,1),h=o=>e.getUint32(o+s,1),n=(o,l)=>t.subarray(s+=o,s+=l);for(;s>a&&(s=t.lastIndexOf(80,s-1))+1&&(t[s+1]-75||t[s+2]-5||t[s+3]-6););for(s<0&&si(2),a=r(10),a-r(8)&&si(3),s=h(16);a--;){let o=r(10),l=r(28),u=r(30),c=r(32),f=h(20),_=h(42),g=Hi.decode(n(46,l)),v=Hi.decode(n(u,c)),d=s,w;s=_,w=n(30+r(26)+r(28),f),yield{filename:g,comment:v,read:()=>o-8?o?si(1):w:i(w)},s=d}}const Rh=/.+\.(shp|dbf|json|prj|cpg)$/i,Oh=async t=>{const i={},s=[];for(const r of Ch(t))Rh.test(r.filename)&&s.push(Promise.resolve(r.read()).then(h=>i[r.filename]=h));await Promise.all(s);const a={},e=new TextDecoder;for(const[r,h]of Object.entries(i))r.slice(-3).toLowerCase()==="shp"||r.slice(-3).toLowerCase()==="dbf"?a[r]=new DataView(h.buffer,h.byteOffset,h.byteLength):a[r]=e.decode(h);return a},Th=globalThis.URL,Lh=(t,i)=>{if(!i)return t;const s=new Th(t);return s.pathname=`${s.pathname}.${i}`,s.href};async function Nt(t,i){const s=Lh(t,i),a=i==="prj"||i==="cpg";try{const e=await fetch(s);if(e.status>399)throw new Error(e.statusText);if(a)return e.text();const r=await e.arrayBuffer();return new DataView(r)}catch(e){if(a||i==="dbf")return!1;throw e}}function qh(t){let i=0,s=1;const a=t.length;let e,r;const h=[t[0][0],t[0][1],t[0][0],t[0][1]];for(;s<a;)e=r||t[0],r=t[s],i+=(r[0]-e[0])*(r[1]+e[1]),s++,r[0]<h[0]&&(h[0]=r[0]),r[1]<h[1]&&(h[1]=r[1]),r[0]>h[2]&&(h[2]=r[0]),r[1]>h[3]&&(h[3]=r[1]);return{ring:t,clockWise:i>0,bbox:h,children:[]}}function Qi(t,i){return!(t.bbox[0]>i.bbox[0]||t.bbox[1]>i.bbox[1]||t.bbox[2]<i.bbox[2]||t.bbox[3]<i.bbox[3])}function Ss(t,i=!1){const s=[],a=[];for(const h of t){const n=qh(h);n.clockWise!==i?s.push(n):a.push(n)}const e=[];for(const h of a){let n;for(const o of s)Qi(o,h)&&(n?Qi(n,o)&&(n=o):n=o);n?n.children.push(h.ring):e.push(h)}if(i)return{outers:s,orphens:e};if(e.length&&!i){const h=Ss(t,!0);if(h.orphens.length===0){const n=[];for(const o of h.outers)n.push([o.ring.toReversed()].concat(o.children.map(l=>l.toReversed())));return n}}const r=[];for(const h of s)r.push([h.ring].concat(h.children));return r}R.prototype.parsePoint=function(t){return{type:"Point",coordinates:this.parseCoord(t,0)}};R.prototype.parseZPoint=function(t){const i=this.parsePoint(t);return i.coordinates.push(t.getFloat64(16,!0)),i};R.prototype.parsePointArray=function(t,i,s){const a=[];let e=0;for(;e<s;)a.push(this.parseCoord(t,i)),i+=16,e++;return a};R.prototype.parseZPointArray=function(t,i,s,a){let e=0;for(;e<s;)a[e].push(t.getFloat64(i,!0)),e++,i+=8;return a};R.prototype.parseArrayGroup=function(t,i,s,a,e){const r=[];let h=0,n,o=0,l;for(;h<a;)h++,s+=4,n=o,h===a?o=e:o=t.getInt32(s,!0),l=o-n,l&&(r.push(this.parsePointArray(t,i,l)),i+=l<<4);return r};R.prototype.parseZArrayGroup=function(t,i,s,a){let e=0;for(;e<s;)a[e]=this.parseZPointArray(t,i,a[e].length,a[e]),i+=a[e].length<<3,e++;return a};R.prototype.parseMultiPoint=function(t){const i={},s=t.getInt32(32,!0);if(!s)return null;const a=this.parseCoord(t,0),e=this.parseCoord(t,16);i.bbox=[a[0],a[1],e[0],e[1]];const r=36;return s===1?(i.type="Point",i.coordinates=this.parseCoord(t,r)):(i.type="MultiPoint",i.coordinates=this.parsePointArray(t,r,s)),i};R.prototype.parseZMultiPoint=function(t){const i=this.parseMultiPoint(t);if(!i)return null;let s;if(i.type==="Point")return i.coordinates.push(t.getFloat64(72,!0)),i;s=i.coordinates.length;const a=52+(s<<4);return i.coordinates=this.parseZPointArray(t,a,s,i.coordinates),i};R.prototype.parsePolyline=function(t){const i={},s=t.getInt32(32,!0);if(!s)return null;const a=this.parseCoord(t,0),e=this.parseCoord(t,16);i.bbox=[a[0],a[1],e[0],e[1]];const r=t.getInt32(36,!0);let h,n;return s===1?(i.type="LineString",h=44,i.coordinates=this.parsePointArray(t,h,r)):(i.type="MultiLineString",h=40+(s<<2),n=40,i.coordinates=this.parseArrayGroup(t,h,n,s,r)),i};R.prototype.parseZPolyline=function(t){const i=this.parsePolyline(t);if(!i)return null;const s=i.coordinates.length;let a;return i.type==="LineString"?(a=60+(s<<4),i.coordinates=this.parseZPointArray(t,a,s,i.coordinates),i):(a=56+(i.coordinates.reduce(function(r,h){return r+h.length},0)<<4)+(s<<2),i.coordinates=this.parseZArrayGroup(t,a,s,i.coordinates),i)};R.prototype.polyFuncs=function(t){return t&&(t.type==="LineString"?(t.type="Polygon",t.coordinates=[t.coordinates],t):(t.coordinates=Ss(t.coordinates),t.coordinates.length===1?(t.type="Polygon",t.coordinates=t.coordinates[0],t):(t.type="MultiPolygon",t)))};R.prototype.parsePolygon=function(t){return this.polyFuncs(this.parsePolyline(t))};R.prototype.parseZPolygon=function(t){return this.polyFuncs(this.parseZPolyline(t))};const Vi={1:"parsePoint",3:"parsePolyline",5:"parsePolygon",8:"parseMultiPoint",11:"parseZPoint",13:"parseZPolyline",15:"parseZPolygon",18:"parseZMultiPoint"};function Uh(t){return t?function(i,s){const a=[i.getFloat64(s,!0),i.getFloat64(s+8,!0)];return t.inverse(a)}:function(i,s){return[i.getFloat64(s,!0),i.getFloat64(s+8,!0)]}}function R(t,i){if(!(this instanceof R))return new R(t,i);this.buffer=t,this.headers=this.parseHeader(),this.shpFuncs(i),this.rows=this.getRows()}R.prototype.shpFuncs=function(t){let i=this.headers.shpCode;if(i>20&&(i-=20),!(i in Vi))throw new Error(`I don't know shp type "${i}"`);this.parseFunc=this[Vi[i]],this.parseCoord=Uh(t)};R.prototype.getShpCode=function(){return this.parseHeader().shpCode};R.prototype.parseHeader=function(){const t=this.buffer;return{length:t.getInt32(24)<<1,version:t.getInt32(28,!0),shpCode:t.getInt32(32,!0),bbox:[t.getFloat64(36,!0),t.getFloat64(44,!0),t.getFloat64(52,!0),t.getFloat64(60,!0)]}};R.prototype.getRows=function(){let t=100;const i=this.buffer.byteLength-8,s=[];let a;for(;t<=i&&(a=this.getRow(t),!!a);)t+=8,t+=a.len,a.type?s.push(this.parseFunc(a.data)):s.push(null);return s};R.prototype.getRow=function(t){const i=this.buffer.getInt32(t),s=this.buffer.getInt32(t+4)<<1;if(s===0)return{id:i,len:s,type:0};if(!(t+s+8>this.buffer.byteLength))return{id:i,len:s,data:new DataView(this.buffer.buffer,this.buffer.byteOffset+t+12,s-4),type:this.buffer.getInt32(t+8,!0)}};function wi(t,i){return new R(t,i).rows}var Fh=/^(?:ANSI\s)?(\d+)$/m;function Ps(t,i){if(!t)return a;try{new TextDecoder(t.trim())}catch{var s=Fh.exec(t);return s&&!i?Ps("windows-"+s[1],!0):(t=void 0,a)}return a;function a(e){var r=new TextDecoder(t||void 0),h=r.decode(e,{stream:!0})+r.decode();return h.replace(/\0/g,"").trim()}}function Dh(t){var i={};return i.lastUpdated=new Date(t.getUint8(1)+1900,t.getUint8(2),t.getUint8(3)),i.records=t.getUint32(4,!0),i.headerLen=t.getUint16(8,!0),i.recLen=t.getUint16(10,!0),i}function kh(t,i,s){for(var a=[],e=32;e<i&&(a.push({name:s(new Uint8Array(t.buffer.slice(t.byteOffset+e,t.byteOffset+e+11))),dataType:String.fromCharCode(t.getUint8(e+11)),len:t.getUint8(e+16),decimal:t.getUint8(e+17)}),t.getUint8(e+32)!==13);)e+=32;return a}function $h(t,i,s,a,e){const r=new Uint8Array(t.buffer.slice(t.byteOffset+i,t.byteOffset+i+s));var h=e(r);switch(a){case"N":case"F":case"O":return parseFloat(h,10);case"D":return new Date(h.slice(0,4),parseInt(h.slice(4,6),10)-1,h.slice(6,8));case"L":return h.toLowerCase()==="y"||h.toLowerCase()==="t";default:return h}}function jh(t,i,s,a){for(var e={},r=0,h=s.length,n,o;r<h;)o=s[r],n=$h(t,i,o.len,o.dataType,a),i+=o.len,typeof n<"u"&&(e[o.name]=n),r++;return e}function Ei(t,i){for(var s=Ps(i),a=Dh(t),e=kh(t,a.headerLen-1,s),r=(e.length+1<<5)+2,h=a.recLen,n=a.records,o=[];n;)o.push(jh(t,r,e,s)),r+=h,n--;return o}const Bh=globalThis.URL,zh=t=>{if(!t)throw new Error("forgot to pass buffer");if(gt(t))return new Uint8Array(t);if(gt(t.buffer))return t.BYTES_PER_ELEMENT===1?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("invalid buffer like object")},Wh=new TextDecoder,xs=t=>{if(t){if(typeof t=="string")return t;if(gt(t)||ArrayBuffer.isView(t)||Si(t))return Wh.decode(t)}},Gs=t=>{if(!t)throw new Error("forgot to pass buffer");if(Si(t))return t;if(gt(t))return new DataView(t);if(gt(t.buffer))return new DataView(t.buffer,t.byteOffset,t.byteLength);throw new Error("invalid buffer like object")};function gt(t){return t instanceof globalThis.ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"}function Si(t){return t instanceof globalThis.DataView||Object.prototype.toString.call(t)==="[object DataView]"}const Pi=function([t,i]){const s={};s.type="FeatureCollection",s.features=[];let a=0;const e=t.length;for(i||(i=[]);a<e;)s.features.push({type:"Feature",geometry:t[a],properties:i[a]||{}}),a++;return s},bs=async function(t,i){let s;t=zh(t);const a=await Oh(t),e=[];i=i||[];for(s in a)s.indexOf("__MACOSX")===-1&&(s.slice(-4).toLowerCase()===".shp"?(e.push(s.slice(0,-4)),a[s.slice(0,-3)+s.slice(-3).toLowerCase()]=a[s]):s.slice(-4).toLowerCase()===".prj"?a[s.slice(0,-3)+s.slice(-3).toLowerCase()]=Kt(a[s]):s.slice(-5).toLowerCase()===".json"||i.indexOf(s.split(".").pop())>-1?e.push(s.slice(0,-3)+s.slice(-3).toLowerCase()):(s.slice(-4).toLowerCase()===".dbf"||s.slice(-4).toLowerCase()===".cpg")&&(a[s.slice(0,-3)+s.slice(-3).toLowerCase()]=a[s]));if(!e.length)throw new Error("no layers founds");const r=e.map(function(h){let n,o;const l=h.lastIndexOf(".");return l>-1&&h.slice(l).indexOf("json")>-1?(n=JSON.parse(a[h]),n.fileName=h.slice(0,l)):i.indexOf(h.slice(l+1))>-1?(n=a[h],n.fileName=h):(a[h+".dbf"]&&(o=Ei(a[h+".dbf"],a[h+".cpg"])),n=Pi([wi(a[h+".shp"],a[h+".prj"]),o]),n.fileName=h),n});return r.length===1?r[0]:r};async function Hh(t,i){const s=await Nt(t);return bs(s,i)}const Qh=async t=>{const i=await Promise.all([Nt(t,"shp"),Nt(t,"prj")]);let s=!1;try{i[1]&&(s=Kt(i[1]))}catch{s=!1}return wi(i[0],s)},Vh=async t=>{const[i,s]=await Promise.all([Nt(t,"dbf"),Nt(t,"cpg")]);if(i)return Ei(i,s)},Xi=(t,i)=>new Bh(t,globalThis?.document?.location).pathname.slice(-4).toLowerCase()===i,Xh=({shp:t,dbf:i,cpg:s,prj:a})=>{const e=[Jh(t,a)];return i&&e.push(Kh(i,s)),Pi(e)},Yh=async function(t,i){if(typeof t!="string"){if(gt(t)||ArrayBuffer.isView(t)||Si(t))return bs(t);if(t.shp)return Xh(t);throw new TypeError("must be a string, some sort of Buffer, or an object with at least a .shp property")}if(Xi(t,".zip"))return Hh(t,i);Xi(t,".shp")&&(t=t.slice(0,-4));const s=await Promise.all([Qh(t),Vh(t)]);return Pi(s)},Jh=function(t,i){if(t=Gs(t),i=xs(i),typeof i=="string")try{i=Kt(i)}catch{i=!1}return wi(t,i)},Kh=function(t,i){return t=Gs(t),i=xs(i),Ei(t,i)};export{Pi as combine,Yh as default,Yh as getShapefile,Kh as parseDbf,Jh as parseShp,bs as parseZip};
//# sourceMappingURL=shpjs-CNrRgkgn.js.map