UNPKG

vue3-openlayers

Version:
1,782 lines 1.57 MB
"use strict"; var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const vue = require("vue"); const Feature = require("ol/Feature"); const Geometry = require("ol/geom/Geometry"); const Geolocation = require("ol/Geolocation"); const Map$1 = require("ol/Map"); const Overlay = require("ol/Overlay"); const proj4$1 = require("ol/proj/proj4"); const Projection$1 = require("ol/proj/Projection"); const View = require("ol/View"); const proj = require("ol/proj"); const source = require("ol/source"); const AnimatedCluster = require("ol-ext/layer/AnimatedCluster"); const HeatmapLayer = require("ol/layer/Heatmap"); const ImageLayer = require("ol/layer/Image"); const LayerGroup = require("ol/layer/Group"); const TileLayer = require("ol/layer/Tile"); const TileSource = require("ol/source/Tile"); const VectorLayer = require("ol/layer/Vector"); const VectorTileLayer = require("ol/layer/VectorTile"); const VectorImageLayer = require("ol/layer/VectorImage"); const TileLayer$1 = require("ol/layer/WebGLTile"); const layer = require("ol/layer"); const WebGLVectorLayerRenderer = require("ol/renderer/webgl/VectorLayer"); const BingMaps = require("ol/source/BingMaps"); const VectorSource = require("ol/source/Vector"); const ImageSource = require("ol/source/Image"); const Cluster = require("ol/source/Cluster"); const Static = require("ol/source/ImageStatic"); const ImageWMS = require("ol/source/ImageWMS"); const OSM = require("ol/source/OSM"); const StadiaMaps = require("ol/source/StadiaMaps"); const WMTSSource = require("ol/source/WMTS"); const TileGridWMTS = require("ol/tilegrid/WMTS"); const TileArcGISRest = require("ol/source/TileArcGISRest"); const tilegrid = require("ol/tilegrid"); const TileDebug = require("ol/source/TileDebug"); const GeoTIFF = require("ol/source/GeoTIFF"); const TileJSON = require("ol/source/TileJSON"); const TileWMS = require("ol/source/TileWMS"); const ol = require("ol"); const VectorTileSource = require("ol/source/VectorTile"); const XYZ = require("ol/source/XYZ"); const extent = require("ol/extent"); const Attribution = require("ol/control/Attribution"); const Bar = require("ol-ext/control/Bar"); const Button = require("ol-ext/control/Button"); const ContextMenu = require("ol-contextmenu"); const FullScreen = require("ol/control/FullScreen"); const LayerSwitcher = require("ol-ext/control/LayerSwitcher"); const LayerSwitcherImage = require("ol-ext/control/LayerSwitcherImage"); const MousePosition = require("ol/control/MousePosition"); const OverviewMap = require("ol/control/OverviewMap"); const PrintDialog = require("ol-ext/control/PrintDialog"); const Profile = require("ol-ext/control/Profile"); const Rotate$1 = require("ol/control/Rotate"); const ScaleLine = require("ol/control/ScaleLine"); const Search = require("ol-ext/control/Search"); const Swipe = require("ol-ext/control/Swipe"); const Toggle = require("ol-ext/control/Toggle"); const VideoRecorder = require("ol-ext/control/VideoRecorder"); const MapZone = require("ol-ext/control/MapZone"); const Zoom = require("ol/control/Zoom"); const ZoomSlider = require("ol/control/ZoomSlider"); const ZoomToExtent = require("ol/control/ZoomToExtent"); const Circle = require("ol/geom/Circle"); const geom = require("ol/geom"); const LineString = require("ol/geom/LineString"); const MultiLineString = require("ol/geom/MultiLineString"); const MultiPoint = require("ol/geom/MultiPoint"); const MultiPolygon = require("ol/geom/MultiPolygon"); const Point$2 = require("ol/geom/Point"); const Polygon = require("ol/geom/Polygon"); const Style = require("ol/style/Style"); const Draw = require("ol/interaction/Draw"); const Modify = require("ol/interaction/Modify"); const CircleStyle = require("ol/style/Circle"); const Fill = require("ol/style/Fill"); const Stroke = require("ol/style/Stroke"); const interaction = require("ol/interaction"); const Icon = require("ol/style/Icon"); const Text = require("ol/style/Text"); const FlowLine = require("ol-ext/style/FlowLine"); const SelectCluster = require("ol-ext/interaction/SelectCluster"); const DragBox = require("ol/interaction/DragBox"); const DragRotate = require("ol/interaction/DragRotate"); const DragRotateAndZoom = require("ol/interaction/DragRotateAndZoom"); const Link = require("ol/interaction/Link"); const Select = require("ol/interaction/Select"); const Pointer = require("ol/interaction/Pointer"); const Snap = require("ol/interaction/Snap"); const Transform$1 = require("ol-ext/interaction/Transform"); const selectconditions = require("ol/events/condition"); const MouseWheelZoom = require("ol/interaction/MouseWheelZoom"); const Drop = require("ol-ext/featureanimation/Drop"); const animations = require("ol/easing"); require("ol-ext/featureanimation/FeatureAnimation"); const Fade = require("ol-ext/featureanimation/Fade"); const Path = require("ol-ext/featureanimation/Path"); const Shake = require("ol-ext/featureanimation/Shake"); const Slide = require("ol-ext/featureanimation/Slide"); const Teleport = require("ol-ext/featureanimation/Teleport"); const Zoom$1 = require("ol-ext/featureanimation/Zoom"); const format = require("ol/format"); const loadingstrategy = require("ol/loadingstrategy"); require("ol-contextmenu/ol-contextmenu.css"); require("ol-ext/dist/ol-ext.css"); require("ol/ol.css"); function _interopNamespaceDefault(e2) { const n2 = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } }); if (e2) { for (const k2 in e2) { if (k2 !== "default") { const d2 = Object.getOwnPropertyDescriptor(e2, k2); Object.defineProperty(n2, k2, d2.get ? d2 : { enumerable: true, get: () => e2[k2] }); } } } n2.default = e2; return Object.freeze(n2); } const extent__namespace = /* @__PURE__ */ _interopNamespaceDefault(extent); const geom__namespace = /* @__PURE__ */ _interopNamespaceDefault(geom); const selectconditions__namespace = /* @__PURE__ */ _interopNamespaceDefault(selectconditions); const animations__namespace = /* @__PURE__ */ _interopNamespaceDefault(animations); const format__namespace = /* @__PURE__ */ _interopNamespaceDefault(format); const loadingstrategy__namespace = /* @__PURE__ */ _interopNamespaceDefault(loadingstrategy); const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({ __name: "OlFeature", props: { properties: {} }, setup(__props, { expose: __expose }) { const props = __props; const vectorSource = vue.inject("vectorSource"); const vectorLayer = vue.inject( "vectorLayer", null ); const heatmapLayer = vue.inject("heatmapLayer", null); const layer2 = heatmapLayer || vectorLayer; const animation = vue.inject( "animation", null ); const feature = vue.ref( new Feature({ ...props.properties }) ); vue.watch( () => props.properties, // Needed as props.properties is optional (properties) => { if (properties instanceof Geometry) { feature.value.setGeometry(properties); feature.value.setProperties({}); } else if (typeof properties !== "undefined") { feature.value.setGeometry(void 0); feature.value.setProperties(properties); } else { feature.value.setGeometry(void 0); feature.value.setProperties({}); } } ); vue.watch( () => vectorSource, (newVal, oldVal) => { var _a2, _b2, _c; (_a2 = oldVal == null ? void 0 : oldVal.value) == null ? void 0 : _a2.removeFeature(feature.value); (_b2 = newVal == null ? void 0 : newVal.value) == null ? void 0 : _b2.addFeature(feature.value); (_c = newVal == null ? void 0 : newVal.value) == null ? void 0 : _c.changed(); } ); vue.onMounted(() => { var _a2; if (animation == null ? void 0 : animation.value) { (_a2 = layer2 == null ? void 0 : layer2.value) == null ? void 0 : _a2.animateFeature(feature.value, animation.value); } vue.nextTick(() => { var _a3; (_a3 = vectorSource == null ? void 0 : vectorSource.value) == null ? void 0 : _a3.addFeature(feature.value); }); }); vue.onUnmounted(() => { var _a2; (_a2 = vectorSource == null ? void 0 : vectorSource.value) == null ? void 0 : _a2.removeFeature(feature.value); }); vue.provide("feature", feature); vue.provide("stylable", feature); __expose({ feature }); return (_ctx, _cache) => { return vue.renderSlot(_ctx.$slots, "default"); }; } }); function checkAndUpdateStylePropDef(options) { if ("styles" in options) { const { styles, ...rest } = vue.toRefs(vue.reactive(options)); return { style: styles, ...rest }; } else { return options; } } function usePropsAsObjectProperties(props) { const instance = vue.getCurrentInstance(); let globalOptions = { debug: false }; if (instance) { globalOptions = vue.inject("ol-options", globalOptions); } const revisedProps = checkAndUpdateStylePropDef(props); const properties = vue.reactive(revisedProps); if (globalOptions == null ? void 0 : globalOptions.debug) { console.debug("[Vue3-OpenLayers Debug] PROPS", { in: props, out: properties }); } return properties; } const COMMON_EVENTS = ["change", "error", "propertychange"]; const LAYER_EVENTS = [ "change:extent", "change:maxResolution", "change:maxZoom", "change:minResolution", "change:minZoom", "change:opacity", "change:source", "change:visible", "change:zIndex", "postrender", "prerender", "sourceready" ]; const TILE_SOURCE_EVENTS = [ "tileloadend", "tileloaderror", "tileloadstart" ]; const IMAGE_SOURCE_EVENTS = [ "imageloadend", "imageloaderror", "imageloadstart" ]; const VECTOR_SOURCE_EVENTS = [ "addfeature", "changefeature", "clear", "featuresloadend", "featuresloaderror", "featuresloadstart", "removefeature" ]; function useOpenLayersEvents(feature, eventNames) { const instance = vue.getCurrentInstance(); let globalOptions = { debug: false }; if (instance) { globalOptions = vue.inject("ol-options", globalOptions); } function updateOpenLayersEventHandlers() { [...COMMON_EVENTS, ...eventNames].forEach((eventName) => { let unwrappedFeature; if (vue.isRef(feature)) { unwrappedFeature = feature.value; } else { unwrappedFeature = feature; } unwrappedFeature.on(eventName, (...args) => { if (globalOptions == null ? void 0 : globalOptions.debug) { console.debug("[Vue3-OpenLayers Debug] EVENT", eventName, { eventName, args, source: feature }); } instance == null ? void 0 : instance.emit(eventName, ...args); }); }); } if (instance) { vue.onMounted(() => { updateOpenLayersEventHandlers(); }); } return { updateOpenLayersEventHandlers }; } const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({ ...{ inheritAttrs: false }, __name: "OlGeolocation", props: { tracking: { type: Boolean, default: true }, trackingOptions: { default: () => ({ enableHighAccuracy: true }) }, projection: { default: "EPSG:3857" } }, emits: ["change", "error", "propertychange", "change:accuracy", "change:accuracyGeometry", "change:altitude", "change:altitudeAccuracy", "change:heading", "change:position", "change:projection", "change:speed", "change:tracking", "change:trackingOptions"], setup(__props, { expose: __expose }) { const props = __props; const properties = usePropsAsObjectProperties(props); const geoLoc = vue.computed(() => new Geolocation(properties)); useOpenLayersEvents(geoLoc, [ "change:accuracy", "change:accuracyGeometry", "change:altitude", "change:altitudeAccuracy", "change:heading", "change:position", "change:projection", "change:speed", "change:tracking", "change:trackingOptions" ]); const position2 = vue.ref([]); const accuracy = vue.ref(0); const altitude = vue.ref(0); const altitudeAccuracy = vue.ref(0); const speed = vue.ref(0); const heading = vue.ref(0); const accuracyGeometry = vue.ref(null); __expose({ geoLoc, position: position2, accuracy, altitude, altitudeAccuracy, speed, heading, accuracyGeometry }); return (_ctx, _cache) => { return vue.renderSlot(_ctx.$slots, "default", { position: position2.value, speed: speed.value, heading: heading.value, accuracy: accuracy.value, altitude: altitude.value, altitudeAccuracy: altitudeAccuracy.value, accuracyGeometry: accuracyGeometry.value }); }; } }); function mergeProperties(existingProperties, newProperties) { for (const key in newProperties) { if (Object.prototype.hasOwnProperty.call(newProperties, key)) { if (newProperties[key] !== void 0) { existingProperties[key] = newProperties[key]; } } } return existingProperties; } const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({ __name: "OlMap", props: { controls: {}, pixelRatio: {}, interactions: {}, keyboardEventTarget: {}, layers: {}, maxTilesLoading: {}, moveTolerance: {}, overlays: {}, target: {}, view: {}, instance: {} }, emits: ["change", "error", "propertychange", "change:layerGroup", "change:size", "change:target", "change:view", "click", "dblclick", "singleclick", "loadstart", "loadend", "pointerdrag", "pointermove", "movestart", "moveend", "postrender", "precompose", "postcompose", "rendercomplete"], setup(__props, { expose: __expose, emit: __emit }) { const props = __props; const emit = __emit; const properties = usePropsAsObjectProperties({ ...props, instance: void 0 }); const mapRef = vue.ref(void 0); let map = props.instance || new Map$1({ ...properties }); vue.watch( properties, () => { const p2 = props.instance ? mergeProperties(properties, props.instance.getProperties()) : properties; map == null ? void 0 : map.setProperties(p2); }, { immediate: true } ); vue.onMounted(() => { if (!props.instance) { map == null ? void 0 : map.setTarget(mapRef.value); } }); vue.onUnmounted(() => { if (!props.instance) { map == null ? void 0 : map.setTarget(void 0); } map = void 0; }); vue.provide("map", map); const forEachFeatureAtPixel = (pixel, callback, options) => map == null ? void 0 : map.forEachFeatureAtPixel(pixel, callback, options); const getCoordinateFromPixel = (pixel) => map == null ? void 0 : map.getCoordinateFromPixel(pixel); const render = () => map == null ? void 0 : map.render(); const updateSize = () => map == null ? void 0 : map.updateSize(); map.on("change", (event) => emit("change", event)); map.on("error", (event) => emit("error", event)); map.on("propertychange", (event) => emit("propertychange", event)); map.on("click", (event) => emit("click", event)); map.on("change:size", (event) => emit("change:size", event)); map.on("change:target", (event) => emit("change:target", event)); map.on("change:view", (event) => emit("change:view", event)); map.on("dblclick", (event) => emit("dblclick", event)); map.on("singleclick", (event) => emit("singleclick", event)); map.on("pointerdrag", (event) => emit("pointerdrag", event)); map.on("pointermove", (event) => emit("pointermove", event)); map.on("movestart", (event) => emit("movestart", event)); map.on("moveend", (event) => emit("moveend", event)); map.on("postrender", (event) => emit("postrender", event)); map.on("precompose", (event) => emit("precompose", event)); map.on("postcompose", (event) => emit("postcompose", event)); map.on("rendercomplete", (event) => emit("rendercomplete", event)); map.on("loadstart", (event) => { map == null ? void 0 : map.getTargetElement().classList.add("ol-map"); map == null ? void 0 : map.getTargetElement().classList.add("ol-map-loading"); map == null ? void 0 : map.getTargetElement().classList.remove("ol-map-fully-loaded"); emit("loadstart", event); }); map.on("loadend", (event) => { map == null ? void 0 : map.getTargetElement().classList.add("ol-map-fully-loaded"); map == null ? void 0 : map.getTargetElement().classList.remove("ol-map-loading"); emit("loadend", event); }); __expose({ map, mapRef, forEachFeatureAtPixel, getCoordinateFromPixel, render, updateSize }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", { ref_key: "mapRef", ref: mapRef }, [ vue.renderSlot(_ctx.$slots, "default") ], 512); }; } }); const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({ ...{ inheritAttrs: false }, __name: "OlOverlay", props: { id: {}, element: {}, offset: {}, position: {}, positioning: {}, stopEvent: { type: Boolean, default: true }, insertFirst: { type: Boolean, default: true }, autoPan: { type: [Boolean, Object] }, className: {} }, emits: ["change", "error", "propertychange", "change:element", "change:map", "change:offset", "change:position", "change:positioning"], setup(__props, { expose: __expose }) { const props = __props; const map = vue.inject("map"); const htmlContent = vue.ref(); const properties = usePropsAsObjectProperties(props); const overlay = vue.shallowRef(new Overlay(properties)); useOpenLayersEvents(overlay, [ "change:element", "change:map", "change:offset", "change:position", "change:positioning" ]); const getOffset = () => overlay.value.getOffset(); const getPosition = () => overlay.value.getPosition(); const getPositioning = () => overlay.value.getPositioning(); const panIntoView = (optPanIntoViewOptions) => overlay.value.panIntoView(optPanIntoViewOptions); const setElement = (element) => overlay.value.setElement(element); const setOffset = (offset) => overlay.value.setOffset(offset); const setPosition = (position2) => overlay.value.setPosition(position2); const setPositioning = (positioning) => overlay.value.setPositioning(positioning); function removeOverlay(ov) { const removed = map == null ? void 0 : map.removeOverlay(ov); if (!removed) { console.warn("couldn't find matching overlay to remove", overlay.value); } } vue.onMounted(() => { map == null ? void 0 : map.addOverlay(overlay.value); }); vue.onUnmounted(() => removeOverlay(overlay.value)); vue.watch( () => properties, (newValue) => { for (const key in newValue) { const keyInObj = key; if (newValue[keyInObj] !== void 0) { overlay.value.set(key, newValue[keyInObj]); } } }, { deep: true } ); vue.watchEffect( () => { setElement(htmlContent.value); }, { flush: "post" } ); __expose({ overlay, htmlContent, getOffset, getPosition, getPositioning, panIntoView, setElement, setOffset, setPosition, setPositioning }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", { ref_key: "htmlContent", ref: htmlContent }, [ vue.renderSlot(_ctx.$slots, "default", { position: _ctx.position }) ], 512); }; } }); function globals(defs2) { defs2("EPSG:4326", "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"); defs2("EPSG:4269", "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"); defs2("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"); defs2.WGS84 = defs2["EPSG:4326"]; defs2["EPSG:3785"] = defs2["EPSG:3857"]; defs2.GOOGLE = defs2["EPSG:3857"]; defs2["EPSG:900913"] = defs2["EPSG:3857"]; defs2["EPSG:102113"] = defs2["EPSG:3857"]; } var PJD_3PARAM = 1; var PJD_7PARAM = 2; var PJD_GRIDSHIFT = 3; var PJD_WGS84 = 4; var PJD_NODATUM = 5; var SRS_WGS84_SEMIMAJOR = 6378137; var SRS_WGS84_SEMIMINOR = 6356752314e-3; var SRS_WGS84_ESQUARED = 0.0066943799901413165; var SEC_TO_RAD = 484813681109536e-20; var HALF_PI = Math.PI / 2; var SIXTH = 0.16666666666666666; var RA4 = 0.04722222222222222; var RA6 = 0.022156084656084655; var EPSLN = 1e-10; var D2R$1 = 0.017453292519943295; var R2D = 57.29577951308232; var FORTPI = Math.PI / 4; var TWO_PI = Math.PI * 2; var SPI = 3.14159265359; var exports$3 = {}; exports$3.greenwich = 0; exports$3.lisbon = -9.131906111111; exports$3.paris = 2.337229166667; exports$3.bogota = -74.080916666667; exports$3.madrid = -3.687938888889; exports$3.rome = 12.452333333333; exports$3.bern = 7.439583333333; exports$3.jakarta = 106.807719444444; exports$3.ferro = -17.666666666667; exports$3.brussels = 4.367975; exports$3.stockholm = 18.058277777778; exports$3.athens = 23.7163375; exports$3.oslo = 10.722916666667; const units = { ft: { to_meter: 0.3048 }, "us-ft": { to_meter: 1200 / 3937 } }; var ignoredChar = /[\s_\-\/\(\)]/g; function match$1(obj, key) { if (obj[key]) { return obj[key]; } var keys3 = Object.keys(obj); var lkey = key.toLowerCase().replace(ignoredChar, ""); var i2 = -1; var testkey, processedKey; while (++i2 < keys3.length) { testkey = keys3[i2]; processedKey = testkey.toLowerCase().replace(ignoredChar, ""); if (processedKey === lkey) { return obj[testkey]; } } } function projStr(defData) { var self2 = {}; var paramObj = defData.split("+").map(function(v2) { return v2.trim(); }).filter(function(a2) { return a2; }).reduce(function(p2, a2) { var split2 = a2.split("="); split2.push(true); p2[split2[0].toLowerCase()] = split2[1]; return p2; }, {}); var paramName, paramVal, paramOutname; var params2 = { proj: "projName", datum: "datumCode", rf: function(v2) { self2.rf = parseFloat(v2); }, lat_0: function(v2) { self2.lat0 = v2 * D2R$1; }, lat_1: function(v2) { self2.lat1 = v2 * D2R$1; }, lat_2: function(v2) { self2.lat2 = v2 * D2R$1; }, lat_ts: function(v2) { self2.lat_ts = v2 * D2R$1; }, lon_0: function(v2) { self2.long0 = v2 * D2R$1; }, lon_1: function(v2) { self2.long1 = v2 * D2R$1; }, lon_2: function(v2) { self2.long2 = v2 * D2R$1; }, alpha: function(v2) { self2.alpha = parseFloat(v2) * D2R$1; }, gamma: function(v2) { self2.rectified_grid_angle = parseFloat(v2); }, lonc: function(v2) { self2.longc = v2 * D2R$1; }, x_0: function(v2) { self2.x0 = parseFloat(v2); }, y_0: function(v2) { self2.y0 = parseFloat(v2); }, k_0: function(v2) { self2.k0 = parseFloat(v2); }, k: function(v2) { self2.k0 = parseFloat(v2); }, a: function(v2) { self2.a = parseFloat(v2); }, b: function(v2) { self2.b = parseFloat(v2); }, r: function(v2) { self2.a = self2.b = parseFloat(v2); }, r_a: function() { self2.R_A = true; }, zone: function(v2) { self2.zone = parseInt(v2, 10); }, south: function() { self2.utmSouth = true; }, towgs84: function(v2) { self2.datum_params = v2.split(",").map(function(a2) { return parseFloat(a2); }); }, to_meter: function(v2) { self2.to_meter = parseFloat(v2); }, units: function(v2) { self2.units = v2; var unit = match$1(units, v2); if (unit) { self2.to_meter = unit.to_meter; } }, from_greenwich: function(v2) { self2.from_greenwich = v2 * D2R$1; }, pm: function(v2) { var pm = match$1(exports$3, v2); self2.from_greenwich = (pm ? pm : parseFloat(v2)) * D2R$1; }, nadgrids: function(v2) { if (v2 === "@null") { self2.datumCode = "none"; } else { self2.nadgrids = v2; } }, axis: function(v2) { var legalAxis = "ewnsud"; if (v2.length === 3 && legalAxis.indexOf(v2.substr(0, 1)) !== -1 && legalAxis.indexOf(v2.substr(1, 1)) !== -1 && legalAxis.indexOf(v2.substr(2, 1)) !== -1) { self2.axis = v2; } }, approx: function() { self2.approx = true; } }; for (paramName in paramObj) { paramVal = paramObj[paramName]; if (paramName in params2) { paramOutname = params2[paramName]; if (typeof paramOutname === "function") { paramOutname(paramVal); } else { self2[paramOutname] = paramVal; } } else { self2[paramName] = paramVal; } } if (typeof self2.datumCode === "string" && self2.datumCode !== "WGS84") { self2.datumCode = self2.datumCode.toLowerCase(); } return self2; } var NEUTRAL = 1; var KEYWORD = 2; var NUMBER = 3; var QUOTED = 4; var AFTERQUOTE = 5; var ENDED = -1; var whitespace = /\s/; var latin = /[A-Za-z]/; var keyword = /[A-Za-z84_]/; var endThings = /[,\]]/; var digets = /[\d\.E\-\+]/; function Parser$2(text2) { if (typeof text2 !== "string") { throw new Error("not a string"); } this.text = text2.trim(); this.level = 0; this.place = 0; this.root = null; this.stack = []; this.currentObject = null; this.state = NEUTRAL; } Parser$2.prototype.readCharicter = function() { var char = this.text[this.place++]; if (this.state !== QUOTED) { while (whitespace.test(char)) { if (this.place >= this.text.length) { return; } char = this.text[this.place++]; } } switch (this.state) { case NEUTRAL: return this.neutral(char); case KEYWORD: return this.keyword(char); case QUOTED: return this.quoted(char); case AFTERQUOTE: return this.afterquote(char); case NUMBER: return this.number(char); case ENDED: return; } }; Parser$2.prototype.afterquote = function(char) { if (char === '"') { this.word += '"'; this.state = QUOTED; return; } if (endThings.test(char)) { this.word = this.word.trim(); this.afterItem(char); return; } throw new Error(`havn't handled "` + char + '" in afterquote yet, index ' + this.place); }; Parser$2.prototype.afterItem = function(char) { if (char === ",") { if (this.word !== null) { this.currentObject.push(this.word); } this.word = null; this.state = NEUTRAL; return; } if (char === "]") { this.level--; if (this.word !== null) { this.currentObject.push(this.word); this.word = null; } this.state = NEUTRAL; this.currentObject = this.stack.pop(); if (!this.currentObject) { this.state = ENDED; } return; } }; Parser$2.prototype.number = function(char) { if (digets.test(char)) { this.word += char; return; } if (endThings.test(char)) { this.word = parseFloat(this.word); this.afterItem(char); return; } throw new Error(`havn't handled "` + char + '" in number yet, index ' + this.place); }; Parser$2.prototype.quoted = function(char) { if (char === '"') { this.state = AFTERQUOTE; return; } this.word += char; return; }; Parser$2.prototype.keyword = function(char) { if (keyword.test(char)) { this.word += char; return; } if (char === "[") { var newObjects = []; newObjects.push(this.word); this.level++; if (this.root === null) { this.root = newObjects; } else { this.currentObject.push(newObjects); } this.stack.push(this.currentObject); this.currentObject = newObjects; this.state = NEUTRAL; return; } if (endThings.test(char)) { this.afterItem(char); return; } throw new Error(`havn't handled "` + char + '" in keyword yet, index ' + this.place); }; Parser$2.prototype.neutral = function(char) { if (latin.test(char)) { this.word = char; this.state = KEYWORD; return; } if (char === '"') { this.word = ""; this.state = QUOTED; return; } if (digets.test(char)) { this.word = char; this.state = NUMBER; return; } if (endThings.test(char)) { this.afterItem(char); return; } throw new Error(`havn't handled "` + char + '" in neutral yet, index ' + this.place); }; Parser$2.prototype.output = function() { while (this.place < this.text.length) { this.readCharicter(); } if (this.state === ENDED) { return this.root; } throw new Error('unable to parse string "' + this.text + '". State is ' + this.state); }; function parseString(txt) { var parser = new Parser$2(txt); return parser.output(); } function mapit(obj, key, value) { if (Array.isArray(key)) { value.unshift(key); key = null; } var thing = key ? {} : obj; var out = value.reduce(function(newObj, item) { sExpr(item, newObj); return newObj; }, thing); if (key) { obj[key] = out; } } function sExpr(v2, obj) { if (!Array.isArray(v2)) { obj[v2] = true; return; } var key = v2.shift(); if (key === "PARAMETER") { key = v2.shift(); } if (v2.length === 1) { if (Array.isArray(v2[0])) { obj[key] = {}; sExpr(v2[0], obj[key]); return; } obj[key] = v2[0]; return; } if (!v2.length) { obj[key] = true; return; } if (key === "TOWGS84") { obj[key] = v2; return; } if (key === "AXIS") { if (!(key in obj)) { obj[key] = []; } obj[key].push(v2); return; } if (!Array.isArray(key)) { obj[key] = {}; } var i2; switch (key) { case "UNIT": case "PRIMEM": case "VERT_DATUM": obj[key] = { name: v2[0].toLowerCase(), convert: v2[1] }; if (v2.length === 3) { sExpr(v2[2], obj[key]); } return; case "SPHEROID": case "ELLIPSOID": obj[key] = { name: v2[0], a: v2[1], rf: v2[2] }; if (v2.length === 4) { sExpr(v2[3], obj[key]); } return; case "PROJECTEDCRS": case "PROJCRS": case "GEOGCS": case "GEOCCS": case "PROJCS": case "LOCAL_CS": case "GEODCRS": case "GEODETICCRS": case "GEODETICDATUM": case "EDATUM": case "ENGINEERINGDATUM": case "VERT_CS": case "VERTCRS": case "VERTICALCRS": case "COMPD_CS": case "COMPOUNDCRS": case "ENGINEERINGCRS": case "ENGCRS": case "FITTED_CS": case "LOCAL_DATUM": case "DATUM": v2[0] = ["name", v2[0]]; mapit(obj, key, v2); return; default: i2 = -1; while (++i2 < v2.length) { if (!Array.isArray(v2[i2])) { return sExpr(v2, obj[key]); } } return mapit(obj, key, v2); } } var D2R = 0.017453292519943295; function rename(obj, params2) { var outName = params2[0]; var inName = params2[1]; if (!(outName in obj) && inName in obj) { obj[outName] = obj[inName]; if (params2.length === 3) { obj[outName] = params2[2](obj[outName]); } } } function d2r(input) { return input * D2R; } function cleanWKT(wkt2) { if (wkt2.type === "GEOGCS") { wkt2.projName = "longlat"; } else if (wkt2.type === "LOCAL_CS") { wkt2.projName = "identity"; wkt2.local = true; } else { if (typeof wkt2.PROJECTION === "object") { wkt2.projName = Object.keys(wkt2.PROJECTION)[0]; } else { wkt2.projName = wkt2.PROJECTION; } } if (wkt2.AXIS) { var axisOrder = ""; for (var i2 = 0, ii = wkt2.AXIS.length; i2 < ii; ++i2) { var axis = [wkt2.AXIS[i2][0].toLowerCase(), wkt2.AXIS[i2][1].toLowerCase()]; if (axis[0].indexOf("north") !== -1 || (axis[0] === "y" || axis[0] === "lat") && axis[1] === "north") { axisOrder += "n"; } else if (axis[0].indexOf("south") !== -1 || (axis[0] === "y" || axis[0] === "lat") && axis[1] === "south") { axisOrder += "s"; } else if (axis[0].indexOf("east") !== -1 || (axis[0] === "x" || axis[0] === "lon") && axis[1] === "east") { axisOrder += "e"; } else if (axis[0].indexOf("west") !== -1 || (axis[0] === "x" || axis[0] === "lon") && axis[1] === "west") { axisOrder += "w"; } } if (axisOrder.length === 2) { axisOrder += "u"; } if (axisOrder.length === 3) { wkt2.axis = axisOrder; } } if (wkt2.UNIT) { wkt2.units = wkt2.UNIT.name.toLowerCase(); if (wkt2.units === "metre") { wkt2.units = "meter"; } if (wkt2.UNIT.convert) { if (wkt2.type === "GEOGCS") { if (wkt2.DATUM && wkt2.DATUM.SPHEROID) { wkt2.to_meter = wkt2.UNIT.convert * wkt2.DATUM.SPHEROID.a; } } else { wkt2.to_meter = wkt2.UNIT.convert; } } } var geogcs = wkt2.GEOGCS; if (wkt2.type === "GEOGCS") { geogcs = wkt2; } if (geogcs) { if (geogcs.DATUM) { wkt2.datumCode = geogcs.DATUM.name.toLowerCase(); } else { wkt2.datumCode = geogcs.name.toLowerCase(); } if (wkt2.datumCode.slice(0, 2) === "d_") { wkt2.datumCode = wkt2.datumCode.slice(2); } if (wkt2.datumCode === "new_zealand_geodetic_datum_1949" || wkt2.datumCode === "new_zealand_1949") { wkt2.datumCode = "nzgd49"; } if (wkt2.datumCode === "wgs_1984" || wkt2.datumCode === "world_geodetic_system_1984") { if (wkt2.PROJECTION === "Mercator_Auxiliary_Sphere") { wkt2.sphere = true; } wkt2.datumCode = "wgs84"; } if (wkt2.datumCode.slice(-6) === "_ferro") { wkt2.datumCode = wkt2.datumCode.slice(0, -6); } if (wkt2.datumCode.slice(-8) === "_jakarta") { wkt2.datumCode = wkt2.datumCode.slice(0, -8); } if (~wkt2.datumCode.indexOf("belge")) { wkt2.datumCode = "rnb72"; } if (geogcs.DATUM && geogcs.DATUM.SPHEROID) { wkt2.ellps = geogcs.DATUM.SPHEROID.name.replace("_19", "").replace(/[Cc]larke\_18/, "clrk"); if (wkt2.ellps.toLowerCase().slice(0, 13) === "international") { wkt2.ellps = "intl"; } wkt2.a = geogcs.DATUM.SPHEROID.a; wkt2.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10); } if (geogcs.DATUM && geogcs.DATUM.TOWGS84) { wkt2.datum_params = geogcs.DATUM.TOWGS84; } if (~wkt2.datumCode.indexOf("osgb_1936")) { wkt2.datumCode = "osgb36"; } if (~wkt2.datumCode.indexOf("osni_1952")) { wkt2.datumCode = "osni52"; } if (~wkt2.datumCode.indexOf("tm65") || ~wkt2.datumCode.indexOf("geodetic_datum_of_1965")) { wkt2.datumCode = "ire65"; } if (wkt2.datumCode === "ch1903+") { wkt2.datumCode = "ch1903"; } if (~wkt2.datumCode.indexOf("israel")) { wkt2.datumCode = "isr93"; } } if (wkt2.b && !isFinite(wkt2.b)) { wkt2.b = wkt2.a; } function toMeter(input) { var ratio = wkt2.to_meter || 1; return input * ratio; } var renamer = function(a2) { return rename(wkt2, a2); }; var list = [ ["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", d2r], ["longitude_of_center", "Longitude_Of_Center"], ["longitude_of_center", "Longitude_of_center"], ["longc", "longitude_of_center", d2r], ["x0", "false_easting", toMeter], ["y0", "false_northing", toMeter], ["long0", "central_meridian", d2r], ["lat0", "latitude_of_origin", d2r], ["lat0", "standard_parallel_1", d2r], ["lat1", "standard_parallel_1", d2r], ["lat2", "standard_parallel_2", d2r], ["azimuth", "Azimuth"], ["alpha", "azimuth", d2r], ["srsCode", "name"] ]; list.forEach(renamer); if (!wkt2.long0 && wkt2.longc && (wkt2.projName === "Albers_Conic_Equal_Area" || wkt2.projName === "Lambert_Azimuthal_Equal_Area")) { wkt2.long0 = wkt2.longc; } if (!wkt2.lat_ts && wkt2.lat1 && (wkt2.projName === "Stereographic_South_Pole" || wkt2.projName === "Polar Stereographic (variant B)")) { wkt2.lat0 = d2r(wkt2.lat1 > 0 ? 90 : -90); wkt2.lat_ts = wkt2.lat1; } else if (!wkt2.lat_ts && wkt2.lat0 && wkt2.projName === "Polar_Stereographic") { wkt2.lat_ts = wkt2.lat0; wkt2.lat0 = d2r(wkt2.lat0 > 0 ? 90 : -90); } } function wkt(wkt2) { var lisp = parseString(wkt2); var type = lisp.shift(); var name = lisp.shift(); lisp.unshift(["name", name]); lisp.unshift(["type", type]); var obj = {}; sExpr(lisp, obj); cleanWKT(obj); return obj; } function defs(name) { var that = this; if (arguments.length === 2) { var def = arguments[1]; if (typeof def === "string") { if (def.charAt(0) === "+") { defs[name] = projStr(arguments[1]); } else { defs[name] = wkt(arguments[1]); } } else { defs[name] = def; } } else if (arguments.length === 1) { if (Array.isArray(name)) { return name.map(function(v2) { if (Array.isArray(v2)) { defs.apply(that, v2); } else { defs(v2); } }); } else if (typeof name === "string") { if (name in defs) { return defs[name]; } } else if ("EPSG" in name) { defs["EPSG:" + name.EPSG] = name; } else if ("ESRI" in name) { defs["ESRI:" + name.ESRI] = name; } else if ("IAU2000" in name) { defs["IAU2000:" + name.IAU2000] = name; } else { console.log(name); } return; } } globals(defs); function testObj(code) { return typeof code === "string"; } function testDef(code) { return code in defs; } var codeWords = ["PROJECTEDCRS", "PROJCRS", "GEOGCS", "GEOCCS", "PROJCS", "LOCAL_CS", "GEODCRS", "GEODETICCRS", "GEODETICDATUM", "ENGCRS", "ENGINEERINGCRS"]; function testWKT(code) { return codeWords.some(function(word) { return code.indexOf(word) > -1; }); } var codes = ["3857", "900913", "3785", "102113"]; function checkMercator(item) { var auth = match$1(item, "authority"); if (!auth) { return; } var code = match$1(auth, "epsg"); return code && codes.indexOf(code) > -1; } function checkProjStr(item) { var ext = match$1(item, "extension"); if (!ext) { return; } return match$1(ext, "proj4"); } function testProj(code) { return code[0] === "+"; } function parse$1(code) { if (testObj(code)) { if (testDef(code)) { return defs[code]; } if (testWKT(code)) { var out = wkt(code); if (checkMercator(out)) { return defs["EPSG:3857"]; } var maybeProjStr = checkProjStr(out); if (maybeProjStr) { return projStr(maybeProjStr); } return out; } if (testProj(code)) { return projStr(code); } } else { return code; } } function extend(destination, source2) { destination = destination || {}; var value, property; if (!source2) { return destination; } for (property in source2) { value = source2[property]; if (value !== void 0) { destination[property] = value; } } return destination; } function msfnz(eccent, sinphi, cosphi) { var con = eccent * sinphi; return cosphi / Math.sqrt(1 - con * con); } function sign(x2) { return x2 < 0 ? -1 : 1; } function adjust_lon(x2) { return Math.abs(x2) <= SPI ? x2 : x2 - sign(x2) * TWO_PI; } function tsfnz(eccent, phi, sinphi) { var con = eccent * sinphi; var com = 0.5 * eccent; con = Math.pow((1 - con) / (1 + con), com); return Math.tan(0.5 * (HALF_PI - phi)) / con; } function phi2z(eccent, ts) { var eccnth = 0.5 * eccent; var con, dphi; var phi = HALF_PI - 2 * Math.atan(ts); for (var i2 = 0; i2 <= 15; i2++) { con = eccent * Math.sin(phi); dphi = HALF_PI - 2 * Math.atan(ts * Math.pow((1 - con) / (1 + con), eccnth)) - phi; phi += dphi; if (Math.abs(dphi) <= 1e-10) { return phi; } } return -9999; } function init$w() { var con = this.b / this.a; this.es = 1 - con * con; if (!("x0" in this)) { this.x0 = 0; } if (!("y0" in this)) { this.y0 = 0; } this.e = Math.sqrt(this.es); if (this.lat_ts) { if (this.sphere) { this.k0 = Math.cos(this.lat_ts); } else { this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)); } } else { if (!this.k0) { if (this.k) { this.k0 = this.k; } else { this.k0 = 1; } } } } function forward$v(p2) { var lon = p2.x; var lat = p2.y; if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) { return null; } var x2, y2; if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) { return null; } else { if (this.sphere) { x2 = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0); y2 = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat)); } else { var sinphi = Math.sin(lat); var ts = tsfnz(this.e, lat, sinphi); x2 = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0); y2 = this.y0 - this.a * this.k0 * Math.log(ts); } p2.x = x2; p2.y = y2; return p2; } } function inverse$v(p2) { var x2 = p2.x - this.x0; var y2 = p2.y - this.y0; var lon, lat; if (this.sphere) { lat = HALF_PI - 2 * Math.atan(Math.exp(-y2 / (this.a * this.k0))); } else { var ts = Math.exp(-y2 / (this.a * this.k0)); lat = phi2z(this.e, ts); if (lat === -9999) { return null; } } lon = adjust_lon(this.long0 + x2 / (this.a * this.k0)); p2.x = lon; p2.y = lat; return p2; } var names$x = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"]; const merc = { init: init$w, forward: forward$v, inverse: inverse$v, names: names$x }; function init$v() { } function identity(pt2) { return pt2; } var names$w = ["longlat", "identity"]; const longlat = { init: init$v, forward: identity, inverse: identity, names: names$w }; var projs = [merc, longlat]; var names$v = {}; var projStore = []; function add(proj2, i2) { var len = projStore.length; if (!proj2.names) { console.log(i2); return true; } projStore[len] = proj2; proj2.names.forEach(function(n2) { names$v[n2.toLowerCase()] = len; }); return this; } function get$1(name) { if (!name) { return false; } var n2 = name.toLowerCase(); if (typeof names$v[n2] !== "undefined" && projStore[names$v[n2]]) { return projStore[names$v[n2]]; } } function start() { projs.forEach(add); } const projections = { start, add, get: get$1 }; var exports$2 = {}; exports$2.MERIT = { a: 6378137, rf: 298.257, ellipseName: "MERIT 1983" }; exports$2.SGS85 = { a: 6378136, rf: 298.257, ellipseName: "Soviet Geodetic System 85" }; exports$2.GRS80 = { a: 6378137, rf: 298.257222101, ellipseName: "GRS 1980(IUGG, 1980)" }; exports$2.IAU76 = { a: 6378140, rf: 298.257, ellipseName: "IAU 1976" }; exports$2.airy = { a: 6377563396e-3, b: 635625691e-2, ellipseName: "Airy 1830" }; exports$2.APL4 = { a: 6378137, rf: 298.25, ellipseName: "Appl. Physics. 1965" }; exports$2.NWL9D = { a: 6378145, rf: 298.25, ellipseName: "Naval Weapons Lab., 1965" }; exports$2.mod_airy = { a: 6377340189e-3, b: 6356034446e-3, ellipseName: "Modified Airy" }; exports$2.andrae = { a: 637710443e-2, rf: 300, ellipseName: "Andrae 1876 (Den., Iclnd.)" }; exports$2.aust_SA = { a: 6378160, rf: 298.25, ellipseName: "Australian Natl & S. Amer. 1969" }; exports$2.GRS67 = { a: 6378160, rf: 298.247167427, ellipseName: "GRS 67(IUGG 1967)" }; exports$2.bessel = { a: 6377397155e-3, rf: 299.1528128, ellipseName: "Bessel 1841" }; exports$2.bess_nam = { a: 6377483865e-3, rf: 299.1528128, ellipseName: "Bessel 1841 (Namibia)" }; exports$2.clrk66 = { a: 63782064e-1, b: 63565838e-1, ellipseName: "Clarke 1866" }; exports$2.clrk80 = { a: 6378249145e-3, rf: 293.4663, ellipseName: "Clarke 1880 mod." }; exports$2.clrk80ign = { a: 63782492e-1, b: 6356515, rf: 293.4660213, ellipseName: "Clarke 1880 (IGN)" }; exports$2.clrk58 = { a: 6378293645208759e-9, rf: 294.2606763692654, ellipseName: "Clarke 1858" }; exports$2.CPM = { a: 63757387e-1, rf: 334.29, ellipseName: "Comm. des Poids et Mesures 1799" }; exports$2.delmbr = { a: 6376428, rf: 311.5, ellipseName: "Delambre 1810 (Belgium)" }; exports$2.engelis = { a: 637813605e-2, rf: 298.2566, ellipseName: "Engelis 1985" }; exports$2.evrst30 = { a: 6377276345e-3, rf: 300.8017, ellipseName: "Everest 1830" }; exports$2.evrst48 = { a: 6377304063e-3, rf: 300.8017, ellipseName: "Everest 1948" }; exports$2.evrst56 = { a: 6377301243e-3, rf: 300.8017, ellipseName: "Everest 1956" }; exports$2.evrst69 = { a: 6377295664e-3, rf: 300.8017, ellipseName: "Everest 1969" }; exports$2.evrstSS = { a: 6377298556e-3, rf: 300.8017, ellipseName: "Everest (Sabah & Sarawak)" }; exports$2.fschr60 = { a: 6378166, rf: 298.3, ellipseName: "Fischer (Mercury Datum) 1960" }; exports$2.fschr60m = { a: 6378155, rf: 298.3, ellipseName: "Fischer 1960" }; exports$2.fschr68 = { a: 6378150, rf: 298.3, ellipseName: "Fischer 1968" }; exports$2.helmert = { a: 6378200, rf: 298.3, ellipseName: "Helmert 1906" }; exports$2.hough = { a: 6378270, rf: 297, ellipseName: "Hough" }; exports$2.intl = { a: 6378388, rf: 297, ellipseName: "International 1909 (Hayford)" }; exports$2.kaula = { a: 6378163, rf: 298.24, ellipseName: "Kaula 1961" }; exports$2.lerch = { a: 6378139, rf: 298.257, ellipseName: "Lerch 1979" }; exports$2.mprts = { a: 6397300, rf: 191, ellipseName: "Maupertius 1738" }; exports$2.new_intl = { a: 63781575e-1, b: 63567722e-1, ellipseName: "New International 1967" }; exports$2.plessis = { a: 6376523, rf: 6355863, ellipseName: "Plessis 1817 (France)" }; exports$2.krass = { a: 6378245, rf: 298.3, ellipseName: "Krassovsky, 1942" }; exports$2.SEasia = { a: 6378155, b: 63567733205e-4, ellipseName: "Southeast Asia" }; exports$2.walbeck = { a: 6376896, b: 63558348467e-4, ellipseName: "Walbeck" }; exports$2.WGS60 = { a: 6378165, rf: 298.3, ellipseName: "WGS 60" }; exports$2.WGS66 = { a: 6378145, rf: 298.25, ellipseName: "WGS 66" }; exports$2.WGS7 = { a: 6378135, rf: 298.26, ellipseName: "WGS 72" }; var WGS84 = exports$2.WGS84 = { a: 6378137, rf: 298.257223563, ellipseName: "WGS 84" }; exports$2.sphere = { a: 6370997, b: 6370997, ellipseName: "Normal Sphere (r=6370997)" }; function eccentricity(a2, b2, rf, R_A) { var a22 = a2 * a2; var b22 = b2 * b2; var es = (a22 - b22) / a22; var e2 = 0; if (R_A) { a2 *= 1 - es * (SIXTH + es * (RA4 + es * RA6)); a22 = a2 * a2; es = 0; } else { e2 = Math.sqrt(es); } var ep2 = (a22 - b22) / b22; return { es, e: e2, ep2 }; } function sphere(a2, b2, rf, ellps, sphere2) { if (!a2) { var ellipse = match$1(exports$2, ellps); if (!ellipse) { ellipse = WGS84; } a2 = ellipse.a; b2 = ellipse.b; rf = ellipse.rf; } if (rf && !b2) { b2 = (1 - 1 / rf) * a2; } if (rf === 0 || Math.abs(a2 - b2) < EPSLN) { sphere2 = true; b2 = a2; } return { a: a2, b: b2, rf, sphere: sphere2 }; } var exports$1 = {}; exports$1.wgs84 = { towgs84: "0,0,0", ellipse: "WGS84", datumName: "WGS84" }; exports$1.ch1903 = { towgs84: "674.374,15.056,405.346", ellipse: "bessel", datumName: "swiss" }; exports$1.ggrs87 = { towgs84: "-199.87,74.79,246.62", ellipse: "GRS80", datumName: "Greek_Geodetic_Reference_System_1987" }; exports$1.nad83 = { towgs84: "0,0,0", ellipse: "GRS80", datumName: "North_American_Datum_1983" }; exports$1.nad27 = { nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat", ellipse: "clrk66", datumName: "North_American_Datum_1927" }; exports$1.potsdam = { towgs84: "598.1,73.7,418.2,0.202,0.045,-2.455,6.7", ellipse: "bessel", datumName: "Potsdam Rauenberg 1950 DHDN" }; exports$1.carthage = { towgs84: "-263.0,6.0,431.0", ellipse: "clark80", datumName: "Carthage 1934 Tunisia" }; exports$1.hermannskogel = { towgs84: "577.326,90.129,463.919,5.137,1.474,5.297,2.4232", ellipse: "bessel", datumName: "Hermannskogel" }; exports$1.militargeographische_institut = { towgs84: "577.326,90.129,463.91