I am not sure how to use the API documentation to code in Python. For example, I want to determine whether a layer is a point, line or polygon layer and found the following in the API documentation:
I have selected the lakes shapefile from the QGIS alaska dataset. In the QGis Python console, I have typed:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
canvas = self.iface.mapCanvas()
cLayer = canvas.currentLayer()
type(cLayer)
The returned value is: <class 'qgis.core.QgsVectorLayer'>
.
How do I use the above information in the API documentation to (1) determine the type of the selected layer and (2) return the value of the listed enumerate types (e.g. polygon)? Whilst I am sure someone can tell me the answer, I would really like to know how to work out the answer using the API documentation and any other available documentation.