@edugis-org/webmapx 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -0
- package/dist-lib/WMTS-DCN4zX0-.js +1169 -0
- package/dist-lib/alert-GeHlqlN8.js +310 -0
- package/dist-lib/assets/epsg-lookup.worker-J7TVnHDq.js +1 -0
- package/dist-lib/assets/shapefile.worker-kQfZj6G2.js +4 -0
- package/dist-lib/attribution-format-B4f05_u0.js +62 -0
- package/dist-lib/button-DFdGkRPQ.js +741 -0
- package/dist-lib/cesium-adapter-BHXNytkU.js +1488 -0
- package/dist-lib/checkbox-QoR4S8tV.js +284 -0
- package/dist-lib/chunk-HEgqtunE.js +20 -0
- package/dist-lib/chunk.36O46B5H-B6ZL7Sm1.js +77 -0
- package/dist-lib/chunk.3RPBFEDE-BFO1fHVm.js +138 -0
- package/dist-lib/chunk.5JY5FUCG-DTXsslmx.js +1090 -0
- package/dist-lib/chunk.6CTB5ZDJ-DjZrBd6Y.js +99 -0
- package/dist-lib/chunk.AJ3ENQ5C-Ci7Gm2b6.js +175 -0
- package/dist-lib/chunk.LD4M4QGE-CiCfhE8r.js +8 -0
- package/dist-lib/chunk.NYIIDP5N-BikXIStD.js +99 -0
- package/dist-lib/chunk.RWUUFNUL-DFztA4uV.js +43 -0
- package/dist-lib/chunk.SI4ACBFK-CLb9VfMG.js +61 -0
- package/dist-lib/chunk.YHLNUJ7P-D-kanrCf.js +503 -0
- package/dist-lib/core-CMAlSR68.js +22 -0
- package/dist-lib/decorate-CWgUV1hU.js +1139 -0
- package/dist-lib/decorators-B35AgiCU.js +351 -0
- package/dist-lib/deferred-query-service-BJDcngw6.js +386 -0
- package/dist-lib/dist-Dm6b7XCs.js +12318 -0
- package/dist-lib/dist-Ha9LQCut.js +244 -0
- package/dist-lib/dist-c1PlDAd1.js +2359 -0
- package/dist-lib/dist-kKlmcBXq.js +50 -0
- package/dist-lib/divider-CPm675yY.js +41 -0
- package/dist-lib/dropped-config-C_GyVa8o.js +17 -0
- package/dist-lib/dropped-layer-builder-DAaYgUPk.js +396 -0
- package/dist-lib/epsg-definitions-BZLZWa8Q.js +668 -0
- package/dist-lib/esm-CTuscnN5.js +46 -0
- package/dist-lib/file-sniff-Dhxj3KTF.js +251 -0
- package/dist-lib/geo-calculations-DbFJAUoI.js +30 -0
- package/dist-lib/icon-CEOgWlro.js +9 -0
- package/dist-lib/icon-button-Da_nBTy3.js +408 -0
- package/dist-lib/input-CeGntPlT.js +590 -0
- package/dist-lib/layer-discovery-afWzu5hY.js +2825 -0
- package/dist-lib/leaflet-adapter-D9djjrKv.js +1227 -0
- package/dist-lib/lib-CdHVicAE.js +4074 -0
- package/dist-lib/map-layer-registry-2cmkiRDK.js +62 -0
- package/dist-lib/maplibre-adapter-TFc3e0G9.js +1190 -0
- package/dist-lib/maplibre-expression-evaluator-DCWUcpwf.js +7233 -0
- package/dist-lib/marker-utils-DztWXeop.js +12 -0
- package/dist-lib/ol-tilegrid-9VtyxaLG.js +64 -0
- package/dist-lib/openlayers-adapter-DVW1KCRv.js +13307 -0
- package/dist-lib/option-CBxl1mZP.js +1106 -0
- package/dist-lib/papaparse.min-B7v3c0D7.js +501 -0
- package/dist-lib/rbush-C8k41T4z.js +254 -0
- package/dist-lib/shapefile-SawVY6xg.js +207 -0
- package/dist-lib/spinner-DysxdNG9.js +6 -0
- package/dist-lib/src-CL94RDe3.js +111 -0
- package/dist-lib/throttle-BeneRNYK.js +16 -0
- package/dist-lib/toast-Cm28o9U6.js +15 -0
- package/dist-lib/togeojson.es-DAgiTBvg.js +579 -0
- package/dist-lib/tooltip-Cucn1SiD.js +197 -0
- package/dist-lib/webmapx-3d-tool-D4CTD2gB.js +176 -0
- package/dist-lib/webmapx-base-tool-Dm9NAWLD.js +75 -0
- package/dist-lib/webmapx-config-edit-tool-DCTyxqTk.js +389 -0
- package/dist-lib/webmapx-coordinates-tool-jeWohup9.js +648 -0
- package/dist-lib/webmapx-core-bundle-BDImi1RE.js +8203 -0
- package/dist-lib/webmapx-draw-tool-DooAV8cF.js +4336 -0
- package/dist-lib/webmapx-geolocation-tool-Rw3-Iad1.js +788 -0
- package/dist-lib/webmapx-import-layer-tool-DRYviHd5.js +250 -0
- package/dist-lib/webmapx-info-tool-BJA157cy.js +412 -0
- package/dist-lib/webmapx-language-osmvector-M5y_lwOg.js +489 -0
- package/dist-lib/webmapx-measure-tool-BXhMJFC6.js +590 -0
- package/dist-lib/webmapx-modal-tool-eF6Naluv.js +84 -0
- package/dist-lib/webmapx-plugin-tool-D2Hghf9n.js +45 -0
- package/dist-lib/webmapx-print-tool-ob1bOsR5.js +348 -0
- package/dist-lib/webmapx-search-tool-Cv8BrYvY.js +437 -0
- package/dist-lib/webmapx-settings-DDEJ8aoV.js +479 -0
- package/dist-lib/webmapx-truearea-tool-CMB4Orm-.js +615 -0
- package/dist-lib/webmapx-view-mode-tool-CUpLNjOj.js +106 -0
- package/dist-lib/webmapx.css +2 -0
- package/dist-lib/webmapx.js +1321 -0
- package/dist-lib/wms-feature-info-C0RVMEQC.js +145 -0
- package/dist-lib/wms-url-builder-DIJLQ1v2.js +54 -0
- package/dist-lib/zip.js-DVhmtjxZ.js +3615 -0
- package/package.json +107 -0
- package/public/data/country-epsg-codes.json +297 -0
- package/public/data/world-countries-simplified.topojson +1 -0
- package/src/locales/en/core.json +20 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { d as e, i as t, n, o as r, r as i, t as a, u as o } from "./dist-Dm6b7XCs.js";
|
|
2
|
+
//#region node_modules/@allmaps/maplibre/dist/WarpedMapLayer.js
|
|
3
|
+
var s = {
|
|
4
|
+
layerId: "warped-map-layer",
|
|
5
|
+
layerType: "custom",
|
|
6
|
+
layerRenderingMode: "2d"
|
|
7
|
+
}, c = class extends a {
|
|
8
|
+
id;
|
|
9
|
+
type;
|
|
10
|
+
renderingMode;
|
|
11
|
+
map;
|
|
12
|
+
constructor(e) {
|
|
13
|
+
super(s, e), this.id = this.options.layerId, this.type = this.options.layerType, this.renderingMode = this.options.layerRenderingMode;
|
|
14
|
+
}
|
|
15
|
+
onAdd(e, t) {
|
|
16
|
+
this.map = e, this.renderer = new n(t, this.options), this.addEventListeners(), this.map.on("webglcontextlost", this.contextLost.bind(this)), this.map.on("webglcontextrestored", this.contextRestored.bind(this));
|
|
17
|
+
}
|
|
18
|
+
onRemove() {
|
|
19
|
+
this.renderer && (this.removeEventListeners(), this.map?.off("webglcontextlost", this.contextLost.bind(this)), this.map?.off("webglcontextrestored", this.contextRestored.bind(this)), this.renderer.destroy());
|
|
20
|
+
}
|
|
21
|
+
getBounds() {
|
|
22
|
+
a.assertRenderer(this.renderer);
|
|
23
|
+
let e = this.renderer.warpedMapList.getMapsBbox({ projection: { definition: "EPSG:4326" } });
|
|
24
|
+
if (e) return [[e[0], e[1]], [e[2], e[3]]];
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
if (!this.map || !this.renderer) return;
|
|
28
|
+
let t = this.map.getCanvas(), n = [t.width / window.devicePixelRatio, t.height / window.devicePixelRatio], a = this.map.getCenter(), s = r([a.lng, a.lat]), c = this.map.unproject([0, n[1]]), l = this.map.unproject([n[0], n[1]]), u = this.map.unproject([n[0], 0]), d = this.map.unproject([0, 0]), f = e(o([
|
|
29
|
+
r([c.lng, c.lat]),
|
|
30
|
+
r([l.lng, l.lat]),
|
|
31
|
+
r([u.lng, u.lat]),
|
|
32
|
+
r([d.lng, d.lat])
|
|
33
|
+
]), n), p = -(this.map.getBearing() / 180) * Math.PI, m = window.devicePixelRatio, h = new i(n, s, f, {
|
|
34
|
+
rotation: p,
|
|
35
|
+
devicePixelRatio: m
|
|
36
|
+
});
|
|
37
|
+
this.renderer.render(h);
|
|
38
|
+
}
|
|
39
|
+
nativeUpdate() {
|
|
40
|
+
this.map?.triggerRepaint();
|
|
41
|
+
}
|
|
42
|
+
nativePassWarpedMapEvent(e) {
|
|
43
|
+
e instanceof t && this.map && this.map.fire(e.type, {
|
|
44
|
+
...e.data,
|
|
45
|
+
layerId: this.id
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { c as WarpedMapLayer };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { a as e } from "./decorators-B35AgiCU.js";
|
|
2
|
+
import { d as t, f as n, l as r, u as i } from "./chunk.YHLNUJ7P-D-kanrCf.js";
|
|
3
|
+
import { css as a } from "lit";
|
|
4
|
+
//#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.SUSCR7CI.js
|
|
5
|
+
var o = a`
|
|
6
|
+
:host {
|
|
7
|
+
--color: var(--sl-panel-border-color);
|
|
8
|
+
--width: var(--sl-panel-border-width);
|
|
9
|
+
--spacing: var(--sl-spacing-medium);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host(:not([vertical])) {
|
|
13
|
+
display: block;
|
|
14
|
+
border-top: solid var(--width) var(--color);
|
|
15
|
+
margin: var(--spacing) 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([vertical]) {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
height: 100%;
|
|
21
|
+
border-left: solid var(--width) var(--color);
|
|
22
|
+
margin: 0 var(--spacing);
|
|
23
|
+
}
|
|
24
|
+
`, s = class extends r {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments), this.vertical = !1;
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback(), this.setAttribute("role", "separator");
|
|
30
|
+
}
|
|
31
|
+
handleVerticalChange() {
|
|
32
|
+
this.setAttribute("aria-orientation", this.vertical ? "vertical" : "horizontal");
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.IVVHNXMC.js
|
|
37
|
+
s.styles = [i, o], n([e({
|
|
38
|
+
type: Boolean,
|
|
39
|
+
reflect: !0
|
|
40
|
+
})], s.prototype, "vertical", 2), n([t("vertical")], s.prototype, "handleVerticalChange", 1), s.define("sl-divider");
|
|
41
|
+
//#endregion
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/utils/dropped-config.ts
|
|
2
|
+
var e = "webmapx-dropped-config", t = "config", n = "pending", r = "webmapx-dropped-config-pending";
|
|
3
|
+
function i() {
|
|
4
|
+
return new Promise((n, r) => {
|
|
5
|
+
let i = indexedDB.open(e, 1);
|
|
6
|
+
i.onupgradeneeded = () => i.result.createObjectStore(t), i.onsuccess = () => n(i.result), i.onerror = () => r(i.error);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
async function a(e) {
|
|
10
|
+
let a = await i();
|
|
11
|
+
await new Promise((r, i) => {
|
|
12
|
+
let o = a.transaction(t, "readwrite");
|
|
13
|
+
o.objectStore(t).put(e, n), o.oncomplete = () => r(), o.onerror = () => i(o.error);
|
|
14
|
+
}), a.close(), sessionStorage.setItem(r, "1");
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { a as storeDroppedConfig };
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { a as e } from "./chunk-HEgqtunE.js";
|
|
2
|
+
import { i as t, n, r } from "./zip.js-DVhmtjxZ.js";
|
|
3
|
+
import { isZip as i, sniffBlob as a } from "./file-sniff-Dhxj3KTF.js";
|
|
4
|
+
//#region src/utils/qml-style.ts
|
|
5
|
+
function o(e) {
|
|
6
|
+
if (e.startsWith("#")) return e;
|
|
7
|
+
let t = e.split(",").slice(0, 4).map(Number);
|
|
8
|
+
if (t.length >= 3 && t.every((e) => !Number.isNaN(e))) {
|
|
9
|
+
let [e, n, r, i = 255] = t;
|
|
10
|
+
return i < 255 ? `rgba(${e},${n},${r},${(i / 255).toFixed(2)})` : `rgb(${e},${n},${r})`;
|
|
11
|
+
}
|
|
12
|
+
return e;
|
|
13
|
+
}
|
|
14
|
+
function s(e, t) {
|
|
15
|
+
for (let n of Array.from(e.querySelectorAll(":scope > prop"))) if (n.getAttribute("k") === t) return n.getAttribute("v") ?? void 0;
|
|
16
|
+
for (let n of Array.from(e.querySelectorAll(":scope > Option > Option"))) if (n.getAttribute("name") === t) return n.getAttribute("value") ?? void 0;
|
|
17
|
+
}
|
|
18
|
+
function c(e) {
|
|
19
|
+
let t = e.getAttribute("type"), n = e.querySelector(":scope > layer");
|
|
20
|
+
if (!n) return null;
|
|
21
|
+
if (t === "fill") {
|
|
22
|
+
let e = s(n, "color"), t = s(n, "outline_color") ?? s(n, "line_color");
|
|
23
|
+
return {
|
|
24
|
+
type: "fill",
|
|
25
|
+
color: e ? o(e) : void 0,
|
|
26
|
+
outlineColor: t ? o(t) : void 0
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (t === "line") {
|
|
30
|
+
let e = s(n, "line_color") ?? s(n, "color"), t = s(n, "line_width") ?? s(n, "width");
|
|
31
|
+
return {
|
|
32
|
+
type: "line",
|
|
33
|
+
color: e ? o(e) : void 0,
|
|
34
|
+
width: t ? Math.max(1, parseFloat(t) * 2) : void 0
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (t === "marker") {
|
|
38
|
+
let e = s(n, "color"), t = s(n, "size");
|
|
39
|
+
return {
|
|
40
|
+
type: "circle",
|
|
41
|
+
color: e ? o(e) : void 0,
|
|
42
|
+
radius: t ? Math.max(1, parseFloat(t) * 2) : void 0
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function l(e, t, n) {
|
|
48
|
+
if (e.type === "fill") {
|
|
49
|
+
let r = {};
|
|
50
|
+
t !== void 0 && (r["fill-color"] = t);
|
|
51
|
+
let i = n ?? e.outlineColor;
|
|
52
|
+
return i !== void 0 && (r["fill-outline-color"] = i), r;
|
|
53
|
+
}
|
|
54
|
+
if (e.type === "line") {
|
|
55
|
+
let n = { "line-width": e.width ?? 2 };
|
|
56
|
+
return t !== void 0 && (n["line-color"] = t), n;
|
|
57
|
+
}
|
|
58
|
+
let r = { "circle-radius": e.radius ?? 8 };
|
|
59
|
+
return t !== void 0 && (r["circle-color"] = t), r;
|
|
60
|
+
}
|
|
61
|
+
function u(e) {
|
|
62
|
+
let t = e.replace(/<!DOCTYPE[^>]*>/i, ""), n = new DOMParser().parseFromString(t, "application/xml");
|
|
63
|
+
if (n.querySelector("parsererror")) return null;
|
|
64
|
+
let r = n.querySelector("renderer-v2");
|
|
65
|
+
if (!r) return null;
|
|
66
|
+
let i = r.getAttribute("type"), a = n.querySelector("qgis > layerOpacity")?.textContent, o = a ? parseFloat(a) : void 0;
|
|
67
|
+
if (i === "categorizedSymbol") {
|
|
68
|
+
let e = r.getAttribute("attr"), t = Array.from(r.querySelectorAll(":scope > categories > category")), n = /* @__PURE__ */ new Map();
|
|
69
|
+
for (let e of Array.from(r.querySelectorAll(":scope > symbols > symbol"))) {
|
|
70
|
+
let t = e.getAttribute("name");
|
|
71
|
+
t && n.set(t, e);
|
|
72
|
+
}
|
|
73
|
+
let i = null, a = ["match", ["to-string", ["get", e ?? ""]]], s = ["match", ["to-string", ["get", e ?? ""]]], u, d, f = !1;
|
|
74
|
+
for (let e of t) {
|
|
75
|
+
let t = e.getAttribute("symbol"), r = e.getAttribute("value") ?? "", o = t ? n.get(t) : void 0;
|
|
76
|
+
if (!o) continue;
|
|
77
|
+
let l = c(o);
|
|
78
|
+
if (!l) continue;
|
|
79
|
+
i ||= l;
|
|
80
|
+
let p = l.color;
|
|
81
|
+
if (p) {
|
|
82
|
+
if (l.outlineColor && (f = !0), r === "" && e.getAttribute("render") !== "false") {
|
|
83
|
+
u = p, d = l.outlineColor;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
a.push(r, p), s.push(r, l.outlineColor ?? p);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (!i || !e || a.length <= 2) return null;
|
|
90
|
+
a.push(u ?? i.color ?? "#444444"), s.push(d ?? u ?? i.outlineColor ?? i.color ?? "#444444");
|
|
91
|
+
let p = l(i, a, f ? s : void 0);
|
|
92
|
+
return i.type === "fill" && o !== void 0 && (p["fill-opacity"] = o), {
|
|
93
|
+
type: i.type,
|
|
94
|
+
paint: p
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
let s = n.querySelector("renderer-v2 > symbols > symbol");
|
|
98
|
+
if (!s) return null;
|
|
99
|
+
let u = c(s);
|
|
100
|
+
if (!u) return null;
|
|
101
|
+
let d = l(u, u.color);
|
|
102
|
+
return u.type === "fill" && o !== void 0 && (d["fill-opacity"] = o), {
|
|
103
|
+
type: u.type,
|
|
104
|
+
paint: d
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/utils/dropped-layer-builder.ts
|
|
109
|
+
function d(e) {
|
|
110
|
+
return e.split("/").pop() || e;
|
|
111
|
+
}
|
|
112
|
+
function f(e) {
|
|
113
|
+
let t = e.lastIndexOf(".");
|
|
114
|
+
return t > 0 ? e.slice(0, t) : e;
|
|
115
|
+
}
|
|
116
|
+
function p(e) {
|
|
117
|
+
return f(e).replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
118
|
+
}
|
|
119
|
+
async function m(e) {
|
|
120
|
+
let i = new n(new r(e)), a = await i.getEntries(), o = [];
|
|
121
|
+
for (let e of a) e.directory || !e.getData || o.push({
|
|
122
|
+
name: d(e.filename),
|
|
123
|
+
blob: await e.getData(new t())
|
|
124
|
+
});
|
|
125
|
+
return await i.close(), o;
|
|
126
|
+
}
|
|
127
|
+
async function h(e) {
|
|
128
|
+
let t = [], n = [];
|
|
129
|
+
for (let r of e) await i(r) ? t.push(...g(await m(r))) : n.push({
|
|
130
|
+
name: r.name,
|
|
131
|
+
blob: r
|
|
132
|
+
});
|
|
133
|
+
return n.length > 0 && t.push(n), t;
|
|
134
|
+
}
|
|
135
|
+
function g(e) {
|
|
136
|
+
let t = e.filter((e) => /_style\.json$/i.test(e.name));
|
|
137
|
+
if (t.length === 0) return [e];
|
|
138
|
+
let n = [], r = /* @__PURE__ */ new Set();
|
|
139
|
+
for (let i of t) {
|
|
140
|
+
let t = i.name.replace(/_style\.json$/i, "").toLowerCase(), a = [i];
|
|
141
|
+
r.add(i);
|
|
142
|
+
for (let n of e) r.has(n) || f(n.name).toLowerCase() === t && (a.push(n), r.add(n));
|
|
143
|
+
n.push(a);
|
|
144
|
+
}
|
|
145
|
+
let i = e.filter((e) => !r.has(e));
|
|
146
|
+
return i.length > 0 && n.push(i), n;
|
|
147
|
+
}
|
|
148
|
+
var _ = "#444444";
|
|
149
|
+
function v(e) {
|
|
150
|
+
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
151
|
+
e && (t.add(e.type), e.type === "GeometryCollection" && e.geometries.forEach(n));
|
|
152
|
+
};
|
|
153
|
+
for (let t of e.features) n(t.geometry);
|
|
154
|
+
return t;
|
|
155
|
+
}
|
|
156
|
+
function y(e, t, n, r, i) {
|
|
157
|
+
let a = `${e}${t}`, o = v(r), s = o.has("Polygon") || o.has("MultiPolygon"), c = o.has("LineString") || o.has("MultiLineString"), l = o.has("Point") || o.has("MultiPoint"), u = [];
|
|
158
|
+
s && u.push({
|
|
159
|
+
id: `${a}-fill`,
|
|
160
|
+
type: "fill",
|
|
161
|
+
source: n,
|
|
162
|
+
filter: [
|
|
163
|
+
"match",
|
|
164
|
+
["geometry-type"],
|
|
165
|
+
["Polygon", "MultiPolygon"],
|
|
166
|
+
!0,
|
|
167
|
+
!1
|
|
168
|
+
],
|
|
169
|
+
paint: i?.type === "fill" ? i.paint : {
|
|
170
|
+
"fill-color": _,
|
|
171
|
+
"fill-opacity": .3
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
let d = s && i?.type === "fill" && "fill-outline-color" in i.paint;
|
|
175
|
+
return (c || s && !d) && u.push({
|
|
176
|
+
id: `${a}-line`,
|
|
177
|
+
type: "line",
|
|
178
|
+
source: n,
|
|
179
|
+
filter: [
|
|
180
|
+
"match",
|
|
181
|
+
["geometry-type"],
|
|
182
|
+
[
|
|
183
|
+
"LineString",
|
|
184
|
+
"MultiLineString",
|
|
185
|
+
"Polygon",
|
|
186
|
+
"MultiPolygon"
|
|
187
|
+
],
|
|
188
|
+
!0,
|
|
189
|
+
!1
|
|
190
|
+
],
|
|
191
|
+
paint: i?.type === "line" ? i.paint : {
|
|
192
|
+
"line-color": _,
|
|
193
|
+
"line-width": 2
|
|
194
|
+
}
|
|
195
|
+
}), l && u.push({
|
|
196
|
+
id: `${a}-circle`,
|
|
197
|
+
type: "circle",
|
|
198
|
+
source: n,
|
|
199
|
+
filter: [
|
|
200
|
+
"match",
|
|
201
|
+
["geometry-type"],
|
|
202
|
+
["Point", "MultiPoint"],
|
|
203
|
+
!0,
|
|
204
|
+
!1
|
|
205
|
+
],
|
|
206
|
+
paint: i?.type === "circle" ? i.paint : {
|
|
207
|
+
"circle-color": _,
|
|
208
|
+
"circle-radius": 8
|
|
209
|
+
}
|
|
210
|
+
}), u;
|
|
211
|
+
}
|
|
212
|
+
var b = [
|
|
213
|
+
"lon",
|
|
214
|
+
"lng",
|
|
215
|
+
"longitude",
|
|
216
|
+
"long",
|
|
217
|
+
"x",
|
|
218
|
+
"lengtegraad",
|
|
219
|
+
"lengte",
|
|
220
|
+
"längengrad",
|
|
221
|
+
"laengengrad",
|
|
222
|
+
"länge",
|
|
223
|
+
"laenge",
|
|
224
|
+
"longitud"
|
|
225
|
+
], x = [
|
|
226
|
+
"lat",
|
|
227
|
+
"latitude",
|
|
228
|
+
"y",
|
|
229
|
+
"breedtegraad",
|
|
230
|
+
"breedte",
|
|
231
|
+
"breitengrad",
|
|
232
|
+
"breite",
|
|
233
|
+
"latitud"
|
|
234
|
+
];
|
|
235
|
+
function S(e, t) {
|
|
236
|
+
return e.find((e) => t.some((t) => t.toLowerCase() === e));
|
|
237
|
+
}
|
|
238
|
+
function C(e, t) {
|
|
239
|
+
if (e.length === 0) return null;
|
|
240
|
+
let n = Object.keys(e[0]), r = S(b, n), i = S(x, n);
|
|
241
|
+
if (!r || !i) return console.warn(`[csv-import] "${t}": no coordinate columns found. Tried lon=${b.join("/")}, lat=${x.join("/")}`), null;
|
|
242
|
+
let a = [];
|
|
243
|
+
for (let t of e) {
|
|
244
|
+
let e = Number(t[r]), n = Number(t[i]);
|
|
245
|
+
if (!isFinite(e) || !isFinite(n)) continue;
|
|
246
|
+
let o = {};
|
|
247
|
+
for (let [e, n] of Object.entries(t)) e !== r && e !== i && (o[e] = n);
|
|
248
|
+
a.push({
|
|
249
|
+
type: "Feature",
|
|
250
|
+
geometry: {
|
|
251
|
+
type: "Point",
|
|
252
|
+
coordinates: [e, n]
|
|
253
|
+
},
|
|
254
|
+
properties: o
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
return a.length === 0 ? null : {
|
|
258
|
+
type: "FeatureCollection",
|
|
259
|
+
features: a
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
async function w(t) {
|
|
263
|
+
let n = [], r = null, i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = null;
|
|
264
|
+
for (let l of t) {
|
|
265
|
+
let t = await a(l.blob), d = l.name.toLowerCase();
|
|
266
|
+
if (d.endsWith(".dbf")) o.set(f(d), l);
|
|
267
|
+
else if (d.endsWith(".prj")) s.set(f(d), l);
|
|
268
|
+
else if (t.kind === "geojson") try {
|
|
269
|
+
n.push({
|
|
270
|
+
name: l.name,
|
|
271
|
+
data: JSON.parse(await l.blob.text())
|
|
272
|
+
});
|
|
273
|
+
} catch {}
|
|
274
|
+
else if (t.kind === "topojson") try {
|
|
275
|
+
let e = JSON.parse(await l.blob.text()), { feature: t } = await import("./src-CL94RDe3.js").then((e) => e.t), r = e.objects;
|
|
276
|
+
for (let [i, a] of Object.entries(r)) {
|
|
277
|
+
let o = t(e, a);
|
|
278
|
+
n.push({
|
|
279
|
+
name: Object.keys(r).length > 1 ? `${l.name}#${i}` : l.name,
|
|
280
|
+
data: o
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
} catch {}
|
|
284
|
+
else if (t.kind === "maplibre-style" && !r) try {
|
|
285
|
+
r = {
|
|
286
|
+
name: l.name,
|
|
287
|
+
style: JSON.parse(await l.blob.text())
|
|
288
|
+
};
|
|
289
|
+
} catch {}
|
|
290
|
+
else if (t.kind === "gpx") try {
|
|
291
|
+
let { gpx: e } = await import("./togeojson.es-DAgiTBvg.js"), t = new DOMParser().parseFromString(await l.blob.text(), "text/xml");
|
|
292
|
+
n.push({
|
|
293
|
+
name: l.name,
|
|
294
|
+
data: e(t)
|
|
295
|
+
});
|
|
296
|
+
} catch {}
|
|
297
|
+
else if (t.kind === "kml") try {
|
|
298
|
+
let { kml: e } = await import("./togeojson.es-DAgiTBvg.js"), t = new DOMParser().parseFromString(await l.blob.text(), "text/xml");
|
|
299
|
+
n.push({
|
|
300
|
+
name: l.name,
|
|
301
|
+
data: e(t)
|
|
302
|
+
});
|
|
303
|
+
} catch {}
|
|
304
|
+
else if (t.kind === "kmz") try {
|
|
305
|
+
let { kml: e } = await import("./togeojson.es-DAgiTBvg.js"), t = (await m(l.blob)).find((e) => e.name.toLowerCase().endsWith(".kml"));
|
|
306
|
+
if (t) {
|
|
307
|
+
let r = new DOMParser().parseFromString(await t.blob.text(), "text/xml");
|
|
308
|
+
n.push({
|
|
309
|
+
name: l.name,
|
|
310
|
+
data: e(r)
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
} catch {}
|
|
314
|
+
else if (t.kind === "csv") try {
|
|
315
|
+
let t = C((await import("./papaparse.min-B7v3c0D7.js").then((t) => /* @__PURE__ */ e(t.default, 1))).default.parse(await l.blob.text(), {
|
|
316
|
+
header: !0,
|
|
317
|
+
skipEmptyLines: !0,
|
|
318
|
+
dynamicTyping: !0
|
|
319
|
+
}).data, l.name);
|
|
320
|
+
t && n.push({
|
|
321
|
+
name: l.name,
|
|
322
|
+
data: t
|
|
323
|
+
});
|
|
324
|
+
} catch {}
|
|
325
|
+
else t.kind === "shp" && d.endsWith(".shp") ? i.set(f(d), l) : t.kind === "qml" && (console.log("parsing qml style"), c = u(await l.blob.text()), console.log("style result:", JSON.stringify(c)));
|
|
326
|
+
}
|
|
327
|
+
if (i.size > 0) {
|
|
328
|
+
let { shapefileToGeoJSONInWorker: e } = await import("./shapefile-SawVY6xg.js");
|
|
329
|
+
for (let [t, r] of i) {
|
|
330
|
+
let i = o.get(t), a = s.get(t);
|
|
331
|
+
try {
|
|
332
|
+
let t = await e(await r.blob.arrayBuffer(), i ? await i.blob.arrayBuffer() : null, a ? await a.blob.text() : null);
|
|
333
|
+
n.push({
|
|
334
|
+
name: r.name,
|
|
335
|
+
data: t
|
|
336
|
+
});
|
|
337
|
+
} catch (e) {
|
|
338
|
+
console.error(`[dropped-layer-builder] failed to parse shapefile "${r.name}"`, e);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (n.length === 0) return null;
|
|
343
|
+
let l = p(typeof r?.style.id == "string" ? r.style.id : n[0].name), d = `${l}:`, h = /* @__PURE__ */ new Map();
|
|
344
|
+
for (let e of n) {
|
|
345
|
+
let t = p(e.name), n = {
|
|
346
|
+
sourceKey: `${d}${t}`,
|
|
347
|
+
data: e.data
|
|
348
|
+
};
|
|
349
|
+
h.set(e.name.toLowerCase(), n), h.set(f(e.name).toLowerCase(), n), h.set(t.toLowerCase(), n);
|
|
350
|
+
}
|
|
351
|
+
let g = {}, _;
|
|
352
|
+
if (r) {
|
|
353
|
+
let e = r.style.sources ?? {}, t = /* @__PURE__ */ new Map();
|
|
354
|
+
for (let [n, r] of Object.entries(e)) {
|
|
355
|
+
if (r.type === "raster" || r.type === "raster-dem") continue;
|
|
356
|
+
let e = typeof r.data == "string" ? h.get(r.data.toLowerCase()) : void 0;
|
|
357
|
+
if (e) g[e.sourceKey] = {
|
|
358
|
+
...r,
|
|
359
|
+
data: e.data
|
|
360
|
+
}, t.set(n, e.sourceKey);
|
|
361
|
+
else {
|
|
362
|
+
let e = `${d}${p(n)}`;
|
|
363
|
+
g[e] = r, t.set(n, e);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
_ = (r.style.layers ?? []).filter((e) => e.type !== "raster" && e.type !== "hillshade" && (!e.source || t.has(e.source))).map((e) => ({
|
|
367
|
+
...e,
|
|
368
|
+
id: `${d}${p(e.id ?? e.type)}`,
|
|
369
|
+
source: e.source ? t.get(e.source) ?? e.source : e.source
|
|
370
|
+
}));
|
|
371
|
+
} else {
|
|
372
|
+
_ = [];
|
|
373
|
+
for (let e of n) {
|
|
374
|
+
let t = p(e.name), n = `${d}${t}`;
|
|
375
|
+
g[n] = {
|
|
376
|
+
type: "geojson",
|
|
377
|
+
data: e.data
|
|
378
|
+
}, _.push(...y(d, t, n, e.data, c));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
let v = r?.style.metadata ?? {};
|
|
382
|
+
return {
|
|
383
|
+
id: l,
|
|
384
|
+
type: "style",
|
|
385
|
+
version: 8,
|
|
386
|
+
title: typeof r?.style.title == "string" ? r.style.title : n[0].name,
|
|
387
|
+
metadata: {
|
|
388
|
+
...v,
|
|
389
|
+
dynamic: !0
|
|
390
|
+
},
|
|
391
|
+
sources: g,
|
|
392
|
+
layers: _
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
//#endregion
|
|
396
|
+
export { w as buildLayerConfigFromGroup, h as groupDroppedFiles };
|