Skip to content

Commit

Permalink
[processing] Warn when we know for certain that no spatial index
Browse files Browse the repository at this point in the history
exists on a source used for the Join by Location algorithm

Advise users that performance will be severely degraded as a result.
  • Loading branch information
nyalldawson authored and nirvn committed Nov 17, 2019
1 parent 8ced952 commit 8096b0b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/plugins/processing/algs/qgis/SpatialJoin.py
Expand Up @@ -38,7 +38,8 @@
QgsProcessingParameterField,
QgsProcessingParameterFeatureSink,
QgsProcessingParameterString,
QgsProcessingOutputNumber)
QgsProcessingOutputNumber,
QgsFeatureSource)

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector
Expand Down Expand Up @@ -206,6 +207,9 @@ def processAlgorithm(self, parameters, context, feedback):
features = join_source.getFeatures(request)
total = 100.0 / join_source.featureCount() if join_source.featureCount() else 0

if source.hasSpatialIndex() == QgsFeatureSource.SpatialIndexNotPresent:
feedback.reportError(self.tr('No spatial index exists for input layer, performance will be severely degraded'))

joined_count = 0
unjoined_count = 0

Expand Down

0 comments on commit 8096b0b

Please sign in to comment.