0
uri = '''https://vmap0.tiles.osgeo.org/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-90,45,-45,90&WIDTH=256&HEIGHT=256 '''
layer = QgsRasterLayer(uri, "RESA", "WMS")
if layer.isValid():
    pass
else:
    print('error')

The result is 'error'.This does not meet my expectations of adding an HTTPS type WMS service.I tried querying pyQGIS's API, but found nothing. enter image description here

enter image description here

  • Note that you are using `QgsVectorLayer` specifying WFS as the data provider to fetch a **raster** WMS layer. Do you know the difference between WFS and WMS? – Dima Chubarov Jul 13 '22 at 02:31
  • sorry! The question is error.I change it at now. – elephant111 Jul 13 '22 at 02:35
  • I am a python engineer.The basic concepts of GIS are not well understood,However, there is no problem with the scenario I asked, that is, how to use pyQGIS API to call the image data adding WMS class, and the protocol type is HTTPS, we call HTTP without problem – elephant111 Jul 13 '22 at 02:40
  • 1
    To display a WMS layer you need to instantiate a QgsRasterLayer. – Dima Chubarov Jul 13 '22 at 03:19
  • i change my question and add some pictures to explain my dilemma. – elephant111 Jul 13 '22 at 13:00
  • Checkout this [post](https://gis.stackexchange.com/q/152767/7086). Perhaps you would get help faster on the GIS Stackexchange site. – Dima Chubarov Jul 13 '22 at 14:27
  • Also note that [posting screenshots of the code is discouraged on this site](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). – Dima Chubarov Jul 13 '22 at 14:30

0 Answers0