[Qgis-user] minidump after running script
Reginald
Reginald.Carlier at ingelmunster.be
Fri Oct 20 02:02:04 PDT 2017
thanks for this solution.
My script now looks like this and works :-)
from qgis.PyQt.QtCore import *
from qgis.PyQt.QtGui import *
from qgis.PyQt.QtWidgets import *
import processing
layer=None
for lyr in QgsMapLayerRegistry.instance().mapLayers().values():
if lyr.name() == "selectiepolygoon":
layer = lyr
break
# Get the first feature from the layer
feature = layer.getFeatures().next()
# fetch geometry
geom = QgsGeometry(feature.constGeometry())
#request = QgsFeatureRequest()
#request.setFilterRect(geom)
my_id = layer.id()
QgsMapLayerRegistry.instance().removeMapLayers(my_id)
layers = iface.legendInterface().layers()
for layer in layers:
layerType = layer.type()
if layerType == QgsMapLayer.VectorLayer:
for feature in layer.getFeatures():
if feature.geometry().intersects(geom):
attrs = feature.attributes()
for att in attrs:
print (str(att))
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
More information about the Qgis-user
mailing list