[Qgis-developer] Determine whether layer is OpenLayers layer

Tom Chadwin tom.chadwin at nnpa.org.uk
Wed Jul 16 06:08:20 PDT 2014

In a plugin, we currently loop through all layers in qgis.utils.iface.mapCanvas().layers. We determine whether a layer is eg WFS by using QgsVectorLayer.providerType(). However, if OpenLayers plugin layers are present, this fails:

AttributeError: 'OpenlayersLayer' object has no attribute 'providerType'

How should I broaden out the detection of type of layer to determine whether it is such an OpenLayers layer? I will also then probably want to determine which OpenLayers layer it is (eg OSM, Google, etc), but for the moment, that can wait.

Is there documentation of the OpenLayers plugin suitable for working with it in plugin development? An API?

Tom Chadwin, UK National Parks Portal Manager
Telephone: 01434 611511 Mob: 07881 109617
Web: www.northumberlandnationalpark.org.uk<http://www.northumberlandnationalpark.org.uk/>

IMPORTANT NOTICE - Disclaimer - This communication is from Northumberland National Park Authority (NNPA).The Authority’s head office and principal place of business is Eastburn, South Park, Hexham, Northumberland, NE46 1BS, United Kingdom. If you are not the intended recipient(s) please note that any form of disclosure, distribution, copying or use of this communication or the information in it or in any attachments is strictly prohibited and may be unlawful. If you have received this communication in error, please delete the email and destroy any copies of it. Any views or opinions presented are solely those of the author and do not necessarily represent those of NNPA.Contractors or potential contractors are reminded that a formal Order or Contract is needed for NNPA to be bound by any offer or acceptance of terms for the supply of goods or services Although this email and any attachments are believed to be free of any virus or other defects which might affect any computer or IT system into which they are received, no responsibility is accepted by the NNPA for any loss or damage arising in any way from the receipt or use thereof. Computer systems of this Authority may be monitored and communications carried out on them recorded, to secure the effective operation of the system and for other lawful purpose.

More information about the Qgis-developer mailing list