ClickUpdatePlot

74 views
Skip to first unread message
Assigned to lorenzo...@geosolutionsgroup.com by me

Gabriel Molina Perez

unread,
May 8, 2024, 8:35:33 AM5/8/24
to mapstore-developers
Hello, Group.
I have a standard MapStore project implemented with GeoServer integrated. And I'm working with the "widgets" plugin to generate time series graphs. I was wondering if there is a way to update those types of graphics when clicking on the map layer.
Currently, the chart updates based on the features that appear in the map window. It would be something similar, but by clicking on the entity.

Lorenzo Natali

unread,
May 13, 2024, 6:37:26 AM5/13/24
to mapstore-developers
Hi, 
actually it is not possible, but it could be a cool improvement. For the current implementation, it could require for sure some override of core parts. 

The widget filtering works over a dependency system that is a little complex. There are some functions like "dependenciesToFilter" functions that take care of that.
In order to implement them, you need to provide:
- the logic to retrieve the data about the selected point (now only other widgets or "map" state is supported) and properly update when necessary
- The logic and UI to configure this dependency
- The logic to transform this data in a filter ( `dependenciesToFilter` ). 

Hope this helps you to understand the general problem. 

Gabriel Molina Perez

unread,
Jun 18, 2024, 3:04:34 AM6/18/24
to mapstore-developers

Hello, Lorenzo.

First, I apologize for the delay in responding.

I don't have much experience programming with MapStore. The idea is to implement the functionality for my thesis, but I can't dedicate 100% of my time to it. I've researched a bit about the logic for data retrieval, and I'm a bit confused, possibly due to my lack of experience.

I noticed there is an epic that seems to perform an extraction on the click point:

javascript
Copiar código
MapStore2/web/client/epics/search.js 

export const delayedSearchEpic = (action$) =>
    action$.ofType(SCHEDULE_SEARCH_LAYER_WITH_FILTER)
        .switchMap(({layer: name, "cql_filter": cqlFilter}) => {
            return action$.ofType(ADD_LAYER)
                .filter(({layer}) => layer.name === name)
                .take(1)
                .switchMap(() => {
                    return Rx.Observable.of(searchLayerWithFilter({layer: name, "cql_filter": cqlFilter}));
                });
        });

But I wouldn't know how to implement small functions to check what it returns. 

Could you point me to any specific documentation to learn?


de nuevo, gracias por tu tiempo.

Lorenzo Natali

unread,
Jun 20, 2024, 5:27:27 AM6/20/24
to mapstore-...@googlegroups.com
Hi,
this action works with a completely different tool, regarding the search tool, not related with the widgets.
In general the epics are grouped in files by scope. 
So in `actions/search.js`, `epics/search.js` and  you will find actions and epics that related to the search functionalities (like the one above) while in `actions/widgets.js` and `epics/widgets.js` `reduers/widgets.js` (or `plugins/widgets.js`) you will find the code related to widgets.

As I said, It is not a trivial task because :
- all the widgets are interoperating with each other. In the dashboard for instance you can connect different maps to different widgets, the table filter interacts with the other selections and so on. 
- chart widgets can have different traces (charts) depending on different layers

Here in JSDoc you can get some information about how it is managed:


and here the file I mentioned in my previous email:



--
You received this message because you are subscribed to the Google Groups "mapstore-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstore-develo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mapstore-developers/5cdfffe3-824b-4196-bf6f-3464a5abababn%40googlegroups.com.

Gabriel Molina Perez

unread,
Dec 19, 2024, 11:57:38 AM12/19/24
to mapstore-developers

Hello, I’ve made some progress on the topic. For now, the widget constructor supports changing when clicking on a map element, and the logic to retrieve and convert the recovered data into a filter works. However, when the widgets are displayed, they don’t update on click; I have to pan the map slightly for the changes to load. Lastly, I can’t figure out how to pass properties to the createFilterProps function. Do you have any ideas or documentation I can review?
Grabación de pantalla desde 2024-12-19 17-20-27.webm
Captura desde 2024-12-19 17-31-34.png

Gabriel Molina Perez

unread,
Jan 13, 2025, 3:45:06 AMJan 13
to mapstore-developers

Hello, it seems that I already got it, but only for the maps. It doesn't work on the dashboard.
Grabación de pantalla desde 2025-01-10 18-21-18.webm

Lorenzo Natali

unread,
Jan 13, 2025, 4:12:35 AMJan 13
to mapstore-...@googlegroups.com
Interesting,
if you can make the last clicked point a dependency, like for viewport, you an imagine to refer to that dependency with something like map.lastClickedPoint or widgets["<id>"].lastClickedPoint (or something similar that fits best to you).
Then on lastClickedPoint update, you can trigger the reload, filtered with point intersection. 
This should help you to get the right abstraction to support both main map and widgets.

I can not follow you in development, but I hope it helps

Reply all
Reply to author
Forward
0 new messages