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

2020-04-02 Thread Jakob Miksch

Dear list,

@Jeff: Thanks for the tip. But I need a programmatic way using the 
Python API how to extract the "GetMap" URL.


Currently I fixed my problem with OWSlib:


```
d = parse_qs(source)
url_get_capabilities = d['url'][0]
layers = d['layers'][0]
# request getMap URL via OWSLib
wms = WebMapService(url_get_capabilities)
url_get_map = wms.getOperationByName('GetMap').methods[0]['url'] ``` 
However, I am not that happy with this approach, because OWSlib makes 
another request to the server. I mean, QGIS obviously knows the URL 
already, but I cannot easily access it Python. Does anyone else have an 
idea how the retrieve the "GetMap" URL? Thanks and best wishes, Jakob



On 31.03.20 16:54, Jeff McKenna wrote:
Try Richard's great 'QGIS Network Logger' plugin, to see all WMS 
requests.  I've recorded several options here to grab the GetMap url: 
https://github.com/mapserver/mapserver/wiki/Get-the-Raw-WMS-Request-Generated-by-QGIS 



-jeff


--
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/



On 2020-03-31 11:37 a.m., Jakob Miksch wrote:

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: 
https://www.geoportal.rlp.de/mapbender/php/wms.php?inspire=1_id=69694=1=1; 



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



___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


--
Jakob Miksch
Geospatial Development
www.jakobmiksch.eu

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

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

2020-03-31 Thread Jeff McKenna
Try Richard's great 'QGIS Network Logger' plugin, to see all WMS 
requests.  I've recorded several options here to grab the GetMap url: 
https://github.com/mapserver/mapserver/wiki/Get-the-Raw-WMS-Request-Generated-by-QGIS


-jeff


--
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/



On 2020-03-31 11:37 a.m., Jakob Miksch wrote:

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: 
https://www.geoportal.rlp.de/mapbender/php/wms.php?inspire=1_id=69694=1=1; 



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



___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

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

2020-03-31 Thread Jakob Miksch

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: 
https://www.geoportal.rlp.de/mapbender/php/wms.php?inspire=1_id=69694=1=1; 



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

--
Jakob Miksch
Geospatial Development
www.jakobmiksch.eu

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer