5

GeoServer layers can be configured to be very flexible with parameters in at least these two ways:

  • viewparams pass through to the SQL view (link)
  • time/elevation/custom dimension (link and link)

A sample call would look something like: http://localhost:8080/geoserver/topp/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&STYLES&LAYERS=topp%3Atasmania_cities&SRS=EPSG%3A4326&WIDTH=768&HEIGHT=641&BBOX=145.9588623046875%2C-43.378143310546875%2C148.0682373046875%2C-41.617584228515625&time=2012-10-13T00:00:00.000Z&elevation=1233.47&viewparams=low:20000000 (note: time & elevation & viewparams=low)

In a JavaScript client like OpenLayers or Leaflet, it is easy to add these additional parameters to the WMS request.

In QGIS, it is possible to use the Time Manager (up to v3.12) or the Temporal Controller (after v3.12) to manipulate the time parameter (but the time parameter must be in the correct ISO8601 timestamp format, so can't be used for general parameters)


However, I cannot find another QGIS plugin that allows a user to manipulate any dimension (e.g. elevation or the low viewparam above) with a slider or similar control.

Can anyone point me in the right direction?

If not, is this something useful that I should consider implementing as a plugin?

I assume that I should be able to intercept the WMS/WMTS/WFS webservice requests when they are created, modify the parameters and forward them on.

1
  • Did you find a solution? I would also like to use Time enabled GeoServer WMTS and WMS layer in QGIS. Commented Aug 19, 2021 at 12:27

1 Answer 1

6

It's astonishing to me that this is still unresolved. Fortunately, based on this answer I found a workaround.

While adding the WMS layer in QGIS, you need to manually append your parameters to the URL. In my case, that meant my URL ended with .../wms?viewparams=foo:bar.

After this, the critical step was to check the box to "Ignore GetMap/GetTile/GetLegendGraphic URI reported in capabilities".

QGIS Desktop screenshot - Ignore URI reported in capabilities

Doing so caused my layers to load properly when using viewparams, and I'm pretty sure this will work in the case of time/elevation/CQL queries, too.

2
  • 1
    Thanks, but I am looking for a slider or other control to set the viewparam foo to bar1, bar2.. bar10, etc
    – PeterS
    Commented Mar 18, 2022 at 5:09
  • 1
    Just tried this and the layer loaded fine, respecting the parameter. But if I do a query on the layer (Identify features tool in QGis), the result will not respect the parameter set. So I suspect the parameter is not passed to getFeatureInfo.
    – Daniel
    Commented Jun 10, 2022 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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