Bug report #12090

QGIS Server: getFeature expression does not work

Added by Andreas Neumann almost 10 years ago. Updated over 9 years ago.

Status:Closed
Priority:High
Assignee:Marco Hugentobler
Category:QGIS Server
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:20286

Description

It seems like in current master the attribute(getFeature()) expression does not work in a maptip.

I used the following maptip on layer "Langsamverkehrszonen":

-------------
<p><strong>[% "objekt_projektbezeichnung" ]</strong><br/>
Status: [
attribute(getFeature('Status Begegnungszone', 'code', status_t30_begegnungszone),'wert')%]
[%COALESCE,'')%]</p>
-------------

The attribute(getFeature()) expression works fine in QGIS desktop, but does not work in QGIS server. QGIS server does not correctly evaluate the expression.

getFeature_expression_qgis_server_problem.zip - Sample project demonstrating the issue (337 KB) Andreas Neumann, 2015-01-29 02:51 AM

feature_info.png (88 KB) Marco Hugentobler, 2015-02-05 05:40 AM

History

#1 Updated by Andreas Neumann almost 10 years ago

Forgot to mention that this concerns the response of the GetFeature request.

#2 Updated by Giovanni Manghi almost 10 years ago

  • Affected QGIS version changed from 2.6.0 to master
  • Status changed from Open to Feedback

Hi Andreas, is this a regression?

#3 Updated by Andreas Neumann almost 10 years ago

Hi Giovanni,

I don't know if this ever worked. It is the first time I tried this expression in server context. This feature was introduced in QGIS 2.6

But Marco promised to have a look at it.

Andreas

#4 Updated by Marco Hugentobler over 9 years ago

I tested it here, however it seems to work here (unless I overlooked something). E.g. doing a featureinfo at the green polygon of the attached screenshot returns: 'Tempo 30 Zone Brunnenwiesenstrasse
Status: bestehend, in Betrieb Inbetriebnahme: 2012' as maptip field. Isn't this the expected outcome?

#5 Updated by Andreas Neumann over 9 years ago

Hi Marco,

Very strange - it does not work on my QGIS server. I will try on a different machine - or we could have a look at it next week with teamviewer.

btw: hope you feel better again? Heard you are sick at home ...

Thanks,
Andreas

#6 Updated by Marco Hugentobler over 9 years ago

It is probably because I loaded the whole group as WMS layer into QGIS. If you load only 'Langsamverkehrszonen', it will not work, because QGIS cannot know about the two layers in Hilfstabellen.
The correct approach in the server would be to check that before the request (as it is done for joins and value relations). Difficulty is that the expression can be anywhere, not only in the displayfield.

#7 Updated by Marco Hugentobler over 9 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF