MapStore Legend / Select plugins

83 views
Skip to first unread message

arxit

unread,
Mar 31, 2025, 9:35:32 AMMar 31
to mapstore-developers
Hello Mapstore-Developers,

We are pleased to announce that, on behalf of one of our clients, we have developed two MapStore plugins :
  • DynamicLegend : floating panel proposing a dynamic legend of the active layers
    • Legend is adapted considering : selected layers in TOC plugin, scale dependent visibility and even multi-symbols legend (hiding symbols not visible in the current map extent)
    • Supported layers : same as TOC plugin (some components are reused)
    • Legend is ordered the same way as in TOC (including group/subgroups)
    • Plugin support adding/removing layers on the fly
legend.png
  • Select : floating panel proposing some selection tools
    • Select by point, line, polygon, circle
    • Support WFS, WMS and ArcGIS Map Server
    • Define on which layer performing the selection (layers are ordered the same way than in TOC)
    • Contextual menu on resulting features : zoom, stats, export (GeoJson, Json, CSV), create layer with selected features, filter layer on selected features
select.png

For the moment these have been developed as MapStore extensions to ease the testing/validation but our client would like to have them as core plugins in GeoNode.
If community is agreed with that, what would be the process ? Should we create a dvpt branch ? on which project ? (MapStore, MapStore-client …)

Please consider also the following : we have made some minor modifications on some MapStore core files (list below, mainly TOC plugin components) to enhance them for supporting these new plugins functionalities. For the moment, these modified files have been duplicated in the extension code but I guess these modifications should be reviewed on integrated in the originals components (or in more “global” components) to avoid any code duplication !? (with non-regression testing obviously)

plugins\TOC\components\DefaultLayer.jsx
plugins\TOC\components\DefaultLayerOrGroup.jsx
plugins\TOC\components\ArcGISLegend.jsx
plugins\TOC\components\StyleBasedWMSJsonLegend.jsx
plugins\TOC\components\Legend.jsx
utils\FilterUtils.js

For Legend plugin purpose: we propose to add a specific LegendIsDynamic Boolean parameter in TOC plugin. Set to false by default in TOC plugin (to avoid any regression) and true in dynamicLegend plugin. That also means that users could also have this kind of dynamic legend directly in TOC plugin if they want

For select plugin, it can be more complex as TOC components modifications are deeper and really specific to selection tools (adding selected features number + contextual menu on each layer).
We see several options :
  • Option 1 : same as legend plugin, with a boolean (in/out of select plugin) … not really smart for me, putting a lot of SelectPlugin specific code in TOC component where it has nothing to do (as opposed to legend)
  • Option 2 : use in Select plugin the TOC components as they are today and, after select plugin load, modify them dynamically into the Select plugin DOM
  • Option 3 : make some change in TOC components adding functions to allow “other plugins” to programmatically add some extra features in component objects (i.e. extra text / extra buttons)
  • Option 4 : finally duplicate these components in Select plugin
Best regards
Julien

Tobia Di Pisa

unread,
Apr 1, 2025, 5:52:44 AMApr 1
to mapstore-...@googlegroups.com
Dear Julien,

Thank you so much for writing to the mailing list and your intention to contribute to MapStore. This is really appreciated.
I would like to start involving the MapStore core team for supporting you on that really soon.
For a better handling of your contribution for the two new plugins, we may consider to open 2-3 issues on MapStore depending on the case. Let's evaluate it better later as soon as the core team has the opportunity to exchange with you for needed clarifications. Stefano Bovio will follow this email to ask you what we need precisely for that purpose.

Thank you so much again.

Best regards,
     Tobia Di Pisa


--
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, visit https://groups.google.com/d/msgid/mapstore-developers/856e4bc8-d4b8-4915-a406-9700c8a22d83n%40googlegroups.com.


--


==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.
==
Dott. Ing. Tobia Di Pisa
Technical Lead / Project Manager


GeoSolutions Group
phone: +39 0584 962313

mobile: +39 340 1781783
fax:      +39 0584 1660272

https://www.geosolutionsgroup.com/
http://twitter.com/geosolutions_it
-------------------------------------------------------


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

Stefano Bovio

unread,
Apr 4, 2025, 7:12:03 AMApr 4
to mapstore-...@googlegroups.com
Dear Julien,

If possible it would be helpful if you can share the code changes you included in the extension, in particular the one related to the core. In the meantime I would like to clarify a few points related to the changes on the core.
I'm starting from the select plugin because it seems to include more changes. If I understand correctly you are using the TOC component and adding new tools inside the layer node on the same line of title and visibility check. The TOC component should already support injection of additional tools with the nodeToolItems prop, below and example of a Test plugin using the TOC component and adding new tools:

import React from 'react';
import { createPlugin } from '../utils/PluginsUtils';
import TOC from './TOC/components/TOC';
import { DropdownButton, Glyphicon, MenuItem } from 'react-bootstrap';
import { connect } from 'react-redux';

