Example Code
————

layername1 = 'Imagery Orthophoto 2014'
url1 = 'contextualWMSLegend=0&crs=EPSG:4326&dpiMode=7&featureCount=10&format=image/jpeg&layers=0&styles&url=https://eservices.dls.moi.gov.cy/arcgis/services/BASEMAPS/Imagery_Orthophoto_2014_10cm/MapServer/WMSServer'

layername2 = 'Imagery Orthophoto 1963'
url2 = 'contextualWMSLegend=0&crs=EPSG:4326&dpiMode=7&featureCount=10&format=image/jpeg&layers=0&styles&url=https://eservices.dls.moi.gov.cy/arcgis/services/BASEMAPS/Imagery_Orthophoto_1963/MapServer/WMSServer'

layer = QgsRasterLayer(url1, layername1, 'wms')
layer2 = QgsRasterLayer(url2, layername2, 'wms')
QgsProject.instance().addMapLayer(layer2)
QgsProject.instance().addMapLayer(layer)
Categories: QGIS

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: