Skip to content

Commit

Permalink
fix spatialindex creation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 4, 2016
1 parent 4bcdecd commit 641c09b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/plugins/processing/tools/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 641c09b

Please sign in to comment.