5

In QGIS with a python plugin, how can I determine if a layer is WMS, WFS or something else?

1 Answer 1

7

You can use the QgsVectorLayer::providerType() method to determine the data provider of the layer in question:

vLayer = QgsVectorLayer(uri, "WFS_layer", "WFS")
vLayer.providerType()
>>> u'WFS'

rLayer = QgsRasterLayer(url, 'WMS_layer', 'wms')
rLayer.providerType()
>>> u'wms'
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.