[Qgis-developer] Expression variables in QGIS server

Tom Palan thomas at palan.at
Fri Feb 26 10:27:01 PST 2016


hi andreas,

thanks but I tried with 2.12.3 and master.
I also can confirm now that no project variables are added to the expression-scope (qgsexpressioncontext.cpp:592) when executing a server request. I added this line:

fprintf(stderr,"var: %s val: %s\n",variableName.toAscii().data(),varValueString.toAscii().data()); 

after 
592: scope->setVariable( variableName, varValueString );

and I get the correct output when I load the project in QGIS desktop, but nothing when executing qgis_mapserv.fcgi with a working QUERY_STRING from the command line. The output is correct, but all expressions are missing.

Can anybody confirm that those project-variables work in server?

thanks,
Tom


On Fri, Feb 26, 2016 at 05:48:21PM +0100, Neumann, Andreas wrote:
> Hi Tom, 
> 
> The project variables should work fine in server context. 
> 
> Are you sure that the QGIS server you use is really up-to-date? 
> 
> The variable support in QGIS is relatively recent and if your server is
> an older version it probably doesn't support them. 
> 
> Andreas 
> 
> On 2016-02-26 17:34, Tom Palan wrote:
> 
> > hi,
> > 
> > I was trying to implement dynamic setting of Expression Variables when handling server requests (Example use case: I want to render another logo in a composition map depending on a project-variable), as I got stuck testing the behaviour of expression variables in server-requests.
> > I have a print composition map, where a label text is set to a project scope expression variable. When I execute the server request the label is not printed (or printed empty).
> > 
> > Does QGIS server not use expression variables defined at project level?
> > 
> > thanks,
> 
>   

-- 
Tom Palan
palan3 IT solutions OG
Grillenbergstr. 4
A-4407 Dietach
Tel.: +43 (0) 680 3280940


More information about the Qgis-developer mailing list