You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Just the selected featureslayer=iface.activeLayer()
forfeatureinlayer.selectedFeatures():
print(feature['name'])
# Filter by current extent of the mapextent=iface.mapCanvas().extent()
request=QgsFeatureRequest()
request.setFilterRect(extent)
layer=iface.activeLayer()
forfeatureinlayer.getFeatures(request):
print(feature['name'])
# Filter by fixed extentextent=QgsRectangle(-2.15, 52.20, 1.20, 52.60)
request=QgsFeatureRequest()
request.setFilterRect(extent)
layer=iface.activeLayer()
forfeatureinlayer.getFeatures(request):
print(feature['name'])
# Filter by attributeexp=QgsExpression('name ILIKE \'%London%\'')
request=QgsFeatureRequest(exp)
layer=iface.activeLayer()
forfeatureinlayer.getFeatures(request):
print(feature['name'])
# If you need to use a ' in your query double itexp=QgsExpression("\"name\" like '%Int''l'")
request=QgsFeatureRequest(exp)
layer=iface.activeLayer()
forfeatureinlayer.getFeatures(request):
print(feature['name'])