Tuesday, 23 August 2016

pyqgis - Are there other values than "wms" and "WFS" for providerType() for a WMS/WFS layer?



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.


enter image description here


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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...