Skip to content
Permalink
Browse files
fix spatialindex creation
  • Loading branch information
alexbruy committed Oct 4, 2016
1 parent 4bcdecd commit 641c09bb7074e48857111f29df7e98f45eda1b73
Showing with 7 additions and 1 deletion.
  1. +7 −1 python/plugins/processing/tools/vector.py
@@ -200,7 +200,13 @@ def testForUniqueness(fieldList1, fieldList2):
def spatialindex(layer):
"""Creates a spatial index for the passed vector layer.
"""
idx = QgsSpatialIndex(features(layer))
request = QgsFeatureRequest()
request.setSubsetOfAttributes([])
if ProcessingConfig.getSetting(ProcessingConfig.USE_SELECTED) \
and layer.selectedFeatureCount() > 0:
idx = layer.selectedFeaturesIterator(request)
else:
idx = QgsSpatialIndex(layer.getFeatures(request))
return idx


0 comments on commit 641c09b

Please sign in to comment.