Skip to main content
Tweeted twitter.com/StackGIS/status/1003632026023538688
deleted 4 characters in body
Source Link
George
  • 123
  • 9

I want to load a WMS with PyQGIS. I know this is possible on version 2.18 If it is done with the graphical Interface by checking on the Use contextual WMS legend

Load WMS and its legend from QGIS Graphical Interface

Now I manage to load a WMS with PyQGIS but I can not figure how to load the WMS and its legend.

Below there is partial working code snippet:

urlWithParams = "url=http://localhost:8080/geoserverwww.geoportaligm.gob.ec/sf50k/wms&format=image/png&layers=sfdem&styles=&crs=EPSGpng&layers=igm:26713"acequia_l&styles=&crs=EPSG:32717"
rlayer = QgsRasterLayer(urlWithParams, 'testing', 'wms')
rlayer.isValid() 
QgsMapLayerRegistry.instance().addMapLayer(rlayer)

I want to load a WMS with PyQGIS. I know this is possible on version 2.18 If it is done with the graphical Interface by checking on the Use contextual WMS legend

Load WMS and its legend from QGIS Graphical Interface

Now I manage to load a WMS with PyQGIS but I can not figure how to load the WMS and its legend.

Below there is partial working code snippet:

urlWithParams = "url=http://localhost:8080/geoserver/sf/wms&format=image/png&layers=sfdem&styles=&crs=EPSG:26713"
rlayer = QgsRasterLayer(urlWithParams, 'testing', 'wms')
rlayer.isValid() 
QgsMapLayerRegistry.instance().addMapLayer(rlayer)

I want to load a WMS with PyQGIS. I know this is possible on version 2.18 If it is done with the graphical Interface by checking on the Use contextual WMS legend

Load WMS and its legend from QGIS Graphical Interface

Now I manage to load a WMS with PyQGIS but I can not figure how to load the WMS and its legend.

Below there is partial working code snippet:

urlWithParams = "url=http://www.geoportaligm.gob.ec/50k/wms&format=image/png&layers=igm:acequia_l&styles=&crs=EPSG:32717"
rlayer = QgsRasterLayer(urlWithParams, 'testing', 'wms')
rlayer.isValid() 
QgsMapLayerRegistry.instance().addMapLayer(rlayer)
edited tags
Link
Ian Turton
  • 83.2k
  • 6
  • 89
  • 189
improved formatting, added tags
Source Link
nmtoken
  • 13.6k
  • 5
  • 38
  • 89

I want to load a wmsWMS with PyQGIS. I know this is possible on version 2.18 If it is done with the graphical Interface by checking on the Use contextual WMS legend

Load WMS and its legend from QGIS Graphical Interface

Now I manage to load a WMS with PyQGIS but I can not figure how to load the WMS and its legend.

BellowBelow there is partial working code snippet:

urlWithParams = "url=http://localhost:8080/geoserver/sf/wms&format=image/png&layers=sfdem&styles=&crs=EPSG:26713"
rlayer = QgsRasterLayer(urlWithParams, 'testing', 'wms')
rlayer.isValid() 
QgsMapLayerRegistry.instance().addMapLayer(rlayer)

rlayer = QgsRasterLayer(urlWithParams, 'testing', 'wms') rlayer.isValid() QgsMapLayerRegistry.instance().addMapLayer(rlayer)

I want to load a wms with PyQGIS. I know this is possible on version 2.18 If it is done with the graphical Interface by checking on the Use contextual WMS legend

Load WMS and its legend from QGIS Graphical Interface

Now I manage to load a WMS with PyQGIS but I can not figure how to load the WMS and its legend.

Bellow there is partial working code snippet:

urlWithParams = "url=http://localhost:8080/geoserver/sf/wms&format=image/png&layers=sfdem&styles=&crs=EPSG:26713"

rlayer = QgsRasterLayer(urlWithParams, 'testing', 'wms') rlayer.isValid() QgsMapLayerRegistry.instance().addMapLayer(rlayer)

I want to load a WMS with PyQGIS. I know this is possible on version 2.18 If it is done with the graphical Interface by checking on the Use contextual WMS legend

Load WMS and its legend from QGIS Graphical Interface

Now I manage to load a WMS with PyQGIS but I can not figure how to load the WMS and its legend.

Below there is partial working code snippet:

urlWithParams = "url=http://localhost:8080/geoserver/sf/wms&format=image/png&layers=sfdem&styles=&crs=EPSG:26713"
rlayer = QgsRasterLayer(urlWithParams, 'testing', 'wms')
rlayer.isValid() 
QgsMapLayerRegistry.instance().addMapLayer(rlayer)
Source Link
George
  • 123
  • 9
Loading