Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: Custom filter on inherited layer #4659

Open
1 task done
corentin-teyssier opened this issue Jul 29, 2024 · 1 comment
Open
1 task done

[Question]: Custom filter on inherited layer #4659

corentin-teyssier opened this issue Jul 29, 2024 · 1 comment
Labels

Comments

@corentin-teyssier
Copy link

corentin-teyssier commented Jul 29, 2024

How can i use custom filter on inherited layer

I just started a new job and i get to work with Lizmap to create custom maps for each French region. To achieve this i would like to use the parent/child feature from Lizmap to create a parent project that contains every country scale layer. With a parent project i could create a project for each region with the specific regions layer combined to the inherited layers from the parent project. I tried this and it worked pretty well but ive got an issue with this architecture. I would like to have specific filter for each region on the inherited layers to only show the data for the given region but lizmap only use the parent filter.

I tried multiple solutions but none of them worked :

  • I tried to create a project variable for each region use it in the parent filter. But it seems that i can't interpret a variable in the query builder. (I tried "code_dep IN (@liste_dep) where liste_dep is a variable that contains every departments for a given region)

  • I also tried to write a python macro in Qgis. It worked pretty well in my local Qgis but doesn't execute at all in lizmap. I used the "def openProject()" macro to apply my filter at the start.

I can still do it without using the parent/child feature but it would help me a lot to maintain the whole project.

Thanks in advance for your time and excuse my english im not a native english speaker

Corentin

Versions, safeguards, check summary etc

Versions :

  • Lizmap Web Client : 3.7.9
  • Lizmap plugin : 4.3.19
  • QGIS Desktop : 3.38.0
  • QGIS Server : 3.38.0
  • Py-QGIS-Server : 1.8.8
  • QGIS Server plugin atlasprint : 3.3.2
  • QGIS Server plugin cadastre : 1.17.3
  • QGIS Server plugin lizmap_server : 2.9.4
  • QGIS Server plugin wfsOutputExtension : 1.8.0
List of safeguards :
  • Mode : safe
  • Allow parent folder : no
  • Prevent other drive : yes
  • Prevent PG service : yes
  • Prevent PG Auth DB : yes
  • Force PG user&pass : yes
  • Prevent ECW : yes

Check Lizmap plugin

  • I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.

Operating system

Windows 11 for Qgis Desktop and Ubuntu 22.04 for QgisServer and Lizmap ont the server

Browsers

Chrome

Browsers version

Version 127.0.6533.73

Relevant log output

No response

@corentin-teyssier
Copy link
Author

I'm trying to use custom javascript script to achieve my goal but since i'm not a specialist i'm having difficulties. My task is simple i want to filter ma layer "commune" and keep only the line where the column "departement" is in my list ['30','34'] at the load of the map on lizmap.
I think this premade function is supposed to do something close to what i want : https://github.com/3liz/lizmap-javascript-scripts/blob/master/library/tools/attribute_table_column_filter/attribute_table_column_filter.js
But since i'm not a javascript expert i've got some difficulties to understand the global structure and the object i'm supposed to manipulate.
Can someone help me or advice me to create my filter function please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant