[Qgis-user] QGIS Server GetFeatureInfo custom CSS (or better: templates!)

Carles Vico Blanco carles.vico at geografos.org
Mon Apr 20 00:15:47 PDT 2015


Thanks a lot for your work Alessandro! Simple filter for a big
problem! Finally we have apply our styles to the GetFeatureInfo response
with your GetFeatureInfoCSSFilter.py, where we have directly insert the CSS
parameters (without templates).
Now, we need to increase the control about this GetFeatureInfo response in
two ways:

The first case is that, the attributes of my layers who are URL (http://...)
can be understood as links for the QGIS Server and displayed with
linkstyles that I've been included in the GetFeatureInfoCSSFilter.

The second is that, the response of my GetFeatureInfo request, for now show
me all the layers of my QGSProject, included the layers with NO INFO
values at the point of my request (show me only the header of the atributte
table, without info). How can I do that the response hide the headers of
the attribute table layers with NO INFO values?

Any Filter? Templates?

I have seen that in the Web Client you can modify the globaloptions.js to
setup some of this, but I'm not sure they take effect in the QGIS Server
response, outside Web Client.

Thanks
Carles Vico


2015-04-10 12:47 GMT+02:00 Alessandro Pasotti <apasotti at gmail.com>:

> 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
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150420/de7881ba/attachment.html>


More information about the Qgis-user mailing list