Closed gioman closed 1 year ago
Can you check your QGIS server logs ? You should see the expression being evaluated. Maybe it gives an hint.
It works well on the test project form_edition_value_relation_field.qgs
2023-10-18 13:52:19,680 DEBUG [57] Qgis: Lizmap: Fetching /srv/projects/tests/form_edition_value_relation_field.qgs.cfg cfg file with last modified timestamp : 1697636723.2394717
2023-10-18 13:52:19,680 DEBUG [57] Qgis: Lizmap: No acl defined in Lizmap config
2023-10-18 13:52:19,680 DEBUG [57] Qgis: Server: FIELDS:code,label
2023-10-18 13:52:19,680 DEBUG [57] Qgis: Server: FILTER:intersects($geometry, centroid(@current_geometry))
2023-10-18 13:52:19,680 DEBUG [57] Qgis: Server: FORM_FEATURE:{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[0.305070750024655,47.89601575850115],[1.5291213472474636,47.53621582892768],[0.9111540554456543,46.776610723827396],[0.305070750024655,47.89601575850115]]]},"properties":[]}
Versions :
@Gustry
15:12:05 INFO Server[3596]: FIELDS:distrito,distrito
15:12:05 INFO Server[3596]: FILTER:intersects($geometry, centroid(@current_geometry))
15:12:05 INFO Server[3596]: FORM_FEATURE:{"type":"Feature","geometry":null,"properties":[]}
15:12:05 INFO Server[3596]: LAYER:distritos
15:12:05 INFO Server[3596]: LIZMAP_OVERRIDE_FILTER:1
15:12:05 INFO Server[3596]: LIZMAP_USER:admin
15:12:05 INFO Server[3596]: LIZMAP_USER_GROUPS:admins
15:12:05 INFO Server[3596]: MAP:/mnt/lm_repos/repo1/teste2.qgs
15:12:05 INFO Server[3596]: REQUEST:getFeatureWithFormScope
15:12:05 INFO Server[3596]: SERVICE:EXPRESSION
15:12:05 INFO Lizmap[3596]: Request headers provided
15:12:05 INFO Lizmap[3596]: No lizmap user groups in request headers
15:12:05 INFO Lizmap[3596]: Lizmap user groups in parameters : admins
15:12:05 INFO Lizmap[3596]: Request headers provided
15:12:05 INFO Lizmap[3596]: No lizmap user login in request headers
15:12:05 INFO Lizmap[3596]: Lizmap user login in parameters : admin
15:12:05 INFO WfsOutputExtension[3596]: responseComplete ran in 0.0s
15:12:05 INFO Server[3596]: Request finished in 225 ms
Version 3.6.6 Date 2023-10-04 QGIS Server Version Number 3.28.11 Name Firenze Commit ID b02458a196 Py-QGIS-Server not used Plugins Plugin Version atlasprint 3.3.2 Lizmap server 2.8.1 wfsOutputExtension 1.8.0
15:12:05 INFO Server[3596]: FILTER:intersects($geometry, centroid(@current_geometry)) 15:12:05 INFO Server[3596]: FORM_FEATURE:{"type":"Feature","geometry":null,"properties":[]}
So indeed, the geometry is not sent (null
) to QGIS server for evaluation
But I was not able to replicate with dataset provided in #3931
But I was not able to replicate with dataset provided in #3931
@Gustry I tried with the table quartiers and sousquartiers as defined here (but both on epsg 2154 as in your dataset quartiers is in 4326 and so the expression would anyway fail without transforming the features)
and I see the same (means the combo-box is not populated). Seems there is something else at play. Would you mind share your .qgs and .cfg (I can do manually the necessary changes)?
Would you mind share your .qgs and .cfg (I can do manually the necessary changes)?
It's in the PR, which is based on my fork : https://github.com/Gustry/lizmap-web-client/tree/centroid
It's this test project : https://demo.snap.lizmap.com/lizmap_3_7/index.php/view/map?repository=testsrepository&project=form_edition_value_relation_field
But I haven't transfered the new polygon layer from the PR #3931
I can give it a try on 3.6, sorry.
It's in the PR, which is based on my fork : https://github.com/Gustry/lizmap-web-client/tree/centroid
@Gustry your data and my data work with your project, so I'm definitely lost as I can't see any major difference in the project configs and .cfg configs.
I'll close because is definitely something on my side (does not means there is anything wrong with my installation, but there is something interfering at a project level).
No problem, it's not easy to debug and/or to hit the bottleneck sometimes.
At least, I could try the polygon with a centroid, which should be a common use case.
What is the bug?
Following the example here https://docs.lizmap.com/current/en/publish/layer_properties/attributes_form.html for a value relation/filter, and when the layer being edited is a point layer the example provided works.
When trying with a polygon and its centroid it doesn't work, the combobox remains unpopulated (works in QGIS):
intersects($geometry, centroid(@current_geometry))
Steps to reproduce the issue
Follow the example for a value relation/filter as described here https://docs.lizmap.com/current/en/publish/layer_properties/attributes_form.html but use a polygon layer instead of a point one, and this expression
intersects($geometry, centroid(@current_geometry))
Versions
LMWC 3.6.6
Check Lizmap plugin
QGIS server version, only if the section above doesn't mention the QGIS Server version
3.28..1
Operating system
Ubuntu 22.04
Browsers
Firefox, Chrome
Browsers version
Latest updates
Relevant log output
No response