Skip to content

Eodash Store

eodash fetches the SpatioTemporal Asset Catalog (STAC) endpoint assigned in the client configuration, navigates through its links, and assigns the result to its store. The store is then exposed to users, giving them the ability to read or modify the state of the dashboard at runtime.

The store is divided into three areas:

  • states - reactive values that drive the dashboard. They use the Vue reactivity system, so reading or writing a state updates the interface accordingly.
  • actions - functions that operate on the states, either by fetching new data or by triggering changes to existing states.
  • stac - a Pinia store that holds the STAC catalog navigation: the root catalog links, the selected STAC object, and the actions to load them.

States - store.states

PropertyTypeDescription
currentUrlRef<string>Currently selected STAC endpoint
currentCompareUrlRef<string>Currently selected compare STAC endpoint
datetimeRef<string>Currently selected datetime
indicatorRef<string>Currently selected indicator
compareIndicatorRef<string>Currently selected compare indicator
mapPositionRef<(number | undefined)[]>Current map position
registeredProjectionsstring[]
availableMapProjectionRef<string>available projection to be rendered by EodashMap
mapElRef<EOxMap | null>
mapCompareElRef<EOxMap | null>
activeTemplateRef<string>
poiRef<string>Selected point of interest, used for location collections
comparePoiRef<string>Selected point of interest for comparison, used for location collections
isGlobeRef<boolean>Whether the map is in globe mode
areChartsSeparateLayoutRef<boolean>Whether the charts are in fullscreen mode
chartDataRef<Record<string,any>|null>Holds main chart data
compareChartDataRef<Record<string,any>|null>Holds compare chart data
chartSpecRef<VisualizationSpec | null>Holds main chart spec
compareChartSpecRef<VisualizationSpec | null>Holds compare chart spec

Actions - store.actions

ActionSignatureDescription
getLayers()Returns the current layers of mapEl
getCompareLayers()Returns the current layers of mapCompareEl
registerProjection(projection) => PromiseRegister EPSG projection in eox-map
changeMapProjection(projection) => PromiseChange eox-map projection from an EPSG projection
setActiveTemplate(template)
includesProcess(collection, compare?)Check whether the collection needs an EodashProcess Widget
shouldShowChartWidget(compare?)Check whether main or compare chart have data to show

STAC store - store.stac.useSTAcStore()

The STAC catalog navigation pinia store. Call store.stac.useSTAcStore() to access these properties.

PropertyTypeDescription
stacEndpointRef<string| null>STAC catalog endpoint URL
isApiRef<boolean>
stacRef<StacLink[] | null>Links of the root STAC catalog
init(endpoint)Initializes the store by assigning the STAC endpoint.
loadSTAC(url) => PromiseFetches root stac catalog and assign it to stac
loadSelectedSTAC(relativePath?, isPoi?, stacItem) => PromiseFetches selected stac object and assign it to selectedStac
loadSelectedCompareSTAC(relativePath?, isPOI?) => PromiseFetches selected stac object and assign it to selectedCompareStac
resetSelectedCompareSTAC() => PromiseReset selected compare stac object
selectedStacRef<StacCollection | null >Selected STAC object.
selectedCompareStacRef<StacCollection | null >Selected STAC object.
selectedItemRef<StacLink | StacItem | null>Currently selected item
supportedUpscalingEndpointsRef<string[]>List of supported endpoints for upscaling

URL Query Parameters

A subset of the states is mirrored to the URL query string, so a dashboard can be deep-linked and restored to a specific view. On load these parameters are read into the store; while the user navigates they are written back, keeping the URL shareable.

ParameterStateDescription
templateactiveTemplateThe active template id.
indicatorindicatorThe selected dataset (sub-code id of a STAC link).
poipoiPoint of interest passed to the dataset's process service.
x, y, zmapPositionMap center longitude, latitude, and zoom.
datetimedatetimeSelected date (YYYY-MM-DD).

Importing the store

The same store API is exported from several entry points; pick the one that matches how the dashboard is configured.

ConfigurationImport
Build-time (SPA)import { store } from "@eodash/eodash"
Web component inside a bundled appimport { store } from "@eodash/eodash/webcomponent"
Runtime (config.js)const store = window.eodashStore
Runtime (web component build)import { store } from "/.eodash/dist/eo-dash.js"