According to the docs, providerType() returns the provider type (provider key) for a layer.
According to https://gis.stackexchange.com/a/262050/105333, the values for a WMS/WFS layer are wms and WFS.
I found no documentation why wms is in lowercase and WFS is in uppercase. Also there seems to be no list of all existing provider types available.
This raises the question, if there are additionally other values like e.g. WMS or wfs around.
Answer
Good question!,you can find the provider in the "about" dialog.
or if you want use python, you can obtain the initial providers list. @germán-carrillo suggestion
QgsProviderRegistry.instance().providerList()
which returns for the above list from the "about" diolog the following values:
['DB2', 'WFS', 'arcgisfeatureserver', 'arcgismapserver', 'delimitedtext', 'gdal', 'geonode', 'gpx', 'grass', 'grassraster', 'mdal', 'memory', 'mesh_memory', 'mssql', 'ogr', 'ows', 'postgres', 'spatialite', 'virtual', 'wcs', 'wms']
About your question of why it's in uppercase or lowercase, I think it's simply because it's so defined in the code
"wms" https://github.com/qgis/QGIS/blob/master/src/providers/wms/qgswmsprovider.cpp#L77
"WFS" https://github.com/qgis/QGIS/blob/master/src/providers/wfs/qgswfsprovider.cpp#L52

No comments:
Post a Comment