[Qgis-user] minidump after running script
Reginald
Reginald.Carlier at ingelmunster.be
Fri Oct 20 01:08:32 PDT 2017
Hi,
I am trying to make a report by using a script.
The script looks as follows:
from qgis.PyQt.QtCore import *
from qgis.PyQt.QtGui import *
from qgis.PyQt.QtWidgets import *
import processing
# selectiepolygoon layer contains one multipolygone
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 = feature.geometry()
# remove selectiepolygoon from legend
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):
attr =feature.attributes()
for att in attr:
print (att.value)
When I run this script in my project it terminates with a minidump.
I suspect that the geom is empty at some point?
Any idea what is wrong with this script?
Regards,
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
More information about the Qgis-user
mailing list