@eodash/eodash 5.0.0-alpha.2.10 → 5.0.0-alpha.2.12

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.
Files changed (44) hide show
  1. package/core/client/composables/index.js +37 -18
  2. package/core/client/eodash.js +3 -10
  3. package/core/client/store/Actions.js +9 -33
  4. package/core/client/store/States.js +3 -0
  5. package/core/client/utils/createLayers.js +131 -0
  6. package/core/client/utils/eodashSTAC.js +149 -227
  7. package/core/client/utils/helpers.js +49 -69
  8. package/dist/client/{DashboardLayout-C_3q8Y10.js → DashboardLayout-g4rqjeWc.js} +2 -2
  9. package/dist/client/{DynamicWebComponent-IiTTLBt-.js → DynamicWebComponent-BKV7nbud.js} +4 -4
  10. package/dist/client/{EodashDatePicker-DgC1lccp.js → EodashDatePicker-D4zsy9eq.js} +43 -43
  11. package/dist/client/EodashItemFilter-CRA5Ksjy.js +10067 -0
  12. package/dist/client/EodashLayerControl-CcFkORFA.js +31500 -0
  13. package/dist/client/{EodashMap-C96D3LLv.js → EodashMap-Bq6kJxfa.js} +8326 -8311
  14. package/dist/client/{EodashMapBtns-DDtzV94u.js → EodashMapBtns-Tzefzyf2.js} +5 -5
  15. package/dist/client/{ExportState-CduS2mFs.js → ExportState-CbK0FtDG.js} +37 -37
  16. package/dist/client/{Footer-DHQcutCv.js → Footer-BrNqLnRu.js} +1 -1
  17. package/dist/client/{Header-DC0y7rLK.js → Header-CbTE-BoI.js} +4 -4
  18. package/dist/client/{IframeWrapper-BK-10FbS.js → IframeWrapper-Ph5bZpJZ.js} +1 -1
  19. package/dist/client/{MobileLayout-BpLoMY4i.js → MobileLayout-kdgmpNhM.js} +6 -6
  20. package/dist/client/{PopUp-CNMCWL0z.js → PopUp-BWbFe1C1.js} +9 -9
  21. package/dist/client/{VImg-DT7eb8V-.js → VImg-CzQmrZjo.js} +2 -2
  22. package/dist/client/{VMain-OenWyy46.js → VMain-DfQqCpW9.js} +2 -2
  23. package/dist/client/{VOverlay-x3UXpKhr.js → VOverlay-sx4v7gXf.js} +71 -71
  24. package/dist/client/{WidgetsContainer-qMUwtN0W.js → WidgetsContainer-BrWo2pW8.js} +5 -5
  25. package/dist/client/{asWebComponent-DQrnLsI2.js → asWebComponent-CVFLR8Hh.js} +4117 -4117
  26. package/dist/client/{decoder-Cth6J7EK-CtUoHA6r.js → decoder-Cth6J7EK-DlG9ScOz.js} +1 -1
  27. package/dist/client/eo-dash.js +1 -1
  28. package/dist/client/{forwardRefs-CpNjL95t.js → forwardRefs-BOAfCdT0.js} +1 -1
  29. package/dist/client/{helpers-KCSgmfim.js → helpers-BjdrMtvO.js} +206 -232
  30. package/dist/client/{index-DopVrUzM.js → index-Ct9AYlRj.js} +5 -5
  31. package/dist/client/{lerc-BgbQqdFI-D986ErVw.js → lerc-BgbQqdFI-B1NkI4BO.js} +1 -1
  32. package/dist/client/{ssrBoot-DkjdOWvj.js → ssrBoot-BfIptj2L.js} +1 -1
  33. package/dist/client/style.css +1 -1
  34. package/dist/client/{transition-BtJHh7JK.js → transition-YJj28Lgx.js} +1 -1
  35. package/dist/node/cli.js +2 -2
  36. package/package.json +6 -3
  37. package/widgets/EodashDatePicker.vue +4 -3
  38. package/widgets/EodashItemFilter.vue +17 -12
  39. package/widgets/EodashLayerControl.vue +18 -0
  40. package/widgets/EodashMap.vue +46 -75
  41. package/widgets/ExportState.vue +3 -2
  42. package/dist/client/EodashItemFilter-DoWZGe6r.js +0 -7671
  43. package/dist/client/eox-jsonform-DCErgjhw.js +0 -17515
  44. package/dist/client/eox-layercontrol-D0Ht7Mag.js +0 -21298
