[QGIS-Developer] "GetMap" URL from WMS layers

Jakob Miksch info at jakobmiksch.eu
Tue Mar 31 07:37:26 PDT 2020

Dear list,

I want to extract the "GetMap" URL from WMS layers. For most of the WMS 
layers I can extract it from "layer.source()". However this does not 
work for WMS layers where "GetMap" and "GetCapabilities" is different. 
Like for this layer: 

The only place where I can find the "GetMap" URL is inside the 
"layer.htmlMetadata()" document. From there the URL can be extracted 
using REGEX. But every localization of QGIS (e.g. German, French ...) 
have different terms for the surrounding "GetMap" HTML element. This 
makes this approach quite tricky.

Is there any more elegant solution how to retrieve the "GetMap" URL from 
WMS layers?

Thanks in advance and best wishes,

Jakob Miksch
Geospatial Development

More information about the QGIS-Developer mailing list