const myAction = () => ({
    type: 'MY_ACTION'
});

const MyCustomTestTools = connect(
    () => ({}),
    {
        onAction: myAction
    }
)(({
    node,
    nodeType,
    nodeTypes,
    onAction
}) => {
    if (nodeType === nodeTypes.LAYER) {
        const layer = node;
        return (
            <div className="ms-my-custom-test-tools">
                <span>{layer?.extendedParams?.featuresCount}</span>
                <DropdownButton
                    noCaret
                    pullRight
                    title={<Glyphicon glyph="option-vertical" />}
                >
                    <MenuItem onClick={() => onAction(layer)}>My action</MenuItem>
                </DropdownButton>
            </div>
        );
    }
    return null;
});

function Test({}) {

    const map = {
        layers: [{ id: '01', type: 'wms', title: 'My WMS Layer', url: '', name: '', visibility: true, extendedParams: { featuresCount: 10 }  }],
        groups: []
    };

    const nodeToolItems = [{ name: 'MyCustomTestTools', Component: MyCustomTestTools }];

    return (
        <TOC
            map={map}
            nodeToolItems={nodeToolItems}
        />
    );
}

export default createPlugin('Test', {
    component: Test
});


Here the results:
 image.png

It needs a bit of styling but using const nodeToolItems = [{ name: 'MyCustomTestTools', Component: MyCustomTestTools }]; you can already pass additional tools to TOC nodes with the following advantages:

- MyCustomTestTools receive props with information of the current node so you are able to display it for specific conditions
- MyCustomTestTools is part of the Test plugin (in your case Select plugin) so it could be connected to the state to get additional props or dispatch specific actions

I've only noticed that probably we need a small fix on the TOC styles because there are conflicts about the ul dropdown menu and ul used inside for TOC nodes (it should be enough to add a :not(.dropdown-menu) to ul used in toc.less style)

Could you check if the above approach could work for you Select plugin?

The second feedback is related to the changes of the Legend components and FilterUtils, in this case it's difficult to help without seeing the code but I would like to highlight that the core already has support for GeoServer WMS Filtering and an implementation of  of interactive legends for WMS, WFS and Vector layers now enabled only when experimentalInteractiveLegend is true (this flag will be removed soon). For this part we need to make sure there aren't conflicts between the two implementations.

Hope this helps,
Thanks,

Stefano





--
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, visit https://groups.google.com/d/msgid/mapstore-developers/856e4bc8-d4b8-4915-a406-9700c8a22d83n%40googlegroups.com.


--

Regards,

Stefano Bovio

==

GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

==

Stefano Bovio

Frontend Software Engineer


GeoSolutions Group
phone: +39 0584 962313

arxit

unread,
Apr 17, 2025, 10:15:03 AMApr 17
to mapstore-developers
Dear Stefano,

Sorry for late answer.
Thanks for your reply and for the suggestions.
For select, we've started refactoring our code to match the proposed method (with the nodeToolItems prop). It's actually what we think is the cleanest and, a priori, it could work for our Select plugin.

For the legend plugin, we weren't aware of the experimentalInteractiveLegend property.
Anyway, the need is not quite the same, our plugin is really complementary to the TOC, the idea being to 'just' display in a specific panel the "legend part" of the selected/visible TOC layers, without any possible interaction for the user (but with a dynamic legend that adapts according to the selected layer, visibility scale, map extent...).
Considering this, we initially reused the TOC component, in particular to avoid redeveloping the group/layer tree, which must be consistent between TOC and Legend.
I realise it's a bit complicated to explain ... Perhaps the best thing would be, as you suggest, to do a joint review of the code.
If it's ok with you, I can forward your contact to my colleague who did the development so that he can show you?

Best
Julien

Tobia Di Pisa

unread,
Apr 23, 2025, 5:02:13 AMApr 23
to mapstore-...@googlegroups.com
Dear Julien,

Thank you so much for your reply. At this stage, before exchanging further in details with the community regarding your contribution for the aforementioned plugins, I kindly ask you to consult the community bylaws and follow the indications there reported. This includes the definition of issues, I would say at least two issues one per plugin you would like to contribute, where all requirements and expected functionalities are well reported and described including also what would be the proposed design for the UI/UX part. After this it will be possible to better exchange with you by following procedures and guidelines reported in the contributing rules.
I would take this opportunity to thank you again for supporting the MapStore project and its community with your contributions.

 Best regards,
     Tobia Di Pisa


--


==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.
==

Dott. Ing. Tobia Di Pisa
Technical Lead / Project Manager

GeoSolutions Group
phone: +39 0584 962313

mobile: +39 340 1781783
fax:      +39 0584 1660272


https://www.geosolutionsgroup.com/
http://twitter.com/geosolutions_it
-------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages