I'm trying use GetPrint request with QGIS Server and I find feature that you can assign value of function to label (with id) ex.

http://qgis.local/cgi-bin/qgis_mapserv.fcgi?MAP=/home/mario/wms.qgs&VERSION=1.3.0&SERVICE=WMS&SRS=EPSG:4326&REQUEST=GetPrint&LAYERS=wms&STYLES=&FORMAT=png&TEMPLATE=Template1&field1=[%25 now() %25]

Result of GetPrint request with function in label expression

From QGIS 2.8 there is possibility to make your own function so I try with built-in custom function func(value1)

http://qgis.local/cgi-bin/qgis_mapserv.fcgi?MAP=/home/mario/wms.qgs&VERSION=1.3.0&SERVICE=WMS&SRS=EPSG:4326&REQUEST=GetPrint&LAYERS=wms&STYLES=&FORMAT=png&TEMPLATE=Template1&field1=[%25 func('a') %25] Result of GetPrint request with custom function in label expression

Is there way to make it work?


The custom registered functions don't get propagated at the server level. One way to make the server know about your custom function is to write a server plugin and register your expression in the class factory.

More details here: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-Custom-python-expressions-in-QGIS-Server-td5362875.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.