-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount_selected_features.txt
More file actions
30 lines (29 loc) · 969 Bytes
/
count_selected_features.txt
File metadata and controls
30 lines (29 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
>>> baf=qgis.utils.iface.mapCanvas.layers()
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'builtin_function_or_method' object has no attribute 'layers'
>>> baf=mapCanvas.layers()
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'mapCanvas' is not defined
>>> baf=qgis.utils.iface.mapCanvas().layers()
>>> print baf
[<qgis.core.QgsVectorLayer object at 0x27e6408>, <qgis.core.QgsVectorLayer object at 0x27e6490>]
>>> for kk in baf:
... print( baf.name())
...
Traceback (most recent call last):
File "<input>", line 2, in <module>
AttributeError: 'list' object has no attribute 'name'
>>> for kk in baf:
... print baf.id()
...
Traceback (most recent call last):
File "<input>", line 2, in <module>
AttributeError: 'list' object has no attribute 'id'
>>> print baf[0].id()
STJ_John_estates20120824102753982
>>> my_layer=baf[0]
>>> print my_layer.selectedFeatureCount()
4
>>>