[processing] Warn when we know for certain that no spatial index

exists on a source used for the Join by Location algorithm

Advise users that performance will be severely degraded as a result.
This commit is contained in:
Nyall Dawson 2019-11-15 08:50:04 +10:00
parent 37044b0a26
commit 2a5ee9b563

View File

@ -38,7 +38,8 @@ from qgis.core import (QgsFields,
QgsProcessingParameterField,
QgsProcessingParameterFeatureSink,
QgsProcessingParameterString,
QgsProcessingOutputNumber)
QgsProcessingOutputNumber,
QgsFeatureSource)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector
@ -206,6 +207,9 @@ class SpatialJoin(QgisAlgorithm):
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