@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.54 MB
JavaScript
import{isProxy as t,toRaw as e}from"vue";import{Diva as r}from"@sheencity/diva-sdk";import n,{unityPlugin as i}from"@tslfe/dt-engine";const o="GD",a="BD",s="ESRI",u="DIVA",l="SUPERAPI",c="TACOSSDK",h="infolayer",p="animatelayer",f="masklayer",d="masklayerBoundary",m="movinglayer",y="heatmaplayer";function g(s){return new Promise((e,r)=>{t=s.srcKey;let n=document.querySelector("script["+t+"]");var t=!1;if(n?n.getAttribute("src")==s.url?(console.log("API已经加载..."),e(n)):(n.parentElement.removeChild(n),t=!0):t=!0,t){s.css&&v(s.css,s.insertCssBefore),n=function(t){const 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}(s);{var i=n,o=()=>{n.setAttribute(s.srcKey,"loaded"),e(n)};let t;r&&(t=function(e,r){const n=t=>{console.log("API初始化失败..."),r(t.error||new Error("There was an error attempting to load "+e.src)),e.removeEventListener("error",n,!1)};return e.addEventListener("error",n,!1),n}(i,r));const a=()=>{console.log("API初始化成功..."),o(i),i.removeEventListener("load",a,!1),t&&i.removeEventListener("error",t,!1)};i.addEventListener("load",a,!1)}document.body.appendChild(n)}})}function v(t,e){let r=document.querySelector(`link[href*="${t}"]`);var n;return r||(r=(t=t,(n=document.createElement("link")).rel="stylesheet",n.href=t,n),t=r,e?(n=document.querySelector(e)).parentNode.insertBefore(t,n):document.head.appendChild(t)),r}class x{static load(t){switch(window.mapconfig=t,window.mapconfig.mapType){case o: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},(r=g({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",r=this.baiduAPILoadr();break;case s:this.url=window.mapconfig.apiUrl;var e=window.mapconfig.mapstyle,r=this.esriAPILoader(e);break;case u:r=new Promise(t=>{t()});break;case l:this.url="https://superapi.51aes.com/dist/superAPI-6.6.0.min.js",r=g({url:this.url,srcKey:"data-super-loader"});break;case c:r=new Promise(t=>{t()})}return r}static baiduAPILoadr(){var n=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,r)=>{this.addScript()||e(window.BMapGL),window.onBMapCallback=function(){n.blibs=[],t.forEach(t=>{n.loadLib(t,e,r)}),console.log("API初始化成功...")}})}static loadLib(t,e,r){var n=document.createElement("script"),i=(n.setAttribute("type","text/javascript"),n.setAttribute("async","sync"),n.src=t,document.body.appendChild(n),this.blibs.push(n),n.onerror=function(){r("API初始化失败...")},this);n.onload=function(t){i.count+=1,i.count===i.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,r=0;r<t.length;r++)t[r]&&t[r].src&&-1!=t[r].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 g({url:this.url,srcKey:"data-esri-loader"}).then(function(){v(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,r=window.mapconfig.mapType;switch(r=t?t:r){case o:(e=document.querySelector("script[data-gd-loader]"))&&e.parentElement.removeChild(e);var n=document.getElementById("AMap_Dynamic_style");n&&n.parentElement.removeChild(n);break;case a:this.removeScript(),this.removeLibs();break;case l:(e=document.querySelector("script[data-super-loader]"))&&e.parentElement.removeChild(e);break;case s:(n=window.require)&&n.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)}}}const b={Default:0,VectorTiles:1,Satellite:2,Traffic:3,WMTS:4,WFS:5,WMS:6,geoJSON:7},w={Solid:"solid",Dashed:"dashed"},_={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"},E={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 M{constructor(t){this.color=t.color,this.width=t.width,this.opacity=t.opacity,this.lineType=t.lineType}}class N{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 C{constructor(t){this.topColor=t.topColor,this.sideColor=t.sideColor,this.topOpacity=t.topOpacity,this.sideOpacity=t.sideOpacity}}class A{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 D{constructor(t){this.name=t.name,this.attribute=t.attribute,this.longitude=t.longitude,this.latitude=t.latitude,this.style=t.style}}class I{constructor(t){this.name=t.name,this.attribute=t.attribute,this.path=t.path,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 O{constructor(t){this.name=t.name,this.attribute=t.attribute,this.path=t.path,this.style=t.style,this.height=t.height}}class T{constructor(t){this.name=t.name,this.content=t.content,this.longitude=t.longitude,this.latitude=t.latitude,this.style=t.style}}class L{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}}const F={ZoomSlider:"zoomslider",Compass:"compass",Scalebar:"scalebar"},R={TopLeft:"topleft",TopRight:"topright",BottomLeft:"bottomleft",BottmRight:"bottomright"};class B{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 k{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}}const q={Clockwise:"clockwise",Anticlockwise:"anticlockwise",Stop:"stop"},z={POI:"poi",Path:"path",Raster:"raster",HeatMap:"heatmap",RoadHeatMap:"road_heatmap",Range:"range",Effect:"scene_effect",Object:"aes_object",Text:"3d_text"},G={POI:"poi",Image2D:"image2d",Image3D:"image3d",Label:"label"},j={Solid:1,Dashed:2,Arrow:3,Flash:4};class U{constructor(t){this.name=t.name,this.material=t.material}}const V={"晴天":1,"阴天":2,"小雨":3,"中雨":4,"大雨":5,"少云":6,"雾霾":7,"小雪":8,"中雪":9,"大雪":10,"雷雨":11};class H{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}}const W=52.35987755982988,Y=3.141592653589793,X=6378245,$=.006693421622965943,Z={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}]},J={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 Q(t){return 3857==t?J:Z}var K=1,tt=2,et=3,rt=4,nt=5,it=6378137,ot=6356752.314,at=.0066943799901413165,st=484813681109536e-20,ut=Math.PI/2,lt=.16666666666666666,ct=.04722222222222222,ht=.022156084656084655,pt=1e-10,ft=.017453292519943295,dt=57.29577951308232,mt=Math.PI/4,yt=2*Math.PI,gt=3.14159265359,vt={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},xt={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}},bt=/[\s_\-\/\(\)]/g;function wt(t,e){if(t[e])return t[e];for(var r,n=Object.keys(t),i=e.toLowerCase().replace(bt,""),o=-1;++o<n.length;)if((r=n[o]).toLowerCase().replace(bt,"")===i)return t[r]}function _t(t){var e,r,n,i={},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},{}),a={proj:"projName",datum:"datumCode",rf:function(t){i.rf=parseFloat(t)},lat_0:function(t){i.lat0=t*ft},lat_1:function(t){i.lat1=t*ft},lat_2:function(t){i.lat2=t*ft},lat_ts:function(t){i.lat_ts=t*ft},lon_0:function(t){i.long0=t*ft},lon_1:function(t){i.long1=t*ft},lon_2:function(t){i.long2=t*ft},alpha:function(t){i.alpha=parseFloat(t)*ft},gamma:function(t){i.rectified_grid_angle=parseFloat(t)*ft},lonc:function(t){i.longc=t*ft},x_0:function(t){i.x0=parseFloat(t)},y_0:function(t){i.y0=parseFloat(t)},k_0:function(t){i.k0=parseFloat(t)},k:function(t){i.k0=parseFloat(t)},a:function(t){i.a=parseFloat(t)},b:function(t){i.b=parseFloat(t)},r:function(t){i.a=i.b=parseFloat(t)},r_a:function(){i.R_A=!0},zone:function(t){i.zone=parseInt(t,10)},south:function(){i.utmSouth=!0},towgs84:function(t){i.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){i.to_meter=parseFloat(t)},units:function(t){t=wt(xt,i.units=t);t&&(i.to_meter=t.to_meter)},from_greenwich:function(t){i.from_greenwich=t*ft},pm:function(t){var e=wt(vt,t);i.from_greenwich=(e||parseFloat(t))*ft},nadgrids:function(t){"@null"===t?i.datumCode="none":i.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))&&(i.axis=t)},approx:function(){i.approx=!0}};for(e in o)r=o[e],e in a?"function"==typeof(n=a[e])?n(r):i[n]=r:i[e]=r;return"string"==typeof i.datumCode&&"WGS84"!==i.datumCode&&(i.datumCode=i.datumCode.toLowerCase()),i}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 r;var n=e.match(/^\((.)\)$/);if(n){const t=n[1].toUpperCase();if("E"===t)r="east";else if("N"===t)r="north";else{if("U"!==t)throw new Error("Unknown axis abbreviation: "+t);r="up"}}else r=t[2]?t[2].toLowerCase():"unknown";n=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),n=n?parseInt(n[1],10):null,t=t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]));return{name:e,direction:r,unit:this.convertUnit(t),order:n}}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,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1],e.base_crs=t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])):null,e.conversion=t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])):null;var r=t.find(t=>Array.isArray(t)&&"CS"===t[0]),r=(r&&(e.coordinate_system={type:r[1],axis:this.extractAxes(t)}),t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]));if(r){const t=this.convertUnit(r);e.coordinate_system.unit=t}e.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":e.type="GeographicCRS",e.name=t[1];r=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));r&&(n=this.convert(r),"ENSEMBLE"===r[0]?e.datum_ensemble=n:e.datum=n,r=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]))&&"Greenwich"!==r[1]&&(n.prime_meridian={name:r[1],longitude:parseFloat(r[2])}),e.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.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":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(t=>Array.isArray(t)&&"MEMBER"===t[0]).map(t=>({type:"DatumEnsembleMember",name:t[1],id:this.getId(t)}));var n=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]),r=(n&&(e.accuracy=parseFloat(n[1])),t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0]));r&&(e.ellipsoid=this.convert(r)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.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]),e);break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&"PARAMETER"===t[0]).map(t=>this.convert(t));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]))),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";n=t.find(t=>Array.isArray(t)&&"SOURCECRS"===t[0]);if(n){const t=n.find(t=>Array.isArray(t));e.source_crs=t?this.convert(t):null}r=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(r){const t=r.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}n=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=n?this.convert(n):null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.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===e.parameters.length){const t=e.parameters[6];"Scale difference"===t.name&&(t.value=Math.round(1e12*(t.value-1))/1e6)}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":const i=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=i)}),i.conversion_factor&&1!==i.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:i});break;default:e.keyword=t[0]}return e}}class St 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,e={}){super.convert(t,e);const r=t.find(t=>Array.isArray(t)&&"CS"===t[0]);r&&(e.coordinate_system={subtype:r[1],axis:this.extractAxes(t)});var n=t.find(t=>Array.isArray(t)&&"USAGE"===t[0]);if(n){const t=n.find(t=>Array.isArray(t)&&"SCOPE"===t[0]),r=n.find(t=>Array.isArray(t)&&"AREA"===t[0]),i=n.find(t=>Array.isArray(t)&&"BBOX"===t[0]);e.usage={},t&&(e.usage.scope=t[1]),r&&(e.usage.area=r[1]),i&&(e.usage.bbox=i.slice(1))}return e}}function Nt(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:St).convert(t)}var Ct=1,At=/\s/,Dt=/[A-Za-z]/,It=/[A-Za-z84_]/,Pt=/[,\]]/,Ot=/[\d\.E\-\+]/;function Tt(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=Ct}function Lt(t,e,r){Array.isArray(e)&&(r.unshift(e),e=null);r=r.reduce(function(t,e){return Ft(e,t),t},e?{}:t);e&&(t[e]=r)}function Ft(t,e){if(Array.isArray(t)){var r,n=t.shift();if("PARAMETER"===n&&(n=t.shift()),1===t.length)return Array.isArray(t[0])?(e[n]={},void Ft(t[0],e[n])):void(e[n]=t[0]);if(t.length)if("TOWGS84"!==n)if("AXIS"===n)n in e||(e[n]=[]),e[n].push(t);else switch(Array.isArray(n)||(e[n]={}),n){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[n]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&Ft(t[2],e[n]));case"SPHEROID":case"ELLIPSOID":return e[n]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&Ft(t[3],e[n]));case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":return t[0]=["name",t[0]],void Lt(e,n,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]],Lt(e,n,t),void(e[n].type=n);default:for(r=-1;++r<t.length;)if(!Array.isArray(t[r]))return Ft(t,e[n]);return Lt(e,n,t)}else e[n]=t;else e[n]=!0}else e[t]=!0}Tt.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;At.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case Ct: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}},Tt.prototype.afterquote=function(t){if('"'===t)this.word+='"',this.state=4;else{if(!Pt.test(t))throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place);this.word=this.word.trim(),this.afterItem(t)}},Tt.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=Ct)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=Ct,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},Tt.prototype.number=function(t){if(!Ot.test(t)){if(Pt.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},Tt.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Tt.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=Ct;else{if(!Pt.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Tt.prototype.neutral=function(t){if(Dt.test(t))this.word=t,this.state=2;else if('"'===t)this.word="",this.state=4;else if(Ot.test(t))this.word=t,this.state=3;else{if(!Pt.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)}},Tt.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 Rt=.017453292519943295;function Bt(t){return t*Rt}function kt(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=Bt(0<t.lat0?90:-90),delete t.lat1):(t.lat0=Bt(0<t.lat1?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function qt(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 zt(t){return"object"==typeof t?t.value*t.unit.conversion_factor:t}function Gt(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=zt(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-zt(t.ellipsoid.semi_minor_axis))))}function jt(r,n={}){return r&&"object"==typeof r?("BoundCRS"===r.type?(jt(r.source_crs,n),r.transformation&&(r.transformation.method&&"NTv2"===r.transformation.method.name?n.nadgrids=r.transformation.parameters[0].value:n.datum_params=r.transformation.parameters.map(t=>t.value))):(Object.keys(r).forEach(t=>{var e=r[t];if(null!==e)switch(t){case"name":n.srsCode||(n.name=e,n.srsCode=e);break;case"type":"GeographicCRS"===e?n.projName="longlat":"ProjectedCRS"===e&&r.conversion&&r.conversion.method&&(n.projName=r.conversion.method.name);break;case"datum":case"datum_ensemble":e.ellipsoid&&(n.ellps=e.ellipsoid.name,Gt(e,n)),e.prime_meridian&&(n.from_greenwich=e.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":n.ellps=e.name,Gt(e,n);break;case"prime_meridian":n.long0=(e.longitude||0)*Math.PI/180;break;case"coordinate_system":if(e.axis)if(n.axis=e.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",e.unit){const{units:r,to_meter:t}=qt(e.unit);n.units=r,n.to_meter=t}else if(e.axis[0]&&e.axis[0].unit){const{units:r,to_meter:t}=qt(e.axis[0].unit);n.units=r,n.to_meter=t}break;case"id":e.authority&&e.code&&(n.title=e.authority+":"+e.code);break;case"conversion":e.method&&e.method.name&&(n.projName=e.method.name),e.parameters&&e.parameters.forEach(t=>{var e=t.name.toLowerCase().replace(/\s+/g,"_"),r=t.value;t.unit&&t.unit.conversion_factor?n[e]=r*t.unit.conversion_factor:"degree"===t.unit?n[e]=r*Math.PI/180:n[e]=r});break;case"unit":e.name&&(n.units=e.name.toLowerCase(),"metre"===n.units)&&(n.units="meter"),e.conversion_factor&&(n.to_meter=e.conversion_factor);break;case"base_crs":jt(e,n),n.datumCode=e.id?e.id.authority+"_"+e.id.code:e.name}}),void 0!==n.latitude_of_false_origin&&(n.lat0=n.latitude_of_false_origin),void 0!==n.longitude_of_false_origin&&(n.long0=n.longitude_of_false_origin),void 0!==n.latitude_of_standard_parallel&&(n.lat0=n.latitude_of_standard_parallel,n.lat1=n.latitude_of_standard_parallel),void 0!==n.latitude_of_1st_standard_parallel&&(n.lat1=n.latitude_of_1st_standard_parallel),void 0!==n.latitude_of_2nd_standard_parallel&&(n.lat2=n.latitude_of_2nd_standard_parallel),void 0!==n.latitude_of_projection_centre&&(n.lat0=n.latitude_of_projection_centre),void 0!==n.longitude_of_projection_centre&&(n.longc=n.longitude_of_projection_centre),void 0!==n.easting_at_false_origin&&(n.x0=n.easting_at_false_origin),void 0!==n.northing_at_false_origin&&(n.y0=n.northing_at_false_origin),void 0!==n.latitude_of_natural_origin&&(n.lat0=n.latitude_of_natural_origin),void 0!==n.longitude_of_natural_origin&&(n.long0=n.longitude_of_natural_origin),void 0!==n.longitude_of_origin&&(n.long0=n.longitude_of_origin),void 0!==n.false_easting&&(n.x0=n.false_easting),n.easting_at_projection_centre&&(n.x0=n.easting_at_projection_centre),void 0!==n.false_northing&&(n.y0=n.false_northing),n.northing_at_projection_centre&&(n.y0=n.northing_at_projection_centre),void 0!==n.standard_parallel_1&&(n.lat1=n.standard_parallel_1),void 0!==n.standard_parallel_2&&(n.lat2=n.standard_parallel_2),void 0!==n.scale_factor_at_natural_origin&&(n.k0=n.scale_factor_at_natural_origin),void 0!==n.scale_factor_at_projection_centre&&(n.k0=n.scale_factor_at_projection_centre),void 0!==n.scale_factor_on_pseudo_standard_parallel&&(n.k0=n.scale_factor_on_pseudo_standard_parallel),void 0!==n.azimuth&&(n.alpha=n.azimuth),void 0!==n.azimuth_at_projection_centre&&(n.alpha=n.azimuth_at_projection_centre),n.angle_from_rectified_to_skew_grid&&(n.rectified_grid_angle=n.angle_from_rectified_to_skew_grid),kt(n)),n):r}var Ut=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Vt(t){for(var e=Object.keys(t),r=0,n=e.length;r<n;++r){var i=e[r];-1!==Ut.indexOf(i)&&Ht(t[i]),"object"==typeof t[i]&&Vt(t[i])}}function Ht(i){if(i.AUTHORITY&&(o=Object.keys(i.AUTHORITY)[0])&&o in i.AUTHORITY&&(i.title=o+":"+i.AUTHORITY[o]),"GEOGCS"===i.type?i.projName="longlat":"LOCAL_CS"===i.type?(i.projName="identity",i.local=!0):"object"==typeof i.PROJECTION?i.projName=Object.keys(i.PROJECTION)[0]:i.projName=i.PROJECTION,i.AXIS){for(var t="",e=0,r=i.AXIS.length;e<r;++e){var n=[i.AXIS[e][0].toLowerCase(),i.AXIS[e][1].toLowerCase()];-1!==n[0].indexOf("north")||("y"===n[0]||"lat"===n[0])&&"north"===n[1]?t+="n":-1!==n[0].indexOf("south")||("y"===n[0]||"lat"===n[0])&&"south"===n[1]?t+="s":-1!==n[0].indexOf("east")||("x"===n[0]||"lon"===n[0])&&"east"===n[1]?t+="e":-1===n[0].indexOf("west")&&("x"!==n[0]&&"lon"!==n[0]||"west"!==n[1])||(t+="w")}2===t.length&&(t+="u"),3===t.length&&(i.axis=t)}i.UNIT&&(i.units=i.UNIT.name.toLowerCase(),"metre"===i.units&&(i.units="meter"),i.UNIT.convert)&&("GEOGCS"===i.type?i.DATUM&&i.DATUM.SPHEROID&&(i.to_meter=i.UNIT.convert*i.DATUM.SPHEROID.a):i.to_meter=i.UNIT.convert);var o=i.GEOGCS;function a(t){return t*(i.to_meter||1)}(o="GEOGCS"===i.type?i:o)&&(o.DATUM?i.datumCode=o.DATUM.name.toLowerCase():i.datumCode=o.name.toLowerCase(),"d_"===i.datumCode.slice(0,2)&&(i.datumCode=i.datumCode.slice(2)),"new_zealand_1949"===i.datumCode&&(i.datumCode="nzgd49"),"wgs_1984"!==i.datumCode&&"world_geodetic_system_1984"!==i.datumCode||("Mercator_Auxiliary_Sphere"===i.PROJECTION&&(i.sphere=!0),i.datumCode="wgs84"),"belge_1972"===i.datumCode&&(i.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(i.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===i.ellps.toLowerCase().slice(0,13)&&(i.ellps="intl"),i.a=o.DATUM.SPHEROID.a,i.rf=parseFloat(o.DATUM.SPHEROID.rf,10)),o.DATUM&&o.DATUM.TOWGS84&&(i.datum_params=o.DATUM.TOWGS84),~i.datumCode.indexOf("osgb_1936")&&(i.datumCode="osgb36"),~i.datumCode.indexOf("osni_1952")&&(i.datumCode="osni52"),(~i.datumCode.indexOf("tm65")||~i.datumCode.indexOf("geodetic_datum_of_1965"))&&(i.datumCode="ire65"),"ch1903+"===i.datumCode&&(i.datumCode="ch1903"),~i.datumCode.indexOf("israel"))&&(i.datumCode="isr93"),i.b&&!isFinite(i.b)&&(i.b=i.a),i.rectified_grid_angle&&(i.rectified_grid_angle=Bt(i.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",Bt],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Bt],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Bt],["lat0","latitude_of_origin",Bt],["lat0","standard_parallel_1",Bt],["lat1","standard_parallel_1",Bt],["lat2","standard_parallel_2",Bt],["azimuth","Azimuth"],["alpha","azimuth",Bt],["srsCode","name"]].forEach(function(t){var e,r,n;e=i,r=(t=t)[0],n=t[1],!(r in e)&&n in e&&(e[r]=e[n],3===t.length)&&(e[r]=t[2](e[r]))}),kt(i)}function Wt(t){var e;return"object"==typeof t?jt(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 Tt(t).output(),"WKT2"==e?jt(Nt(t)):(e=t[0],Ft(t,t={}),Vt(t),t[e]))}function Yt(t){var e=this;if(2===arguments.length){var r=arguments[1];"string"==typeof r?"+"===r.charAt(0)?Yt[t]=_t(arguments[1]):Yt[t]=Wt(arguments[1]):Yt[t]=r}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?Yt.apply(e,t):Yt(t)});if("string"==typeof t){if(t in Yt)return Yt[t]}else"EPSG"in t?Yt["EPSG:"+t.EPSG]=t:"ESRI"in t?Yt["ESRI:"+t.ESRI]=t:"IAU2000"in t?Yt["IAU2000:"+t.IAU2000]=t:console.log(t)}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");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"]}(Yt);var Xt=["3857","900913","3785","102113"];function $t(t){var e,r;return"string"!=typeof t?"projName"in t?t:Wt(t):t in Yt?Yt[t]:0!==(r=t).indexOf("+")&&-1!==r.indexOf("[")||"object"==typeof r&&!("srsCode"in r)?(e=Wt(t),function(){var t=wt(e,"authority");if(t)return(t=wt(t,"epsg"))&&-1<Xt.indexOf(t)}()?Yt["EPSG:3857"]:(r=function(){var t=wt(e,"extension");if(t)return wt(t,"proj4")}())?_t(r):e):"+"===t[0]?_t(t):void 0}function Zt(t,e){var r,n;if(t=t||{},e)for(n in e)void 0!==(r=e[n])&&(t[n]=r);return t}function Jt(t,e,r){t*=e;return r/Math.sqrt(1-t*t)}function Qt(t){return t<0?-1:1}function Kt(t){return Math.abs(t)<=gt?t:t-Qt(t)*yt}function te(t,e,r){r*=t,r=Math.pow((1-r)/(1+r),.5*t);return Math.tan(.5*(ut-e))/r}function ee(t,e){for(var r,n=.5*t,i=ut-2*Math.atan(e),o=0;o<=15;o++)if(r=t*Math.sin(i),i+=r=ut-2*Math.atan(e*Math.pow((1-r)/(1+r),n))-i,Math.abs(r)<=1e-10)return i;return-9999}function re(t){return t}var ne=[{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=Jt(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,r,n=t.x,i=t.y;return 90<i*dt&&i*dt<-90&&180<n*dt&&n*dt<-180||Math.abs(Math.abs(i)-ut)<=pt?null:(r=this.sphere?(e=this.x0+this.a*this.k0*Kt(n-this.long0),this.y0+this.a*this.k0*Math.log(Math.tan(mt+.5*i))):(r=Math.sin(i),i=te(this.e,i,r),e=this.x0+this.a*this.k0*Kt(n-this.long0),this.y0-this.a*this.k0*Math.log(i)),t.x=e,t.y=r,t)},inverse:function(t){var e,r=t.x-this.x0,n=t.y-this.y0;if(this.sphere)e=ut-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var n=Math.exp(-n/(this.a*this.k0));if(-9999===(e=ee(this.e,n)))return null}return n=Kt(this.long0+r/(this.a*this.k0)),t.x=n,t.y=e,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"]},{init:function(){},forward:re,inverse:re,names:["longlat","identity"]}],ie={},oe=[];function ae(t,e){var r=oe.length;return t.names?((oe[r]=t).names.forEach(function(t){ie[t.toLowerCase()]=r}),this):(console.log(e),!0)}function se(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}var ue={start:function(){ne.forEach(ae)},add:ae,get:function(t){return!!t&&(t=t.toLowerCase(),void 0!==ie[t]&&oe[ie[t]]||(t=se(t))in ie&&oe[ie[t]]?oe[ie[t]]:void 0)}},le={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)"}};const ce=le.WGS84;var he={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_4