@tslsmart/map_adapter
Version:
an adapter for maps,基于高德JSAPI 2.0,百度JavaScript API GL,arcgis api for javascript 3.23,光辉城市及51world sdk
1 lines • 1.05 MB
JavaScript
import{Diva as t}from"@sheencity/diva-sdk";import{map as e,filter as n}from"rxjs";import r,{defineAnimation as i,unityPlugin as o}from"@tslfe/dt-engine";let s="GD",a="BD",u="ESRI",l="DIVA",h="SUPERAPI",c="TACOSSDK",p="infolayer",f="animatelayer",d="masklayer",y="masklayerBoundary",g="movinglayer",m="heatmaplayer";function v(a){return new Promise((n,i)=>{t=a.srcKey;let r=document.querySelector("script["+t+"]");var t=!1;if(r?r.getAttribute("src")==a.url?(console.log("API已经加载..."),n(r)):(r.parentElement.removeChild(r),t=!0):t=!0,t){a.css&&_(a.css,a.insertCssBefore),r=(t=>{let e=document.createElement("script");return e.type="text/javascript",e.src=t.url,e.setAttribute(t.srcKey,"loading"),t.attributes&&t.attributes.forEach(t=>{e.setAttribute(t.key,t.value)}),e})(a);{var o=r,s=()=>{r.setAttribute(a.srcKey,"loaded"),n(r)};let t,e=(i&&(t=((e,n)=>{let i=t=>{console.log("API初始化失败..."),n(t.error||new Error("There was an error attempting to load "+e.src)),e.removeEventListener("error",i,!1)};return e.addEventListener("error",i,!1),i})(o,i)),()=>{console.log("API初始化成功..."),s(o),o.removeEventListener("load",e,!1),t&&o.removeEventListener("error",t,!1)});o.addEventListener("load",e,!1)}document.body.appendChild(r)}})}function _(t,e){let n=document.querySelector(`link[href*="${t}"]`);var i;return n||(n=(t=t,(i=document.createElement("link")).rel="stylesheet",i.href=t,i),t=n,e?(i=document.querySelector(e)).parentNode.insertBefore(t,i):document.head.appendChild(t)),n}class w{static load(t){switch(window.mapconfig=t,window.mapconfig.mapType){case s:window.mapconfig.apiUrl&&""!=window.mapconfig.apiUrl?this.url=window.mapconfig.apiUrl:this.url="https://webapi.amap.com/maps?v=2.0&key="+window.mapconfig.key+"&plugin=AMap.MouseTool,AMap.PolyEditor",window._AMapSecurityConfig={securityJsCode:window.mapconfig.securityCode},(n=v({url:this.url,attributes:[{key:"type",value:"text/javascript"},{key:"async",value:"sync"}],srcKey:"data-gd-loader"})).then(()=>{window.AMap||console.log("请配置mapconfig.apiUrl,使用离线API加载高德地图!")});break;case a:this.url="https://api.map.baidu.com/api?v=1.0&type=webgl&ak="+window.mapconfig.key+"&s=1&callback=onBMapCallback",n=this.baiduAPILoadr();break;case u:this.url=window.mapconfig.apiUrl;var e=window.mapconfig.mapstyle,n=this.esriAPILoader(e);break;case l:n=new Promise(t=>{t()});break;case h:this.url="https://superapi.51aes.com/dist/superAPI-6.6.0.min.js",n=v({url:this.url,srcKey:"data-super-loader"});break;case c:n=new Promise(t=>{t()})}return n}static baiduAPILoadr(){var i=this,t=["https://mapopen.bj.bcebos.com/github/BMapGLLib/InfoBox/src/InfoBox.min.js","https://mapopen.bj.bcebos.com/github/BMapGLLib/DrawingManager/src/DrawingManager.min.js","https://api.map.baidu.com/library/LuShu/gl/src/LuShu_min.js","https://mapopen.bj.bcebos.com/github/BMapGLLib/RichMarker/src/RichMarker.min.js"];return this.libslen=t.length,this.count=0,new Promise((e,n)=>{this.addScript()||e(window.BMapGL),window.onBMapCallback=function(){i.blibs=[],t.forEach(t=>{i.loadLib(t,e,n)}),console.log("API初始化成功...")}})}static loadLib(t,e,n){var i=document.createElement("script"),r=(i.setAttribute("type","text/javascript"),i.setAttribute("async","sync"),i.src=t,document.body.appendChild(i),this.blibs.push(i),i.onerror=function(){n("API初始化失败...")},this);i.onload=function(t){r.count+=1,r.count===r.libslen&&e(window.BMapGL,window.BMapGLLib)}}static removeScript(){this.scriptElement&&(document.body.removeChild(this.scriptElement),this.scriptElement=null);var t=document.querySelector('link[href*="baidu.com/"]'),t=(t&&t.parentElement.removeChild(t),document.querySelector('script[src*="baidu.com/"]'));t&&t.parentElement.removeChild(t)}static addScript(){for(var t=document.getElementsByTagName("script"),e=!0,n=0;n<t.length;n++)t[n]&&t[n].src&&-1!=t[n].src.indexOf(this.url)&&(e=!1);return e&&(this.scriptElement=document.createElement("script"),this.scriptElement.setAttribute("type","text/javascript"),this.scriptElement.setAttribute("async","sync"),this.scriptElement.src=this.url,document.body.appendChild(this.scriptElement)),e}static async esriAPILoader(t){return v({url:this.url,srcKey:"data-esri-loader"}).then(function(){_(t)})}static removeLibs(){this.blibs.forEach(t=>{document.body.removeChild(t)});var t=document.getElementsByTagName("script");Array.from(t).forEach(t=>{-1==t.src.indexOf("BMapGLLib")&&-1==t.src.indexOf("api.map.baidu.com")||document.body.removeChild(t)}),this.blibs=[]}static unLoad(t){var e,n=window.mapconfig.mapType;switch(n=t?t:n){case s:(e=document.querySelector("script[data-gd-loader]"))&&e.parentElement.removeChild(e);var i=document.getElementById("AMap_Dynamic_style");i&&i.parentElement.removeChild(i);break;case a:this.removeScript(),this.removeLibs();break;case h:(e=document.querySelector("script[data-super-loader]"))&&e.parentElement.removeChild(e);break;case u:(i=window.require)&&i.on&&((e=document.querySelector("script[data-esri-loader]"))&&e.parentElement.removeChild(e),(e=document.querySelector(`link[href*="${window.mapconfig.mapstyle}"]`))&&e.parentElement.removeChild(e),(e=document.querySelector(`link[href*="${window.mapconfig.widgetstyle}"]`))&&e.parentElement.removeChild(e),-1<(e=window.mapconfig.apiUrl.lastIndexOf("/"))&&document.querySelectorAll("script[src ^='"+window.mapconfig.apiUrl.slice(0,e)+"']").forEach(t=>{t.remove()}),delete window.define,delete window.$arcgis,delete window.require,delete window.dojoConfig)}}}let x={Default:0,VectorTiles:1,Satellite:2,Traffic:3,WMTS:4,WFS:5,WMS:6,geoJSON:7},E={Solid:"solid",Dashed:"dashed"},b={Line:"line",Point:"point",PointWithText:"point_text",Polygon:"polygon",Text:"text",Infowindow:"infowindow",Animation:"animation",Mask:"mask",Polyhedron:"polyhedron",PlaceSearch:"placeSearch",Service:"service",Cluster:"cluster",Heatmap:"heatmap"},M={Line:"line",Point:"point",Polygon:"polygon",Polyhedron:"polyhedron",PointWithText:"point_text"};class S{constructor(t){this.width=t.width,this.height=t.height,this.icon=t.icon,this.xOffset=t.xOffset,this.yOffset=t.yOffset,this.angle=t.angle}}class D{constructor(t){this.color=t.color,this.width=t.width,this.opacity=t.opacity,this.lineType=t.lineType}}class C{constructor(t){this.fillColor=t.fillColor,this.strokeColor=t.strokeColor,this.strokeWeight=t.strokeWeight,this.strokeOpacity=t.strokeOpacity,this.fillOpacity=t.fillOpacity,this.strokeType=t.strokeType}}class I{constructor(t){this.topColor=t.topColor,this.sideColor=t.sideColor,this.topOpacity=t.topOpacity,this.sideOpacity=t.sideOpacity}}class N{constructor(t){this.fontFamily=t.fontFamily,this.fontSize=t.fontSize,this.fontWeight=t.fontWeight,this.fontColor=t.fontColor,this.style=t.style,this.xOffset=t.xOffset,this.yOffset=t.yOffset}}class L{constructor(t){this.name=t.name,this.attribute=t.attribute,this.longitude=t.longitude,this.latitude=t.latitude,this.style=t.style}}class P{constructor(t){this.name=t.name,this.attribute=t.attribute,this.path=t.path,this.style=t.style}}class A{constructor(t){this.name=t.name,this.attribute=t.attribute,this.path=t.path,this.style=t.style}}class T{constructor(t){this.name=t.name,this.attribute=t.attribute,this.path=t.path,this.style=t.style,this.height=t.height}}class O{constructor(t){this.name=t.name,this.content=t.content,this.longitude=t.longitude,this.latitude=t.latitude,this.style=t.style}}class F{constructor(t){this.name=t.name,this.content=t.content,this.latitude=t.latitude,this.longitude=t.longitude,this.xOffset=t.xOffset,this.yOffset=t.yOffset}}let R={ZoomSlider:"zoomslider",Compass:"compass",Scalebar:"scalebar"},B={TopLeft:"topleft",TopRight:"topright",BottomLeft:"bottomleft",BottmRight:"bottomright"};class k{constructor(t){this.name=t.name,this.longitude=t.longitude,this.latitude=t.latitude,this.content=t.content,this.xOffset=t.xOffset,this.yOffset=t.yOffset}}class G{constructor(t){this.pitch=t.pitch,this.yaw=t.yaw,this.position=t.position,this.lonlat=t.lonlat,this.duration=t.duration,this.distance=t.distance,this.zoom=t.zoom,this.target=t.target}}let z={Clockwise:"clockwise",Anticlockwise:"anticlockwise",Stop:"stop"},j={POI:"poi",Path:"path",Raster:"raster",HeatMap:"heatmap",RoadHeatMap:"road_heatmap",Range:"range",Effect:"scene_effect",Object:"aes_object",Text:"3d_text",Windwow:"window"},q="curtain",U="screen",V="light",W="window",H="aircondition",X="access",Y="fresh",Z={POI:"poi",Image2D:"image2d",Image3D:"image3d",Label:"label"},J={Solid:1,Dashed:2,Arrow:3,Flash:4};class ${constructor(t){this.name=t.name,this.material=t.material}}let Q={"晴天":1,"阴天":2,"小雨":3,"中雨":4,"大雨":5,"少云":6,"雾霾":7,"小雪":8,"中雪":9,"大雪":10,"雷雨":11};class K{constructor(t){this.id=t.id,this.resourceName=t.resourceName,this.position=t.position,this.coordinate=t.coordinate,this.scale=t.scale,this.label=t.label,this.labelOffset=t.labelOffset,this.iconUrl=t.iconUrl,this.iconOffset=t.iconOffset,this.type=t.type,this.labelTitle=t.labelTitle,this.labelTxtStyle=t.labelTxtStyle}}let tt=52.35987755982988,et=3.141592653589793,nt=6378245,rt=.006693421622965943,it={dpi:90.7142857142743,format:"png32",compressionQuality:0,rows:256,cols:256,origin:{x:-180,y:90},lods:[{level:0,levelValue:"EPSG:4326:0",scale:279541132.0143589,resolution:.703125},{level:1,levelValue:"EPSG:4326:1",scale:139770566.00717944,resolution:.3515625},{level:2,levelValue:"EPSG:4326:2",scale:69885283.00358972,resolution:.17578125},{level:3,levelValue:"EPSG:4326:3",scale:34942641.50179486,resolution:.087890625},{level:4,levelValue:"EPSG:4326:4",scale:17471320.75089743,resolution:.0439453125},{level:5,levelValue:"EPSG:4326:5",scale:8735660.375448715,resolution:.02197265625},{level:6,levelValue:"EPSG:4326:6",scale:4367830.1877243575,resolution:.010986328125},{level:7,levelValue:"EPSG:4326:7",scale:2183915.0938621787,resolution:.0054931640625},{level:8,levelValue:"EPSG:4326:8",scale:1091957.5469310894,resolution:.00274658203125},{level:9,levelValue:"EPSG:4326:9",scale:545978.7734655447,resolution:.001373291015625},{level:10,levelValue:"EPSG:4326:10",scale:272989.38673277234,resolution:.0006866455078125},{level:11,levelValue:"EPSG:4326:11",scale:136494.69336638617,resolution:.0003433227539062},{level:12,levelValue:"EPSG:4326:12",scale:68247.34668319309,resolution:.0001716613769531},{level:13,levelValue:"EPSG:4326:13",scale:34123.67334159654,resolution:858306884766e-16},{level:14,levelValue:"EPSG:4326:14",scale:17061.83667079827,resolution:429153442383e-16},{level:15,levelValue:"EPSG:4326:15",scale:8530.918335399136,resolution:214576721191e-16},{level:16,levelValue:"EPSG:4326:16",scale:4265.459167699568,resolution:107288360596e-16},{level:17,levelValue:"EPSG:4326:17",scale:2132.729583849784,resolution:53644180298e-16},{level:18,levelValue:"EPSG:4326:18",scale:1066.364791924892,resolution:26822090149e-16},{level:19,levelValue:"EPSG:4326:19",scale:533.182395962446,resolution:13411045074e-16},{level:20,levelValue:"EPSG:4326:20",scale:266.59119797202146,resolution:6.705522537e-7},{level:21,levelValue:"EPSG:4326:21",scale:133.2955990058892,resolution:3.352761269e-7}]},ot={dpi:90.7142857142743,format:"png32",compressionQuality:0,rows:256,cols:256,origin:{x:-20037508.34,y:20037508.34},lods:[{level:0,levelValue:"EPSG:3857:0",scale:559082264.028717,resolution:156543.03392804076},{level:1,levelValue:"EPSG:3857:1",scale:279541132.014358,resolution:78271.51696402022},{level:2,levelValue:"EPSG:3857:2",scale:139770566.007179,resolution:39135.75848201011},{level:3,levelValue:"EPSG:3857:3",scale:69885283.0035897,resolution:19567.879241005117},{level:4,levelValue:"EPSG:3857:4",scale:34942641.5017948,resolution:9783.939620502542},{level:5,levelValue:"EPSG:3857:5",scale:17471320.7508974,resolution:4891.969810251271},{level:6,levelValue:"EPSG:3857:6",scale:8735660.37544871,resolution:2445.9849051256383},{level:7,levelValue:"EPSG:3857:7",scale:4367830.18772435,resolution:1222.9924525628178},{level:8,levelValue:"EPSG:3857:8",scale:2183915.09386217,resolution:611.4962262814075},{level:9,levelValue:"EPSG:3857:9",scale:1091957.54693108,resolution:305.7481131407024},{level:10,levelValue:"EPSG:3857:10",scale:545978.773465544,resolution:152.8740565703523},{level:11,levelValue:"EPSG:3857:11",scale:272989.386732772,resolution:76.43702828517615},{level:12,levelValue:"EPSG:3857:12",scale:136494.693366386,resolution:38.21851414258808},{level:13,levelValue:"EPSG:3857:13",scale:68247.346683193,resolution:19.10925707129404},{level:14,levelValue:"EPSG:3857:14",scale:34123.6733415964,resolution:9.55462853564699},{level:15,levelValue:"EPSG:3857:15",scale:17061.8366707982,resolution:4.777314267823495},{level:16,levelValue:"EPSG:3857:16",scale:8530.91833539913,resolution:2.388657133911756},{level:17,levelValue:"EPSG:3857:17",scale:4265.45916769956,resolution:1.1943285669558765},{level:18,levelValue:"EPSG:3857:18",scale:2132.72958384978,resolution:.5971642834779383},{level:19,levelValue:"EPSG:3857:19",scale:1066.36479192489,resolution:.2985821417389691},{level:20,levelValue:"EPSG:3857:20",scale:533.182395962445,resolution:.1492910708694846},{level:21,levelValue:"EPSG:3857:21",scale:266.591197981222,resolution:.0746455354347422},{level:22,levelValue:"EPSG:3857:22",scale:133.295598990611,resolution:.0373227677173711},{level:23,levelValue:"EPSG:3857:23",scale:66.6477994953056,resolution:.0186613838586856},{level:24,levelValue:"EPSG:3857:24",scale:33.3238997476528,resolution:.0093306919293428}]};function st(t){return 3857==t?ot:it}var at=6378137,ut=.0066943799901413165,lt=484813681109536e-20,ht=Math.PI/2,ct=1e-10,pt=.017453292519943295,ft=57.29577951308232,dt=Math.PI/4,yt=2*Math.PI,gt=3.14159265359,mt={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},vt={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}},_t=/[\s_\-\/\(\)]/g;function wt(t,e){if(t[e])return t[e];for(var n,i=Object.keys(t),r=e.toLowerCase().replace(_t,""),o=-1;++o<i.length;)if((n=i[o]).toLowerCase().replace(_t,"")===r)return t[n]}function xt(t){var e,n,i,r={},o=t.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){e=e.split("=");return e.push(!0),t[e[0].toLowerCase()]=e[1],t},{}),s={proj:"projName",datum:"datumCode",rf:function(t){r.rf=parseFloat(t)},lat_0:function(t){r.lat0=t*pt},lat_1:function(t){r.lat1=t*pt},lat_2:function(t){r.lat2=t*pt},lat_ts:function(t){r.lat_ts=t*pt},lon_0:function(t){r.long0=t*pt},lon_1:function(t){r.long1=t*pt},lon_2:function(t){r.long2=t*pt},alpha:function(t){r.alpha=parseFloat(t)*pt},gamma:function(t){r.rectified_grid_angle=parseFloat(t)*pt},lonc:function(t){r.longc=t*pt},x_0:function(t){r.x0=parseFloat(t)},y_0:function(t){r.y0=parseFloat(t)},k_0:function(t){r.k0=parseFloat(t)},k:function(t){r.k0=parseFloat(t)},a:function(t){r.a=parseFloat(t)},b:function(t){r.b=parseFloat(t)},r:function(t){r.a=r.b=parseFloat(t)},r_a:function(){r.R_A=!0},zone:function(t){r.zone=parseInt(t,10)},south:function(){r.utmSouth=!0},towgs84:function(t){r.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){r.to_meter=parseFloat(t)},units:function(t){t=wt(vt,r.units=t);t&&(r.to_meter=t.to_meter)},from_greenwich:function(t){r.from_greenwich=t*pt},pm:function(t){var e=wt(mt,t);r.from_greenwich=(e||parseFloat(t))*pt},nadgrids:function(t){"@null"===t?r.datumCode="none":r.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(r.axis=t)},approx:function(){r.approx=!0}};for(e in o)n=o[e],e in s?"function"==typeof(i=s[e])?i(n):r[i]=n:r[e]=n;return"string"==typeof r.datumCode&&"WGS84"!==r.datumCode&&(r.datumCode=r.datumCode.toLowerCase()),r}class Et{static getId(t){t=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return t&&3<=t.length?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(t,e="unit"){return!t||t.length<3?{type:e,name:"unknown",conversion_factor:null}:{type:e,name:t[1],conversion_factor:parseFloat(t[2])||null,id:(e=t.find(t=>Array.isArray(t)&&"ID"===t[0]))?{authority:e[1],code:parseInt(e[2],10)}:null}}static convertAxis(t){var e=t[1]||"Unknown";let n;var i=e.match(/^\((.)\)$/);if(i){let t=i[1].toUpperCase();if("E"===t)n="east";else if("N"===t)n="north";else{if("U"!==t)throw new Error("Unknown axis abbreviation: "+t);n="up"}}else n=t[2]?t[2].toLowerCase():"unknown";i=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),i=i?parseInt(i[1],10):null,t=t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]));return{name:e,direction:n,unit:this.convertUnit(t),order:i}}static extractAxes(t){return t.filter(t=>Array.isArray(t)&&"AXIS"===t[0]).map(t=>this.convertAxis(t)).sort((t,e)=>(t.order||0)-(e.order||0))}static convert(t,n={}){switch(t[0]){case"PROJCRS":n.type="ProjectedCRS",n.name=t[1],n.base_crs=t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])):null,n.conversion=t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])):null;var i=t.find(t=>Array.isArray(t)&&"CS"===t[0]),i=(i&&(n.coordinate_system={type:i[1],axis:this.extractAxes(t)}),t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]));if(i){let t=this.convertUnit(i);n.coordinate_system.unit=t}n.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":n.type="GeographicCRS",n.name=t[1];i=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));i&&(r=this.convert(i),"ENSEMBLE"===i[0]?n.datum_ensemble=r:n.datum=r,i=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]))&&"Greenwich"!==i[1]&&(r.prime_meridian={name:i[1],longitude:parseFloat(i[2])}),n.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},n.id=this.getId(t);break;case"DATUM":n.type="GeodeticReferenceFrame",n.name=t[1],n.ellipsoid=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])):null;break;case"ENSEMBLE":n.type="DatumEnsemble",n.name=t[1],n.members=t.filter(t=>Array.isArray(t)&&"MEMBER"===t[0]).map(t=>({type:"DatumEnsembleMember",name:t[1],id:this.getId(t)}));var r=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]),i=(r&&(n.accuracy=parseFloat(r[1])),t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0]));i&&(n.ellipsoid=this.convert(i)),n.id=this.getId(t);break;case"ELLIPSOID":n.type="Ellipsoid",n.name=t[1],n.semi_major_axis=parseFloat(t[2]),n.inverse_flattening=parseFloat(t[3]),t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0])&&this.convert(t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]),n);break;case"CONVERSION":n.type="Conversion",n.name=t[1],n.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,n.parameters=t.filter(t=>Array.isArray(t)&&"PARAMETER"===t[0]).map(t=>this.convert(t));break;case"METHOD":n.type="Method",n.name=t[1],n.id=this.getId(t);break;case"PARAMETER":n.type="Parameter",n.name=t[1],n.value=parseFloat(t[2]),n.unit=this.convertUnit(t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]))),n.id=this.getId(t);break;case"BOUNDCRS":n.type="BoundCRS";r=t.find(t=>Array.isArray(t)&&"SOURCECRS"===t[0]);if(r){let t=r.find(t=>Array.isArray(t));n.source_crs=t?this.convert(t):null}i=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(i){let t=i.find(t=>Array.isArray(t));n.target_crs=t?this.convert(t):null}r=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);n.transformation=r?this.convert(r):null;break;case"ABRIDGEDTRANSFORMATION":if(n.type="Transformation",n.name=t[1],n.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,n.parameters=t.filter(t=>Array.isArray(t)&&("PARAMETER"===t[0]||"PARAMETERFILE"===t[0])).map(t=>"PARAMETER"===t[0]?this.convert(t):"PARAMETERFILE"===t[0]?{name:t[1],value:t[2],id:{authority:"EPSG",code:8656}}:void 0),7===n.parameters.length){let t=n.parameters[6];"Scale difference"===t.name&&(t.value=Math.round(1e12*(t.value-1))/1e6)}n.id=this.getId(t);break;case"AXIS":n.coordinate_system||(n.coordinate_system={type:"unspecified",axis:[]}),n.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":let e=this.convertUnit(t,"LinearUnit");n.coordinate_system&&n.coordinate_system.axis&&n.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=e)}),e.conversion_factor&&1!==e.conversion_factor&&n.semi_major_axis&&(n.semi_major_axis={value:n.semi_major_axis,unit:e});break;default:n.keyword=t[0]}return n}}class bt extends Et{static convert(t,e={}){return super.convert(t,e),e.coordinate_system&&"Cartesian"===e.coordinate_system.subtype&&delete e.coordinate_system,e.usage&&delete e.usage,e}}class Mt extends Et{static convert(t,i={}){super.convert(t,i);let e=t.find(t=>Array.isArray(t)&&"CS"===t[0]);e&&(i.coordinate_system={subtype:e[1],axis:this.extractAxes(t)});var r=t.find(t=>Array.isArray(t)&&"USAGE"===t[0]);if(r){let t=r.find(t=>Array.isArray(t)&&"SCOPE"===t[0]),e=r.find(t=>Array.isArray(t)&&"AREA"===t[0]),n=r.find(t=>Array.isArray(t)&&"BBOX"===t[0]);i.usage={},t&&(i.usage.scope=t[1]),e&&(i.usage.area=e[1]),n&&(i.usage.bbox=n.slice(1))}return i}}function St(t){var e=(e=t).find(t=>Array.isArray(t)&&"USAGE"===t[0])?"2019":(e.find(t=>Array.isArray(t)&&"CS"===t[0])||"BOUNDCRS"===e[0]||"PROJCRS"===e[0]||e[0],"2015");return("2019"==e?Mt:bt).convert(t)}var Dt=/\s/,Ct=/[A-Za-z]/,It=/[A-Za-z84_]/,Nt=/[,\]]/,Lt=/[\d\.E\-\+]/;function Pt(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=1}function At(t,e,n){Array.isArray(e)&&(n.unshift(e),e=null);n=n.reduce(function(t,e){return Tt(e,t),t},e?{}:t);e&&(t[e]=n)}function Tt(t,e){if(Array.isArray(t)){var n,i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(e[i]={},void Tt(t[0],e[i])):void(e[i]=t[0]);if(t.length)if("TOWGS84"!==i)if("AXIS"===i)i in e||(e[i]=[]),e[i].push(t);else switch(Array.isArray(i)||(e[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&Tt(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&Tt(t[3],e[i]));case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":return t[0]=["name",t[0]],void At(e,i,t);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":return t[0]=["name",t[0]],At(e,i,t),void(e[i].type=i);default:for(n=-1;++n<t.length;)if(!Array.isArray(t[n]))return Tt(t,e[i]);return At(e,i,t)}else e[i]=t;else e[i]=!0}else e[t]=!0}function Ot(t){return.017453292519943295*t}function Ft(t){var e=(t.projName||"").toLowerCase().replace(/_/g," ");t.long0||!t.longc||"albers conic equal area"!==e&&"lambert azimuthal equal area"!==e||(t.long0=t.longc),t.lat_ts||!t.lat1||"stereographic south pole"!==e&&"polar stereographic (variant b)"!==e?t.lat_ts||!t.lat0||"polar stereographic"!==e&&"polar stereographic (variant a)"!==e||(t.lat_ts=t.lat0,t.lat0=Ot(0<t.lat0?90:-90),delete t.lat1):(t.lat0=Ot(0<t.lat1?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Rt(t){var e={units:null,to_meter:void 0};return"string"==typeof t?(e.units=t.toLowerCase(),"metre"===e.units&&(e.units="meter"),"meter"===e.units&&(e.to_meter=1)):t&&t.name&&(e.units=t.name.toLowerCase(),"metre"===e.units&&(e.units="meter"),e.to_meter=t.conversion_factor),e}function Bt(t){return"object"==typeof t?t.value*t.unit.conversion_factor:t}function kt(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=Bt(t.ellipsoid.semi_major_axis),void 0!==t.ellipsoid.inverse_flattening?e.rf=t.ellipsoid.inverse_flattening:void 0!==t.ellipsoid.semi_major_axis&&void 0!==t.ellipsoid.semi_minor_axis&&(e.rf=e.a/(e.a-Bt(t.ellipsoid.semi_minor_axis))))}function Gt(e,i={}){return e&&"object"==typeof e?("BoundCRS"===e.type?(Gt(e.source_crs,i),e.transformation&&(e.transformation.method&&"NTv2"===e.transformation.method.name?i.nadgrids=e.transformation.parameters[0].value:i.datum_params=e.transformation.parameters.map(t=>t.value))):(Object.keys(e).forEach(t=>{var n=e[t];if(null!==n)switch(t){case"name":i.srsCode||(i.name=n,i.srsCode=n);break;case"type":"GeographicCRS"===n?i.projName="longlat":"ProjectedCRS"===n&&e.conversion&&e.conversion.method&&(i.projName=e.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(i.ellps=n.ellipsoid.name,kt(n,i)),n.prime_meridian&&(i.from_greenwich=n.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":i.ellps=n.name,kt(n,i);break;case"prime_meridian":i.long0=(n.longitude||0)*Math.PI/180;break;case"coordinate_system":if(n.axis)if(i.axis=n.axis.map(t=>{t=t.direction;if("east"===t)return"e";if("north"===t)return"n";if("west"===t)return"w";if("south"===t)return"s";throw new Error("Unknown axis direction: "+t)}).join("")+"u",n.unit){let{units:t,to_meter:e}=Rt(n.unit);i.units=t,i.to_meter=e}else if(n.axis[0]&&n.axis[0].unit){let{units:t,to_meter:e}=Rt(n.axis[0].unit);i.units=t,i.to_meter=e}break;case"id":n.authority&&n.code&&(i.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(i.projName=n.method.name),n.parameters&&n.parameters.forEach(t=>{var e=t.name.toLowerCase().replace(/\s+/g,"_"),n=t.value;t.unit&&t.unit.conversion_factor?i[e]=n*t.unit.conversion_factor:"degree"===t.unit?i[e]=n*Math.PI/180:i[e]=n});break;case"unit":n.name&&(i.units=n.name.toLowerCase(),"metre"===i.units)&&(i.units="meter"),n.conversion_factor&&(i.to_meter=n.conversion_factor);break;case"base_crs":Gt(n,i),i.datumCode=n.id?n.id.authority+"_"+n.id.code:n.name}}),void 0!==i.latitude_of_false_origin&&(i.lat0=i.latitude_of_false_origin),void 0!==i.longitude_of_false_origin&&(i.long0=i.longitude_of_false_origin),void 0!==i.latitude_of_standard_parallel&&(i.lat0=i.latitude_of_standard_parallel,i.lat1=i.latitude_of_standard_parallel),void 0!==i.latitude_of_1st_standard_parallel&&(i.lat1=i.latitude_of_1st_standard_parallel),void 0!==i.latitude_of_2nd_standard_parallel&&(i.lat2=i.latitude_of_2nd_standard_parallel),void 0!==i.latitude_of_projection_centre&&(i.lat0=i.latitude_of_projection_centre),void 0!==i.longitude_of_projection_centre&&(i.longc=i.longitude_of_projection_centre),void 0!==i.easting_at_false_origin&&(i.x0=i.easting_at_false_origin),void 0!==i.northing_at_false_origin&&(i.y0=i.northing_at_false_origin),void 0!==i.latitude_of_natural_origin&&(i.lat0=i.latitude_of_natural_origin),void 0!==i.longitude_of_natural_origin&&(i.long0=i.longitude_of_natural_origin),void 0!==i.longitude_of_origin&&(i.long0=i.longitude_of_origin),void 0!==i.false_easting&&(i.x0=i.false_easting),i.easting_at_projection_centre&&(i.x0=i.easting_at_projection_centre),void 0!==i.false_northing&&(i.y0=i.false_northing),i.northing_at_projection_centre&&(i.y0=i.northing_at_projection_centre),void 0!==i.standard_parallel_1&&(i.lat1=i.standard_parallel_1),void 0!==i.standard_parallel_2&&(i.lat2=i.standard_parallel_2),void 0!==i.scale_factor_at_natural_origin&&(i.k0=i.scale_factor_at_natural_origin),void 0!==i.scale_factor_at_projection_centre&&(i.k0=i.scale_factor_at_projection_centre),void 0!==i.scale_factor_on_pseudo_standard_parallel&&(i.k0=i.scale_factor_on_pseudo_standard_parallel),void 0!==i.azimuth&&(i.alpha=i.azimuth),void 0!==i.azimuth_at_projection_centre&&(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),Ft(i)),i):e}Pt.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;Dt.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},Pt.prototype.afterquote=function(t){if('"'===t)this.word+='"',this.state=4;else{if(!Nt.test(t))throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place);this.word=this.word.trim(),this.afterItem(t)}},Pt.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},Pt.prototype.number=function(t){if(!Lt.test(t)){if(Nt.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},Pt.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Pt.prototype.keyword=function(t){var e;if(It.test(t))this.word+=t;else if("["===t)(e=[]).push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=1;else{if(!Nt.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Pt.prototype.neutral=function(t){if(Ct.test(t))this.word=t,this.state=2;else if('"'===t)this.word="",this.state=4;else if(Lt.test(t))this.word=t,this.state=3;else{if(!Nt.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)}},Pt.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var zt=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function jt(t){for(var e=Object.keys(t),n=0,i=e.length;n<i;++n){var r=e[n];-1!==zt.indexOf(r)&&qt(t[r]),"object"==typeof t[r]&&jt(t[r])}}function qt(r){if(r.AUTHORITY&&(o=Object.keys(r.AUTHORITY)[0])&&o in r.AUTHORITY&&(r.title=o+":"+r.AUTHORITY[o]),"GEOGCS"===r.type?r.projName="longlat":"LOCAL_CS"===r.type?(r.projName="identity",r.local=!0):"object"==typeof r.PROJECTION?r.projName=Object.keys(r.PROJECTION)[0]:r.projName=r.PROJECTION,r.AXIS){for(var t="",e=0,n=r.AXIS.length;e<n;++e){var i=[r.AXIS[e][0].toLowerCase(),r.AXIS[e][1].toLowerCase()];-1!==i[0].indexOf("north")||("y"===i[0]||"lat"===i[0])&&"north"===i[1]?t+="n":-1!==i[0].indexOf("south")||("y"===i[0]||"lat"===i[0])&&"south"===i[1]?t+="s":-1!==i[0].indexOf("east")||("x"===i[0]||"lon"===i[0])&&"east"===i[1]?t+="e":-1===i[0].indexOf("west")&&("x"!==i[0]&&"lon"!==i[0]||"west"!==i[1])||(t+="w")}2===t.length&&(t+="u"),3===t.length&&(r.axis=t)}r.UNIT&&(r.units=r.UNIT.name.toLowerCase(),"metre"===r.units&&(r.units="meter"),r.UNIT.convert)&&("GEOGCS"===r.type?r.DATUM&&r.DATUM.SPHEROID&&(r.to_meter=r.UNIT.convert*r.DATUM.SPHEROID.a):r.to_meter=r.UNIT.convert);var o=r.GEOGCS;function s(t){return t*(r.to_meter||1)}(o="GEOGCS"===r.type?r:o)&&(o.DATUM?r.datumCode=o.DATUM.name.toLowerCase():r.datumCode=o.name.toLowerCase(),"d_"===r.datumCode.slice(0,2)&&(r.datumCode=r.datumCode.slice(2)),"new_zealand_1949"===r.datumCode&&(r.datumCode="nzgd49"),"wgs_1984"!==r.datumCode&&"world_geodetic_system_1984"!==r.datumCode||("Mercator_Auxiliary_Sphere"===r.PROJECTION&&(r.sphere=!0),r.datumCode="wgs84"),"belge_1972"===r.datumCode&&(r.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(r.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===r.ellps.toLowerCase().slice(0,13)&&(r.ellps="intl"),r.a=o.DATUM.SPHEROID.a,r.rf=parseFloat(o.DATUM.SPHEROID.rf,10)),o.DATUM&&o.DATUM.TOWGS84&&(r.datum_params=o.DATUM.TOWGS84),~r.datumCode.indexOf("osgb_1936")&&(r.datumCode="osgb36"),~r.datumCode.indexOf("osni_1952")&&(r.datumCode="osni52"),(~r.datumCode.indexOf("tm65")||~r.datumCode.indexOf("geodetic_datum_of_1965"))&&(r.datumCode="ire65"),"ch1903+"===r.datumCode&&(r.datumCode="ch1903"),~r.datumCode.indexOf("israel"))&&(r.datumCode="isr93"),r.b&&!isFinite(r.b)&&(r.b=r.a),r.rectified_grid_angle&&(r.rectified_grid_angle=Ot(r.rectified_grid_angle)),[["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",Ot],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Ot],["x0","false_easting",s],["y0","false_northing",s],["long0","central_meridian",Ot],["lat0","latitude_of_origin",Ot],["lat0","standard_parallel_1",Ot],["lat1","standard_parallel_1",Ot],["lat2","standard_parallel_2",Ot],["azimuth","Azimuth"],["alpha","azimuth",Ot],["srsCode","name"]].forEach(function(t){var e,n,i;e=r,n=(t=t)[0],i=t[1],!(n in e)&&i in e&&(e[n]=e[i],3===t.length)&&(e[n]=t[2](e[n]))}),Ft(r)}function Ut(t){var e;return"object"==typeof t?Gt(t):(e=(e=t.toUpperCase()).includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1"),t=new Pt(t).output(),"WKT2"==e?Gt(St(t)):(e=t[0],Tt(t,t={}),jt(t),t[e]))}function Vt(t){var e=this;if(2===arguments.length){var n=arguments[1];"string"==typeof n?"+"===n.charAt(0)?Vt[t]=xt(arguments[1]):Vt[t]=Ut(arguments[1]):Vt[t]=n}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?Vt.apply(e,t):Vt(t)});if("string"==typeof t){if(t in Vt)return Vt[t]}else"EPSG"in t?Vt["EPSG:"+t.EPSG]=t:"ESRI"in t?Vt["ESRI:"+t.ESRI]=t:"IAU2000"in t?Vt["IAU2000:"+t.IAU2000]=t:console.log(t)}}(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 e=1;e<=60;++e)t("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),t("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +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"]})(Vt);var Wt=["3857","900913","3785","102113"];function Ht(t){var e,n;return"string"!=typeof t?"projName"in t?t:Ut(t):t in Vt?Vt[t]:0!==(n=t).indexOf("+")&&-1!==n.indexOf("[")||"object"==typeof n&&!("srsCode"in n)?(e=Ut(t),(()=>{var t=wt(e,"authority");if(t)return(t=wt(t,"epsg"))&&-1<Wt.indexOf(t)})()?Vt["EPSG:3857"]:(n=(()=>{var t=wt(e,"extension");if(t)return wt(t,"proj4")})())?xt(n):e):"+"===t[0]?xt(t):void 0}function Xt(t,e){var n,i;if(t=t||{},e)for(i in e)void 0!==(n=e[i])&&(t[i]=n);return t}function Yt(t,e,n){t*=e;return n/Math.sqrt(1-t*t)}function Zt(t){return t<0?-1:1}function Jt(t){return Math.abs(t)<=gt?t:t-Zt(t)*yt}function $t(t,e,n){n*=t,n=Math.pow((1-n)/(1+n),.5*t);return Math.tan(.5*(ht-e))/n}function Qt(t,e){for(var n,i=.5*t,r=ht-2*Math.atan(e),o=0;o<=15;o++)if(n=t*Math.sin(r),r+=n=ht-2*Math.atan(e*Math.pow((1-n)/(1+n),i))-r,Math.abs(n)<=1e-10)return r;return-9999}function Kt(t){return t}var te=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Yt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,n,i=t.x,r=t.y;return 90<r*ft&&r*ft<-90&&180<i*ft&&i*ft<-180||Math.abs(Math.abs(r)-ht)<=ct?null:(n=this.sphere?(e=this.x0+this.a*this.k0*Jt(i-this.long0),this.y0+this.a*this.k0*Math.log(Math.tan(dt+.5*r))):(n=Math.sin(r),r=$t(this.e,r,n),e=this.x0+this.a*this.k0*Jt(i-this.long0),this.y0-this.a*this.k0*Math.log(r)),t.x=e,t.y=n,t)},inverse:function(t){var e,n=t.x-this.x0,i=t.y-this.y0;if(this.sphere)e=ht-2*Math.atan(Math.exp(-i/(this.a*this.k0)));else{var i=Math.exp(-i/(this.a*this.k0));if(-9999===(e=Qt(this.e,i)))return null}return i=Jt(this.long0+n/(this.a*this.k0)),t.x=i,t.y=e,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"]},{init:function(){},forward:Kt,inverse:Kt,names:["longlat","identity"]}],ee={},ne=[];function re(t,e){var n=ne.length;return t.names?((ne[n]=t).names.forEach(function(t){ee[t.toLowerCase()]=n}),this):(console.log(e),!0)}function ie(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}var oe={start:function(){te.forEach(re)},add:re,get:function(t){return!!t&&(t=t.toLowerCase(),void 0!==ee[t]&&ne[ee[t]]||(t=ie(t))in ee&&ne[ee[t]]?ne[ee[t]]:void 0)}},se={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}};let ae=se.WGS84;var ue={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.353