>From: Luca Manganelli <luc...@gmail.com> >To: qgis-developer <qgis-developer@lists.osgeo.org> >Subject: [Qgis-developer] Adding a WMS layer in QGIS 2.0 (python) > >Hi, >the QgsRasterLayer costructor has changed. If I try this: > >rlayer = >QgsRasterLayer('http://testsrv/mapaccel?map=ciao.map&crs=EPSG:25832&format=image/png', >'test', 'wms') >QgsMapLayerRegistry.instance().addMapLayer(rlayer) >self.iface.mapCanvas().refresh() > >the wms raster layer is never added to map. How can I fix this?
QgsRasterLayer constructor has changed, now it accept four arguments, the first is the uri string. To construct the uri string you must know what layers you want. You could try this: desired_layer = 'abcdefg' uri = 'crs=EPSG:25832&featureCount=10&format=image/png&layers=' + desired_layer + '&styles=&url=http://testsrv/mapaccel?map=ciao.map' rlayer = self.iface.addRasterLayer(uri, 'test', 'wms') Hope this helps! Enzo
_______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer