Skip to content

Commit

Permalink
Merge pull request #3 from alexbruy/fix-spatial-index
Browse files Browse the repository at this point in the history
fix spatialindex creation
  • Loading branch information
volaya authored Oct 4, 2016
2 parents 4bcdecd + 641c09b commit bd1cf0c
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 bd1cf0c

Please sign in to comment.