[Qgis-developer] QGIS Server GetFeatureInfo custom CSS (or better: templates!)
Alessandro Pasotti
apasotti at gmail.com
Fri Apr 10 03:47:15 PDT 2015
Hi,
there have been some requests in the past about custom CSS for html
GetFeatureInfo responses from QGIS Server.
Currently, the HTML response template is hardcoded and there is no way
to customize it, the Python plugin support introduced with the latest
version of QGIS Server provide some easy ways to add some custom CSS
rules or even provide custom templates.
To get you started, I've added a new filter to my example HelloServer plugin:
https://github.com/elpaso/qgis-helloserver/blob/master/filters/GetFeatureInfoCSSFilter.py
This filter is pretty simple, if the request is a WMS GetFeatureInfo
with HTML format, it injects a STYLE tag into the HTML HEAD.
As an exercise left to the reader, you can also intercept the call in
requestReady(self), change the INFO_FORMAT to text/xml and then do
some real templating, for example by using XSLT or pasrsing the XML
and injecting the values into a custom template.
--
Alessandro Pasotti
w3: www.itopen.it
More information about the Qgis-developer
mailing list