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

QGIS Server WMS GetFeatureInfo does not evaluate represent_value expression in maptip #30719

Closed
mdouchin opened this issue Jul 15, 2019 · 9 comments · Fixed by #50216
Closed
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions Server Related to QGIS server

Comments

@mdouchin
Copy link
Contributor

Describe the bug

When getting HTML GetFeatureInfo response from QGIS Server, for a vector layer with a maptip configured, the represent_value method which replaces the field value with its represented value (for example for Value Relation edit widget) is not evaluated in the server context.

How to Reproduce

  1. Add any vector layer with a QGIS project
  2. Configure an edit widget with Value Map (or value relation, etc.) for example for a category field
  3. Add content in the Maptip tab of the Vector layer properties, with the expression represent_value("category")
  4. In QGIS desktop, the maptip shows the correct value
  5. Publish the QGIS project with QGIS Server, and use the GetFeatureInfo request with HTML format -> the content is wrong and contains plain text containing the word represent_value

QGIS and OS versions

Test with QGIS Server 3.4.9

@mdouchin mdouchin added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jul 15, 2019
@nboisteault
Copy link

Does not work with QGIS Server 3.16.3 neither.

@Gustry Gustry added Expressions Related to the QGIS expression engine or specific expression functions Server Related to QGIS server labels Feb 3, 2021
@elpaso
Copy link
Contributor

elpaso commented May 26, 2021

Any chance to have a test project and data?

@elpaso elpaso added the Feedback Waiting on the submitter for answers label May 26, 2021
@mdouchin
Copy link
Contributor Author

Old issue ;) I need to re-test it and provide QGIS project with test data

@github-actions
Copy link

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale".
If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue.
In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue.
If there is no further activity on this issue, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jul 14, 2021
@mdouchin
Copy link
Contributor Author

@nboisteault or @Gustry do you have any test project ?

@github-actions github-actions bot removed the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jul 16, 2021
@nboisteault
Copy link

I'm currently creating a project.

@nboisteault
Copy link

represent_value.zip

You'll find in this zip a QGIS project with two layers in a geopackage. Use the maptip tool on the only point of point_layer, you'll have first displayed.

Then you can execute this query (change path accordingly) :
QUERY_STRING="MAP=/srv/projects/tests/represent_value.qgs&SERVICE=WMS&REQUEST=GetFeatureInfo&QUERY_LAYERS=point_layer&I=645&J=345&CRS=EPSG:2154&BBOX=749647.283424,6268207.177805,798145.50542,6292178.475747&HEIGHT=906&WIDTH=1833&WITH_MAPTIP=true" /usr/lib/cgi-bin/qgis_mapserv.fcgi
You'll have this result :

GetFeatureInfo results

Layer 'point_layer'
Feature 1
fid = '1'
value = 'first'
maptip = '[%  represent_value(  "value" ) %]'

As you see, expression is not interpreted. I had the same bug with relation_aggregate() too.

Thanks @elpaso for your help.

@gioman gioman removed the Feedback Waiting on the submitter for answers label Jul 24, 2021
@virtusmankind
Copy link

virtusmankind commented Oct 23, 2021

I'm facing same issue with the relation_aggregate function.
QGis server 3.20 does not show popups (with Lizmap web client) nor does it represent the style of the features, created with the relation_aggregate function (rules based style) while it works perfectly with QGis desktop 3.20

@elpaso elpaso self-assigned this Sep 15, 2022
elpaso added a commit to elpaso/QGIS that referenced this issue Sep 15, 2022
elpaso added a commit to elpaso/QGIS that referenced this issue Sep 15, 2022
elpaso added a commit to elpaso/QGIS that referenced this issue Sep 15, 2022
nyalldawson pushed a commit that referenced this issue Sep 15, 2022
qgis-bot pushed a commit that referenced this issue Sep 15, 2022
@mdouchin
Copy link
Contributor Author

Muchas gracias !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions Server Related to QGIS server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants