qgis / qwc2-demo-app

QWC2 demo application
Other
240 stars 149 forks source link

Questions regarding MapFilter #543

Closed cazitouni closed 3 months ago

cazitouni commented 3 months ago

Hello I got a ew questions regarding the new mapfilter plugins.

First, using the related config in my tenantconfig theme I got an error

  "predefinedFilters": {
                "id": "quartier",
                "title": "Quartier",
                "titlemsgid": "quartier",
                "filter": {
                  "quartier": ["nom_commune", "=", "quartier_choix"]
                },
                "fields": {
                  "id": "quartier_choix",
                  "title": "Choix du quartier",
                  "titlemsgid": "quartier_choix",
                  "defaultValue": "Neuhof - Meinau",
                  "inputConfig": {"type": "select", "options": [{"Neuhof - Meinau": "Neuhof - Meinau", "Neudorf": "Neudorf"}]}
                }
              }

This is the related error when opening the theme

TypeError: (e.predefinedFilters || []).filter is not a function
    at Object.createThemeLayer (ThemeUtils.js:136:64)
    at et (theme.js:51:35)
    at theme.js:231:13
    at redux-thunk.mjs:5:14
    at n.<computed> [as setCurrentTheme] (react-redux.mjs:352:47)
    at StandardApp.jsx:152:36
    at b (PermaLinkUtils.js:134:9)
    at StandardApp.jsx:100:13

Probably I've done something wrong within the config but can't figure what, also I would like to know the correct way to reference the field variable within the filter expresion should I just use "field_id" or is it something special like "$TEXT$" used in the Qgis search plugin ?

Thansk in advance for your answer and also for the implementation of this nice feature. Kind regards, Clément.

manisandro commented 3 months ago

Apologies, there was a mistake in the documentation: predefinedFilters should be an array - fixed now. Regarding the placeholder values, it is $field_id$. I've also improved the documentation in this regard.

cazitouni commented 3 months ago

Thanks it now works great. Also I would have another question regarding the geometry filter.

When applying the circle, shouldn't all the ellement outside be filtered

circle

It doesnt seems to do much and no error is returned in the console. I use the docker version if that's matter.

Also i've tested temporal dimension and it worked great.

Thansk for your answers .

manisandro commented 3 months ago

Do you see a FILTER_GEOM in the GetMap request? Is the layer a Postgis layer? Do you have the filter_geom QGIS server plugin enabled?

cazitouni commented 3 months ago

Ok it's a geopackage that's why, sorry for the dumb question.

I'll close the ticket since everything's fine then.

Thanks again for the quick answers !