3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
254 stars 143 forks source link

[Question]: Custom filter on inherited layer #4659

Open corentin-teyssier opened 1 month ago

corentin-teyssier commented 1 month ago

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 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 :

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

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 commented 1 month ago

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 ?