@@ -1,4 +1,4 @@
1
- import { p as m, ay as b, d, bf as l, ab as u } from "./asWebComponent-DQrnLsI2.js";
1
+ import { p as m, ay as b, d, bh as l, ab as u } from "./asWebComponent-CVFLR8Hh.js";
2
2
  const j = m({
3
3
  transition: {
4
4
  type: [Boolean, String, Object],
package/dist/node/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{createLogger as P,defineConfig as C,searchForWorkspaceRoot as x,createServer as k,preview as S,build as F}from"vite";import{readFileSync as U,existsSync as u}from"fs";import t from"path";import{Command as E}from"commander";import{readFile as W,writeFile as I,rm as $,cp as N}from"fs/promises";import O from"@vitejs/plugin-vue";import T,{transformAssetUrls as A}from"vite-plugin-vuetify";const s=b(process.cwd()),h=new E("eodash"),H=JSON.parse(U(t.join(s,"package.json"),"utf-8"));h.version(H.version,"-v, --version","output the current version"),h.option("--publicDir <path>","path to statically served assets folder").option("--no-publicDir","stop serving static assets").option("--outDir <path>","minified output folder").option("-e, --entryPoint <path>","file exporting `createEodash`").option("-w, --widgets <path>","folder that contains vue components as internal widgets").option("--cacheDir <path>","cache folder").option("-r, --runtime <path>","file exporting eodash client runtime config").option("-b, --base <path>","base public path").option("-p, --port <port>","serving port").option("-o, --open","open default browser when the server starts").option("-c, --config <path>","path to eodash server and build configuration file").option("--host [IP address]","specify which IP addresses the server should listen on").option("-l, --lib","builds eodash as a web component library").option("--no-lib","builds eodash as an SPA").option("--no-host","do not expose server to the network").parse(process.argv);const i=await z(h.opts(),process.argv?.[2]),c=b(),L=i.publicDir?t.resolve(s,i.publicDir):t.join(s,"./public"),f=t.join(s,"/src"),l=i.runtime?t.resolve(s,i.runtime):t.join(f,"./runtime.js"),g=i.entryPoint?t.resolve(s,i.entryPoint):t.join(f,"/main.js"),w=i.widgets?t.resolve(s,i.widgets):t.join(f,"widgets"),j=t.join(s,"/.eodash"),m=i.outDir?t.resolve(s,i.outDir):t.join(j,"/dist"),R=i.cacheDir?t.resolve(s,i.cacheDir):t.join(j,"cache"),v=P(void 0,{prefix:"[eodash]"});async function z(e,n){let a=e.config?t.resolve(s,e.config):t.join(s,"eodash.config.js"),o={};return u(a)?o=await import(a).then(r=>r.default instanceof Function?r.default():r.default).catch(r=>{console.error(r)}):a=null,{base:e.base??o?.base,port:Number(e.port??o?.[n]?.port),host:e.host??o?.[n]?.host,open:e.open??o?.[n]?.open,cacheDir:e.cacheDir??o?.cacheDir,entryPoint:e.entryPoint??o?.entryPoint,outDir:e.outDir??o?.outDir,publicDir:e.publicDir??o?.publicDir,runtime:e.runtime??o?.runtime,widgets:e.widgets??o?.widgets,lib:e.lib??o?.lib}}function b(e=import.meta.dirname){if(e.split("/").length>0)return u(t.resolve(e,"package.json"))?e:b(t.resolve(e,".."));throw new Error("no package root found from "+e)}const y=`
2
+ import{createLogger as P,defineConfig as C,searchForWorkspaceRoot as x,createServer as k,preview as S,build as F}from"vite";import{readFileSync as U,existsSync as u}from"fs";import t from"path";import{Command as E}from"commander";import{fileURLToPath as W}from"url";import{readFile as I,writeFile as T,rm as $,cp as L}from"fs/promises";import N from"@vitejs/plugin-vue";import O,{transformAssetUrls as A}from"vite-plugin-vuetify";const s=b(process.cwd()),h=new E("eodash"),H=JSON.parse(U(t.join(s,"package.json"),"utf-8"));h.version(H.version,"-v, --version","output the current version"),h.option("--publicDir <path>","path to statically served assets folder").option("--no-publicDir","stop serving static assets").option("--outDir <path>","minified output folder").option("-e, --entryPoint <path>","file exporting `createEodash`").option("-w, --widgets <path>","folder that contains vue components as internal widgets").option("--cacheDir <path>","cache folder").option("-r, --runtime <path>","file exporting eodash client runtime config").option("-b, --base <path>","base public path").option("-p, --port <port>","serving port").option("-o, --open","open default browser when the server starts").option("-c, --config <path>","path to eodash server and build configuration file").option("--host [IP address]","specify which IP addresses the server should listen on").option("-l, --lib","builds eodash as a web component library").option("--no-lib","builds eodash as an SPA").option("--no-host","do not expose server to the network").parse(process.argv);const i=await J(h.opts(),process.argv?.[2]),c=b(),R=i.publicDir?t.resolve(s,i.publicDir):t.join(s,"./public"),m=t.join(s,"/src"),l=i.runtime?t.resolve(s,i.runtime):t.join(m,"./runtime.js"),g=i.entryPoint?t.resolve(s,i.entryPoint):t.join(m,"/main.js"),w=i.widgets?t.resolve(s,i.widgets):t.join(m,"widgets"),j=t.join(s,"/.eodash"),f=i.outDir?t.resolve(s,i.outDir):t.join(j,"/dist"),z=i.cacheDir?t.resolve(s,i.cacheDir):t.join(j,"cache"),v=P(void 0,{prefix:"[eodash]"});async function J(e,n){let a=e.config?t.resolve(s,e.config):t.join(s,"eodash.config.js"),o={};return u(a)?o=await import(a).then(r=>r.default instanceof Function?r.default():r.default).catch(r=>{console.error(r)}):a=null,{base:e.base??o?.base,port:Number(e.port??o?.[n]?.port),host:e.host??o?.[n]?.host,open:e.open??o?.[n]?.open,cacheDir:e.cacheDir??o?.cacheDir,entryPoint:e.entryPoint??o?.entryPoint,outDir:e.outDir??o?.outDir,publicDir:e.publicDir??o?.publicDir,runtime:e.runtime??o?.runtime,widgets:e.widgets??o?.widgets,lib:e.lib??o?.lib}}function b(e=import.meta.dirname??t.dirname(W(import.meta.url))){if(e?.split("/").length)return u(t.resolve(e,"package.json"))?e:b(t.resolve(e,".."));throw new Error("no package root found from "+e)}const y=`
3
3
  <!DOCTYPE html>
4
4
  <html lang="en">
5
5
 
@@ -17,4 +17,4 @@ ${i.lib?`<eo-dash style="height:100dvh;"/>
17
17
  <script type="module" src="${t.resolve(`/@fs/${c}`,"core/client/render.js")}"><\/script>
18
18
  `}
19
19
  </body>
20
- </html>`,D=C(({mode:e,command:n})=>({base:i.base??"",cacheDir:R,plugins:[O({customElement:!1,template:{transformAssetUrls:A,compilerOptions:{isCustomElement:a=>!a.includes("v-")&&a.includes("-")}}}),T({autoImport:!0}),e==="development"&&{name:"inject-html",configureServer:J}],customLogger:v,define:{"process.env":{}},resolve:{alias:{"@":t.join(c,"core/client"),"^":t.join(c,"widgets"),"user:config":g,"user:widgets":w},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:i.port??3e3,open:i.open,fs:{allow:[x(process.cwd())]},host:i.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs"],noDiscovery:!0}:{},publicDir:i.publicDir===!1?!1:L,build:{lib:i.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:m,emptyOutDir:!0,rollupOptions:i.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function J(e){e.watcher.add([g,l,t.join(w,"**/*.vue")]);let n="";const a=v.info;return v.info=(o,r)=>{if(o.includes("core")){const d=o.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(o,r)},e.watcher.on("change",async o=>{n=o,o===l&&e.hot.send({type:"full-reload",path:o})}),()=>{e.middlewares.use(async(o,r,d)=>{if(o.originalUrl==="/@fs/config.js"||o.originalUrl==="/config.js"){r.statusCode=200,r.setHeader("Content-Type","text/javascript"),u(l)&&await W(l).then(p=>{r.write(p)}),r.end();return}if(o.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(o.url,y,o.originalUrl);r.end(p);return}d()})}}const M=async()=>{const e=await k(await D({mode:"development",command:"serve"}));await e.listen(),e.printUrls(),e.bindCLIShortcuts({print:!0})},Y=async()=>{const e=async()=>{const n=await D({mode:"production",command:"build"});await F(n),u(l)&&await N(l,t.join(m,"config.js"),{recursive:!0}).catch(a=>{console.error(a)})};if(i.lib)await e();else{const n=t.join(c,"/index.html");await I(n,y).then(async()=>{await e(),await $(n).catch(()=>{console.error("failed to remove index.html")})})}};async function B(){(await S({root:s,base:i.base??"",preview:{port:isNaN(i.port)?8080:i.port,open:i.open,host:i.host},build:{outDir:m}})).printUrls()}const G=process.argv?.[2];(async()=>{switch(G){case"dev":await M();break;case"build":await Y();break;case"preview":await B();break;default:console.error("command not found");break}})();
20
+ </html>`,D=C(({mode:e,command:n})=>({base:i.base??"",cacheDir:z,plugins:[N({customElement:!1,template:{transformAssetUrls:A,compilerOptions:{isCustomElement:a=>!a.includes("v-")&&a.includes("-")}}}),O({autoImport:!0}),e==="development"&&{name:"inject-html",configureServer:M}],customLogger:v,define:{"process.env":{}},resolve:{alias:{"@":t.join(c,"core/client"),"^":t.join(c,"widgets"),"user:config":g,"user:widgets":w},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:i.port??3e3,open:i.open,fs:{allow:[x(process.cwd())]},host:i.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs"],noDiscovery:!0}:{},publicDir:i.publicDir===!1?!1:R,build:{lib:i.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:f,emptyOutDir:!0,rollupOptions:i.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function M(e){e.watcher.add([g,l,t.join(w,"**/*.vue")]);let n="";const a=v.info;return v.info=(o,r)=>{if(o.includes("core")){const d=o.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(o,r)},e.watcher.on("change",async o=>{n=o,o===l&&e.hot.send({type:"full-reload",path:o})}),()=>{e.middlewares.use(async(o,r,d)=>{if(o.originalUrl==="/@fs/config.js"||o.originalUrl==="/config.js"){r.statusCode=200,r.setHeader("Content-Type","text/javascript"),u(l)&&await I(l).then(p=>{r.write(p)}),r.end();return}if(o.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(o.url,y,o.originalUrl);r.end(p);return}d()})}}const Y=async()=>{const e=await k(await D({mode:"development",command:"serve"}));await e.listen(),e.printUrls(),e.bindCLIShortcuts({print:!0})},B=async()=>{const e=async()=>{const n=await D({mode:"production",command:"build"});await F(n),u(l)&&await L(l,t.join(f,"config.js"),{recursive:!0}).catch(a=>{console.error(a)})};if(i.lib)await e();else{const n=t.join(c,"/index.html");await T(n,y).then(async()=>{await e(),await $(n).catch(()=>{console.error("failed to remove index.html")})})}};async function G(){(await S({root:s,base:i.base??"",preview:{port:isNaN(i.port)?8080:i.port,open:i.open,host:i.host},build:{outDir:f}})).printUrls()}const K=process.argv?.[2];(async()=>{switch(K){case"dev":await Y();break;case"build":await B();break;case"preview":await G();break;default:console.error("command not found");break}})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.2.10",
3
+ "version": "5.0.0-alpha.2.12",
4
4
  "type": "module",
5
5
  "types": "./core/client/types.d.ts",
6
6
  "files": [
@@ -46,9 +46,9 @@
46
46
  "docs:generate": "typedoc --options typedoc.config.json"
47
47
  },
48
48
  "dependencies": {
49
- "@eox/itemfilter": "^0.14.1",
49
+ "@eox/itemfilter": "^1.0.0",
50
50
  "@eox/jsonform": "^0.8.1",
51
- "@eox/layercontrol": "0.17.6-dev.2.0",
51
+ "@eox/layercontrol": "^0.18.1-dev.1721833788.0",
52
52
  "@eox/layout": "^0.1.0",
53
53
  "@eox/map": "1.9.3-ol-9.2.5-dev.1719634408469.0",
54
54
  "@eox/stacinfo": "^0.3.3",
@@ -91,6 +91,9 @@
91
91
  "vitest": "^1.6.0",
92
92
  "vue-tsc": "2.0.22"
93
93
  },
94
+ "engines": {
95
+ "node": ">=20.15.1"
96
+ },
94
97
  "bin": {
95
98
  "eodash": "./dist/node/cli.js"
96
99
  }
@@ -45,6 +45,7 @@ import { useSTAcStore } from "@/store/stac";
45
45
  import { datetime } from "@/store/States";
46
46
  import { mdiRayStartArrow, mdiRayEndArrow } from "@mdi/js";
47
47
  import { extractCollectionUrls } from "@/utils/helpers";
48
+ import axios from "axios";
48
49
 
49
50
  /**
50
51
  * @param {boolean} reverse
@@ -131,9 +132,9 @@ onMounted(() => {
131
132
  "#D55E00",
132
133
  ];
133
134
  for (let idx = 0; idx < collectionUrls.length; idx++) {
134
- const stacCollection = await (
135
- await fetch(collectionUrls[idx])
136
- ).json();
135
+ const stacCollection = await axios
136
+ .get(collectionUrls[idx])
137
+ .then((resp) => resp.data);
137
138
  const dates = stacCollection.links
138
139
  .filter(
139
140
  (/** @type {{ rel: string; datetime: string }} */ item) =>
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <eox-itemfilter class="fill-height" :config="config" ref="eoxItemFilter">
2
+ <eox-itemfilter
3
+ class="fill-height"
4
+ v-bind="config"
5
+ ref="eoxItemFilter"
6
+ style="overflow: auto"
7
+ @select="onSelect"
8
+ >
3
9
  <h4 slot="filterstitle" style="margin: 14px 8px">{{ filtersTitle }}</h4>
4
10
 
5
11
  <h4 slot="resultstitle" style="margin: 14px 8px">{{ resultsTitle }}</h4>
@@ -53,7 +59,12 @@ const props = defineProps({
53
59
  ],
54
60
  },
55
61
  });
56
-
62
+ /** @param {any} evt*/
63
+ const onSelect = async (evt) => {
64
+ const item = /** @type {import('stac-ts').StacLink} */ evt.detail;
65
+ await store.loadSelectedSTAC(item.href);
66
+ console.log(item, store.selectedStac);
67
+ };
57
68
  const config = {
58
69
  titleProperty: props.titleProperty,
59
70
  filterProperties: props.filterProperties,
@@ -81,15 +92,9 @@ onMounted(() => {
81
92
  `;
82
93
  eoxItemFilter.value?.shadowRoot?.appendChild(style);
83
94
 
84
- eoxItemFilter.value?.apply(
85
- // Only list child elements in list
86
- store.stac?.filter((item) => item.rel === "child"),
87
- );
88
- /** @type {any} */ (eoxItemFilter.value).config.onSelect =
89
- /** @param {import('stac-ts').StacLink} item */
90
- async (item) => {
91
- await store.loadSelectedSTAC(item.href);
92
- console.log(item, store.selectedStac);
93
- };
95
+ // Only list child elements in list
96
+ const items = store.stac?.filter((item) => item.rel === "child");
97
+ /** @type {any} */
98
+ (eoxItemFilter.value).items = items;
94
99
  });
95
100
  </script>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <span class="d-flex flex-column fill-height overflow-auto pa-4">
3
+ <eox-layercontrol ref="eoxLayercontrol" />
4
+ </span>
5
+ </template>
6
+ <script setup>
7
+ import "@eox/layercontrol";
8
+ import "@eox/jsonform";
9
+ import { onMounted, ref } from "vue";
10
+ import { mapEl } from "@/store/States";
11
+ /** @type { import("vue").Ref<HTMLElement & Record<string,any> | null>} */
12
+ const eoxLayercontrol = ref(null);
13
+
14
+ onMounted(() => {
15
+ /** @type{ HTMLElement & Record<string,any> }*/
16
+ (eoxLayercontrol.value).for = mapEl.value;
17
+ });
18
+ </script>
@@ -7,22 +7,16 @@
7
7
  </template>
8
8
  <script setup>
9
9
  import { transformExtent } from "ol/proj";
10
- import { inject, onMounted, onUnmounted, reactive, ref, watch } from "vue";
11
- import { toAbsolute } from "stac-js/src/http.js";
10
+ import { onMounted, onUnmounted, reactive, ref, watch } from "vue";
12
11
  import { EodashCollection } from "@/utils/eodashSTAC";
13
- import { extractCollectionUrls } from "@/utils/helpers";
14
- import { eodashKey } from "@/utils/keys";
15
- import { datetime, mapPosition } from "@/store/States";
12
+ import { extractCollectionUrls, uid } from "@/utils/helpers";
13
+ import { currentUrl, datetime, mapEl, mapPosition } from "@/store/States";
16
14
  import { storeToRefs } from "pinia";
17
15
  import { useSTAcStore } from "@/store/stac";
18
16
  import "@eox/map";
19
17
  import "@eox/map/dist/eox-map-advanced-layers-and-sources.js";
20
18
 
21
- const eodashConfig = /** @type {import("@/types").Eodash} */ (
22
- inject(eodashKey)
23
- );
24
-
25
- /** @type {import("vue").Ref<(HTMLElement & Record<string,unknown>) | null>} */
19
+ /** @type {import("vue").Ref<(HTMLElement & Record<string,any>) | null>} */
26
20
  const eoxMap = ref(null);
27
21
 
28
22
  const eoxMapConfig = reactive({
@@ -70,11 +64,6 @@ const handleMoveEnd = (evt) => {
70
64
  const map = /** @type {import("openlayers").Map | undefined} */ (
71
65
  /** @type {any} */ (evt).map
72
66
  );
73
- /*
74
- const currentProj = map?.getView().getProjection();
75
- const transFunc = getTransform(currentProj?.getCode(), 'EPSG:4326');
76
- const [x, y] = transFunc(map?.getView().getCenter() ?? [0, 0], undefined, undefined);
77
- */
78
67
  const [x, y] = map?.getView().getCenter() ?? [0, 0];
79
68
  const z = map?.getView().getZoom();
80
69
  if (!Number.isNaN(x) && !Number.isNaN(y) && !Number.isNaN(z)) {
@@ -85,6 +74,8 @@ const handleMoveEnd = (evt) => {
85
74
  const store = useSTAcStore();
86
75
 
87
76
  onMounted(() => {
77
+ mapEl.value = /** @type {HTMLElement & Record<string,any>} */ (eoxMap.value);
78
+
88
79
  /** @type {import('ol/Map').default} */
89
80
  (eoxMap.value?.map)?.on("moveend", handleMoveEnd);
90
81
 
@@ -94,24 +85,15 @@ onMounted(() => {
94
85
  [selectedStac, datetime],
95
86
  async ([updatedStac, updatedTime], [previousSTAC, _previousTime]) => {
96
87
  if (updatedStac) {
97
- const parentCollUrl = toAbsolute(
98
- `./${updatedStac.id}/collection.json`,
99
- eodashConfig.stacEndpoint,
100
- );
101
88
  const collectionUrls = extractCollectionUrls(
102
89
  selectedStac.value,
103
- parentCollUrl,
90
+ currentUrl.value,
104
91
  );
105
- /** @type {import("@/utils/eodashSTAC").EodashCollection[]} */
106
- const eodashCollections = [];
107
- collectionUrls.forEach((cu) => {
108
- eodashCollections.push(new EodashCollection(cu));
109
- });
110
- const uid = function () {
111
- return (
112
- Date.now().toString(36) + Math.random().toString(36).substring(2)
113
- );
114
- };
92
+
93
+ const eodashCollections = collectionUrls.map(
94
+ (cu) => new EodashCollection(cu),
95
+ );
96
+
115
97
  const layersCollection = [];
116
98
  const dataLayers = {
117
99
  type: "Group",
@@ -120,10 +102,10 @@ onMounted(() => {
120
102
  title: "Analysis Layers",
121
103
  layerControlExpand: true,
122
104
  },
123
- layers: /** @type {object[]}*/ ([]),
105
+ layers: /** @type {Record<string,any>[]}*/ ([]),
124
106
  };
125
- for (let idx = 0; idx < eodashCollections.length; idx++) {
126
- const ec = eodashCollections[idx];
107
+
108
+ for (const ec of eodashCollections) {
127
109
  let layers;
128
110
  if (updatedTime) {
129
111
  layers = await ec.createLayersJson(new Date(updatedTime));
@@ -136,55 +118,39 @@ onMounted(() => {
136
118
  }
137
119
  // Add expand to all analysis layers
138
120
  dataLayers.layers.forEach((dl) => {
139
- // @ts-expect-error no type definition for eox-map config
140
121
  dl.properties.layerControlExpand = true;
141
- // @ts-expect-error no type definition for eox-map config
142
122
  dl.properties.layerControlToolsExpand = true;
143
123
  });
144
124
 
145
125
  layersCollection.push(dataLayers);
146
- // TODO: add base layers and overlays as defined in the top collection / indicator
147
- // Probably best also to introduce background and overlay groups
148
- // For now adding OSM as background
149
- const indicator = new EodashCollection(parentCollUrl);
126
+ const indicator = new EodashCollection(currentUrl.value);
150
127
  const indicatorLayers = await indicator.buildJsonArray(
151
128
  // @ts-expect-error we pass a collection instead of an item, we want to reuse the layer extraction logic
152
129
  selectedStac.value,
153
- false,
154
- false,
130
+ currentUrl.value,
131
+ selectedStac.value?.title ?? "",
132
+ selectedStac.value?.endpointtype ?? false,
155
133
  );
134
+
156
135
  const baseLayers = {
157
136
  type: "Group",
158
137
  properties: {
159
138
  id: uid(),
160
139
  title: "Base Layers",
161
140
  },
162
- layers: /** @type {object[]}*/ ([]),
163
- };
164
- const overlayLayers = {
165
- type: "Group",
166
- properties: {
167
- id: uid(),
168
- title: "Overlay Layers",
169
- },
170
- layers: /** @type {object[]}*/ ([]),
141
+ layers: /** @type {Record<string,any>[]}*/ ([]),
171
142
  };
172
- if (indicatorLayers && indicatorLayers.length > 0) {
173
- baseLayers.layers.push(
174
- ...indicatorLayers.filter(
175
- // @ts-expect-error group is added by the buildJsonArray
176
- (l) => l.properties.group === "baselayer",
177
- ),
178
- );
143
+
144
+ const indicatorBaseLayers = indicatorLayers.filter(
145
+ (l) => l.properties.group === "baselayer",
146
+ );
147
+ if (indicatorBaseLayers.length) {
148
+ baseLayers.layers.push(...indicatorBaseLayers);
149
+
179
150
  // Add exclusive to baselayers and make sure only one is selected
180
151
  baseLayers.layers.forEach((bl) => {
181
- // @ts-expect-error no type definition for eox-map config
182
152
  bl.properties.layerControlExclusive = true;
183
153
  });
184
- overlayLayers.layers.push(
185
- // @ts-expect-error group is added by the buildJsonArray
186
- ...indicatorLayers.filter((l) => l.properties.group === "overlay"),
187
- );
188
154
  } else {
189
155
  // Default to some baselayer
190
156
  baseLayers.layers.push({
@@ -192,28 +158,34 @@ onMounted(() => {
192
158
  properties: {
193
159
  id: "osm",
194
160
  title: "Background",
161
+ layerControlExclusive: true,
195
162
  },
196
163
  source: {
197
164
  type: "OSM",
198
165
  },
199
166
  });
200
167
  }
201
- if (baseLayers.layers.length > 0) {
168
+
169
+ if (baseLayers.layers.length) {
202
170
  layersCollection.push(baseLayers);
203
171
  }
204
- if (overlayLayers.layers.length > 0) {
205
- layersCollection.unshift(overlayLayers);
206
- }
207
172
 
208
- // TODO: we can check if the collection / indicator has a specific
209
- // projection it wants to be displayed in the map we can register
210
- // and set the attribute here, e.g. like following
211
- /*
212
- (el)?.registerProjection(
213
- 'EPSG:3031','+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +type=crs'
173
+ const overlayLayers = {
174
+ type: "Group",
175
+ properties: {
176
+ id: uid(),
177
+ title: "Overlay Layers",
178
+ },
179
+ layers: /** @type {Record<string,any>[]}*/ ([]),
180
+ };
181
+
182
+ const indicatorOverlays = indicatorLayers.filter(
183
+ (l) => l.properties.group === "overlay",
214
184
  );
215
- (el)?.projection = "EPSG:3031";
216
- */
185
+ if (indicatorOverlays.length) {
186
+ overlayLayers.layers.push(...indicatorOverlays);
187
+ layersCollection.unshift(overlayLayers);
188
+ }
217
189
 
218
190
  /** @type {any} */
219
191
  (eoxMap.value).layers = layersCollection;
@@ -236,7 +208,6 @@ onMounted(() => {
236
208
  const reprojExtent = transformExtent(
237
209
  sanitizedExtent,
238
210
  "EPSG:4326",
239
- // @ts-expect-error we should expect to have the view here
240
211
  eoxMap.value?.map?.getView().getProjection(),
241
212
  );
242
213
  /** @type {any} */
@@ -88,7 +88,7 @@ const copyBtns = [
88
88
 
89
89
  const mapStepCode = computed(() => {
90
90
  const [x, y, z] = mapPosition.value;
91
- const preTag = "### <!--{ layers=";
91
+ const preTag = "### <!" + "--{ layers=";
92
92
  const endTag = `zoom="${z}" center=[${[x, y]}] animationOptions={duration:500}}-->
93
93
  #### Tour step title
94
94
  Text describing the current step of the tour and why it is interesting what the map shows currently
@@ -98,7 +98,8 @@ Text describing the current step of the tour and why it is interesting what the
98
98
  const mapEntryCode = computed(() => {
99
99
  const [x, y, z] = mapPosition.value;
100
100
  const preTag =
101
- '## Map Example <!--{as="eox-map" style="width: 100%; height: 500px;" layers=';
101
+ "## Map Example <!" +
102
+ '--{as="eox-map" style="width: 100%; height: 500px;" layers=';
102
103
  const endTag = `zoom="${z}" center=[${[x, y]}] }-->`;
103
104
  return `${preTag}'${JSON.stringify(props.getLayers())}' ${endTag}`;
104
105
  });