vue3-openlayers
Version:
OpenLayers Wrapper for Vue3
1,812 lines • 1.57 MB
JavaScript
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);
import { defineComponent, inject, ref, watch, onMounted, nextTick, onUnmounted, provide, renderSlot, getCurrentInstance, reactive, toRefs, isRef, computed, openBlock, createElementBlock, shallowRef, watchEffect, createCommentVNode, mergeDefaults, useAttrs, useSlots } from "vue";
import Feature from "ol/Feature";
import Geometry from "ol/geom/Geometry";
import Geolocation from "ol/Geolocation";
import Map$1 from "ol/Map";
import Overlay from "ol/Overlay";
import { register } from "ol/proj/proj4";
import Projection$1 from "ol/proj/Projection";
import View from "ol/View";
import { Projection as Projection$2, get as get$2 } from "ol/proj";
import { Cluster } from "ol/source";
import AnimatedCluster from "ol-ext/layer/AnimatedCluster";
import HeatmapLayer from "ol/layer/Heatmap";
import ImageLayer from "ol/layer/Image";
import LayerGroup from "ol/layer/Group";
import TileLayer from "ol/layer/Tile";
import TileSource from "ol/source/Tile";
import VectorLayer from "ol/layer/Vector";
import VectorTileLayer from "ol/layer/VectorTile";
import VectorImageLayer from "ol/layer/VectorImage";
import TileLayer$1 from "ol/layer/WebGLTile";
import { Layer } from "ol/layer";
import WebGLVectorLayerRenderer from "ol/renderer/webgl/VectorLayer";
import BingMaps from "ol/source/BingMaps";
import VectorSource from "ol/source/Vector";
import ImageSource from "ol/source/Image";
import Cluster$1 from "ol/source/Cluster";
import Static from "ol/source/ImageStatic";
import ImageWMS from "ol/source/ImageWMS";
import OSM from "ol/source/OSM";
import StadiaMaps from "ol/source/StadiaMaps";
import WMTSSource from "ol/source/WMTS";
import TileGridWMTS from "ol/tilegrid/WMTS";
import TileArcGISRest from "ol/source/TileArcGISRest";
import { createXYZ } from "ol/tilegrid";
import TileDebug from "ol/source/TileDebug";
import GeoTIFF from "ol/source/GeoTIFF";
import TileJSON from "ol/source/TileJSON";
import TileWMS from "ol/source/TileWMS";
import { Collection } from "ol";
import VectorTileSource from "ol/source/VectorTile";
import XYZ from "ol/source/XYZ";
import * as extent from "ol/extent";
import { getTopLeft, getWidth } from "ol/extent";
import Attribution from "ol/control/Attribution";
import Bar from "ol-ext/control/Bar";
import Button from "ol-ext/control/Button";
import ContextMenu from "ol-contextmenu";
import FullScreen from "ol/control/FullScreen";
import LayerSwitcher from "ol-ext/control/LayerSwitcher";
import LayerSwitcherImage from "ol-ext/control/LayerSwitcherImage";
import MousePosition from "ol/control/MousePosition";
import OverviewMap from "ol/control/OverviewMap";
import PrintDialog from "ol-ext/control/PrintDialog";
import Profile from "ol-ext/control/Profile";
import Rotate$1 from "ol/control/Rotate";
import ScaleLine from "ol/control/ScaleLine";
import Search from "ol-ext/control/Search";
import Swipe from "ol-ext/control/Swipe";
import Toggle from "ol-ext/control/Toggle";
import VideoRecorder from "ol-ext/control/VideoRecorder";
import MapZone from "ol-ext/control/MapZone";
import Zoom from "ol/control/Zoom";
import ZoomSlider from "ol/control/ZoomSlider";
import ZoomToExtent from "ol/control/ZoomToExtent";
import Circle from "ol/geom/Circle";
import * as geom from "ol/geom";
import LineString from "ol/geom/LineString";
import MultiLineString from "ol/geom/MultiLineString";
import MultiPoint from "ol/geom/MultiPoint";
import MultiPolygon from "ol/geom/MultiPolygon";
import Point$2 from "ol/geom/Point";
import Polygon from "ol/geom/Polygon";
import Style from "ol/style/Style";
import Draw from "ol/interaction/Draw";
import Modify from "ol/interaction/Modify";
import CircleStyle from "ol/style/Circle";
import Fill from "ol/style/Fill";
import Stroke from "ol/style/Stroke";
import { Interaction } from "ol/interaction";
import Icon from "ol/style/Icon";
import Text from "ol/style/Text";
import FlowLine from "ol-ext/style/FlowLine";
import SelectCluster from "ol-ext/interaction/SelectCluster";
import DragBox from "ol/interaction/DragBox";
import DragRotate from "ol/interaction/DragRotate";
import DragRotateAndZoom from "ol/interaction/DragRotateAndZoom";
import Link from "ol/interaction/Link";
import Select from "ol/interaction/Select";
import Pointer from "ol/interaction/Pointer";
import Snap from "ol/interaction/Snap";
import Transform$1 from "ol-ext/interaction/Transform";
import * as selectconditions from "ol/events/condition";
import { always } from "ol/events/condition";
import MouseWheelZoom from "ol/interaction/MouseWheelZoom";
import Drop from "ol-ext/featureanimation/Drop";
import * as animations from "ol/easing";
import { easeOut } from "ol/easing";
import "ol-ext/featureanimation/FeatureAnimation";
import Fade from "ol-ext/featureanimation/Fade";
import Path from "ol-ext/featureanimation/Path";
import Shake from "ol-ext/featureanimation/Shake";
import Slide from "ol-ext/featureanimation/Slide";
import Teleport from "ol-ext/featureanimation/Teleport";
import Zoom$1 from "ol-ext/featureanimation/Zoom";
import * as format from "ol/format";
import * as loadingstrategy from "ol/loadingstrategy";
import "ol-contextmenu/ol-contextmenu.css";
import "ol-ext/dist/ol-ext.css";
import "ol/ol.css";
const _sfc_main$1l = /* @__PURE__ */ defineComponent({
__name: "OlFeature",
props: {
properties: {}
},
setup(__props, { expose: __expose }) {
const props = __props;
const vectorSource = inject("vectorSource");
const vectorLayer = inject(
"vectorLayer",
null
);
const heatmapLayer = inject("heatmapLayer", null);
const layer = heatmapLayer || vectorLayer;
const animation = inject(
"animation",
null
);
const feature = ref(
new Feature({ ...props.properties })
);
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({});
}
}
);
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();
}
);
onMounted(() => {
var _a2;
if (animation == null ? void 0 : animation.value) {
(_a2 = layer == null ? void 0 : layer.value) == null ? void 0 : _a2.animateFeature(feature.value, animation.value);
}
nextTick(() => {
var _a3;
(_a3 = vectorSource == null ? void 0 : vectorSource.value) == null ? void 0 : _a3.addFeature(feature.value);
});
});
onUnmounted(() => {
var _a2;
(_a2 = vectorSource == null ? void 0 : vectorSource.value) == null ? void 0 : _a2.removeFeature(feature.value);
});
provide("feature", feature);
provide("stylable", feature);
__expose({
feature
});
return (_ctx, _cache) => {
return renderSlot(_ctx.$slots, "default");
};
}
});
function checkAndUpdateStylePropDef(options) {
if ("styles" in options) {
const { styles, ...rest } = toRefs(reactive(options));
return { style: styles, ...rest };
} else {
return options;
}
}
function usePropsAsObjectProperties(props) {
const instance = getCurrentInstance();
let globalOptions = {
debug: false
};
if (instance) {
globalOptions = inject("ol-options", globalOptions);
}
const revisedProps = checkAndUpdateStylePropDef(props);
const properties = 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 = getCurrentInstance();
let globalOptions = {
debug: false
};
if (instance) {
globalOptions = inject("ol-options", globalOptions);
}
function updateOpenLayersEventHandlers() {
[...COMMON_EVENTS, ...eventNames].forEach((eventName) => {
let unwrappedFeature;
if (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) {
onMounted(() => {
updateOpenLayersEventHandlers();
});
}
return {
updateOpenLayersEventHandlers
};
}
const _sfc_main$1k = /* @__PURE__ */ 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 = 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 = ref([]);
const accuracy = ref(0);
const altitude = ref(0);
const altitudeAccuracy = ref(0);
const speed = ref(0);
const heading = ref(0);
const accuracyGeometry = ref(null);
__expose({
geoLoc,
position: position2,
accuracy,
altitude,
altitudeAccuracy,
speed,
heading,
accuracyGeometry
});
return (_ctx, _cache) => {
return 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__ */ 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 = ref(void 0);
let map = props.instance || new Map$1({ ...properties });
watch(
properties,
() => {
const p2 = props.instance ? mergeProperties(properties, props.instance.getProperties()) : properties;
map == null ? void 0 : map.setProperties(p2);
},
{ immediate: true }
);
onMounted(() => {
if (!props.instance) {
map == null ? void 0 : map.setTarget(mapRef.value);
}
});
onUnmounted(() => {
if (!props.instance) {
map == null ? void 0 : map.setTarget(void 0);
}
map = void 0;
});
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 openBlock(), createElementBlock("div", {
ref_key: "mapRef",
ref: mapRef
}, [
renderSlot(_ctx.$slots, "default")
], 512);
};
}
});
const _sfc_main$1i = /* @__PURE__ */ 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 = inject("map");
const htmlContent = ref();
const properties = usePropsAsObjectProperties(props);
const overlay = 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);
}
}
onMounted(() => {
map == null ? void 0 : map.addOverlay(overlay.value);
});
onUnmounted(() => removeOverlay(overlay.value));
watch(
() => properties,
(newValue) => {
for (const key in newValue) {
const keyInObj = key;
if (newValue[keyInObj] !== void 0) {
overlay.value.set(key, newValue[keyInObj]);
}
}
},
{ deep: true }
);
watchEffect(
() => {
setElement(htmlContent.value);
},
{
flush: "post"
}
);
__expose({
overlay,
htmlContent,
getOffset,
getPosition,
getPositioning,
panIntoView,
setElement,
setOffset,
setPosition,
setPositioning
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "htmlContent",
ref: htmlContent
}, [
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$2 = {};
exports$2.greenwich = 0;
exports$2.lisbon = -9.131906111111;
exports$2.paris = 2.337229166667;
exports$2.bogota = -74.080916666667;
exports$2.madrid = -3.687938888889;
exports$2.rome = 12.452333333333;
exports$2.bern = 7.439583333333;
exports$2.jakarta = 106.807719444444;
exports$2.ferro = -17.666666666667;
exports$2.brussels = 4.367975;
exports$2.stockholm = 18.058277777778;
exports$2.athens = 23.7163375;
exports$2.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$2, 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, source) {
destination = destination || {};
var value, property;
if (!source) {
return destination;
}
for (property in source) {
value = source[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(proj, i2) {
var len = projStore.length;
if (!proj.names) {
console.log(i2);
return true;
}
projStore[len] = proj;
proj.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$1 = {};
exports$1.MERIT = {
a: 6378137,
rf: 298.257,
ellipseName: "MERIT 1983"
};
exports$1.SGS85 = {
a: 6378136,
rf: 298.257,
ellipseName: "Soviet Geodetic System 85"
};
exports$1.GRS80 = {
a: 6378137,
rf: 298.257222101,
ellipseName: "GRS 1980(IUGG, 1980)"
};
exports$1.IAU76 = {
a: 6378140,
rf: 298.257,
ellipseName: "IAU 1976"
};
exports$1.airy = {
a: 6377563396e-3,
b: 635625691e-2,
ellipseName: "Airy 1830"
};
exports$1.APL4 = {
a: 6378137,
rf: 298.25,
ellipseName: "Appl. Physics. 1965"
};
exports$1.NWL9D = {
a: 6378145,
rf: 298.25,
ellipseName: "Naval Weapons Lab., 1965"
};
exports$1.mod_airy = {
a: 6377340189e-3,
b: 6356034446e-3,
ellipseName: "Modified Airy"
};
exports$1.andrae = {
a: 637710443e-2,
rf: 300,
ellipseName: "Andrae 1876 (Den., Iclnd.)"
};
exports$1.aust_SA = {
a: 6378160,
rf: 298.25,
ellipseName: "Australian Natl & S. Amer. 1969"
};
exports$1.GRS67 = {
a: 6378160,
rf: 298.247167427,
ellipseName: "GRS 67(IUGG 1967)"
};
exports$1.bessel = {
a: 6377397155e-3,
rf: 299.1528128,
ellipseName: "Bessel 1841"
};
exports$1.bess_nam = {
a: 6377483865e-3,
rf: 299.1528128,
ellipseName: "Bessel 1841 (Namibia)"
};
exports$1.clrk66 = {
a: 63782064e-1,
b: 63565838e-1,
ellipseName: "Clarke 1866"
};
exports$1.clrk80 = {
a: 6378249145e-3,
rf: 293.4663,
ellipseName: "Clarke 1880 mod."
};
exports$1.clrk80ign = {
a: 63782492e-1,
b: 6356515,
rf: 293.4660213,
ellipseName: "Clarke 1880 (IGN)"
};
exports$1.clrk58 = {
a: 6378293645208759e-9,
rf: 294.2606763692654,
ellipseName: "Clarke 1858"
};
exports$1.CPM = {
a: 63757387e-1,
rf: 334.29,
ellipseName: "Comm. des Poids et Mesures 1799"
};
exports$1.delmbr = {
a: 6376428,
rf: 311.5,
ellipseName: "Delambre 1810 (Belgium)"
};
exports$1.engelis = {
a: 637813605e-2,
rf: 298.2566,
ellipseName: "Engelis 1985"
};
exports$1.evrst30 = {
a: 6377276345e-3,
rf: 300.8017,
ellipseName: "Everest 1830"
};
exports$1.evrst48 = {
a: 6377304063e-3,
rf: 300.8017,
ellipseName: "Everest 1948"
};
exports$1.evrst56 = {
a: 6377301243e-3,
rf: 300.8017,
ellipseName: "Everest 1956"
};
exports$1.evrst69 = {
a: 6377295664e-3,
rf: 300.8017,
ellipseName: "Everest 1969"
};
exports$1.evrstSS = {
a: 6377298556e-3,
rf: 300.8017,
ellipseName: "Everest (Sabah & Sarawak)"
};
exports$1.fschr60 = {
a: 6378166,
rf: 298.3,
ellipseName: "Fischer (Mercury Datum) 1960"
};
exports$1.fschr60m = {
a: 6378155,
rf: 298.3,
ellipseName: "Fischer 1960"
};
exports$1.fschr68 = {
a: 6378150,
rf: 298.3,
ellipseName: "Fischer 1968"
};
exports$1.helmert = {
a: 6378200,
rf: 298.3,
ellipseName: "Helmert 1906"
};
exports$1.hough = {
a: 6378270,
rf: 297,
ellipseName: "Hough"
};
exports$1.intl = {
a: 6378388,
rf: 297,
ellipseName: "International 1909 (Hayford)"
};
exports$1.kaula = {
a: 6378163,
rf: 298.24,
ellipseName: "Kaula 1961"
};
exports$1.lerch = {
a: 6378139,
rf: 298.257,
ellipseName: "Lerch 1979"
};
exports$1.mprts = {
a: 6397300,
rf: 191,
ellipseName: "Maupertius 1738"
};
exports$1.new_intl = {
a: 63781575e-1,
b: 63567722e-1,
ellipseName: "New International 1967"
};
exports$1.plessis = {
a: 6376523,
rf: 6355863,
ellipseName: "Plessis 1817 (France)"
};
exports$1.krass = {
a: 6378245,
rf: 298.3,
ellipseName: "Krassovsky, 1942"
};
exports$1.SEasia = {
a: 6378155,
b: 63567733205e-4,
ellipseName: "Southeast Asia"
};
exports$1.walbeck = {
a: 6376896,
b: 63558348467e-4,
ellipseName: "Walbeck"
};
exports$1.WGS60 = {
a: 6378165,
rf: 298.3,
ellipseName: "WGS 60"
};
exports$1.WGS66 = {
a: 6378145,
rf: 298.25,
ellipseName: "WGS 66"
};
exports$1.WGS7 = {
a: 6378135,
rf: 298.26,
ellipseName: "WGS 72"
};
var WGS84 = exports$1.WGS84 = {
a: 6378137,
rf: 298.257223563,
ellipseName: "WGS 84"
};
exports$1.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$1, 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 = {};
exports.wgs84 = {
towgs84: "0,0,0",
ellipse: "WGS84",
datumName: "WGS84"
};
exports.ch1903 = {
towgs84: "674.374,15.056,405.346",
ellipse: "bessel",
datumName: "swiss"
};
exports.ggrs87 = {
towgs84: "-199.87,74.79,246.62",
ellipse: "GRS80",
datumName: "Greek_Geodetic_Reference_System_1987"
};
exports.nad83 = {
towgs84: "0,0,0",
ellipse: "GRS80",
datumName: "North_American_Datum_1983"
};
exports.nad27 = {
nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
ellipse: "clrk66",
datumName: "North_American_Datum_1927"
};
exports.potsdam = {
towgs84: "598.1,73.7,418.2,0.202,0.045,-2.455,6.7",
ellipse: "bessel",
datumName: "Potsdam Rauenberg 1950 DHDN"
};
exports.carthage = {
towgs84: "-263.0,6.0,431.0",
ellipse: "clark80",
datumName: "Carthage 1934 Tunisia"
};
exports.hermannskogel = {
towgs84: "577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
ellipse: "bessel",
datumName: "Hermannskogel"
};
exports.militargeographische_institut = {
towgs84: "577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
ellipse: "bessel",
datumName: "Militar-Geographische Institut"
};
exports.osni52 = {
towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
ellipse: "airy",
datumName: "Irish National"
};
exports.ire65 = {
towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
ellipse: "mod_airy",
datumName: "Ireland 1965"
};
exports.rassadiran = {
towgs84: "-133.63,-157.5,-158.62",
ellipse: "intl",
datumName: "Rassadiran"
};
exports.nzgd49 = {
towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
ellipse: "intl",
datumName: "New Zealand Geodetic Datum 1949"
};
exports.osgb36 = {
towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
ellipse: "airy",
datumName: "Airy 1830"
};
exports.s_jtsk = {
towgs84: "589,76,480",
ellipse: "bessel",
datumName: "S-JTSK (Ferro)"
};
exports.beduaram = {
towgs84: "-106,-87,188",
ellipse: "clrk80",
datumName: "Beduaram"
};
exports.gunung_segara = {
towgs84: "-403,684,41",
ellipse: "bessel",
datumName: "Gunung Segara Jakarta"
};
exports.rnb72 = {
towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
ellipse: "intl",
datumName: "Reseau National Belge 1972"
};
function datum(datumCode, datum_params, a2, b2, es, ep2, nadgrids) {
var out = {};
if (datumCode === void 0 |