Skip to content
Permalink
Browse files

Show some more warnings when spatial indexes are missing but desirable

  • Loading branch information
github-actions authored and nyalldawson committed Jul 30, 2020
1 parent 46ebfaf commit 0efd5795e7fe21793a7985073dbe18150d09d0d1
@@ -35,6 +35,7 @@
QgsFeatureSink,
QgsFeatureRequest,
QgsGeometry,
QgsFeatureSource,
QgsCoordinateTransform,
QgsStatisticalSummary,
QgsDateTimeStatisticalSummary,
@@ -160,6 +161,9 @@ def processAlgorithm(self, parameters, context, feedback):
if join_source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.JOIN))

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

join_fields = self.parameterAsFields(parameters, self.JOIN_FIELDS, context)
discard_nomatch = self.parameterAsBoolean(parameters, self.DISCARD_NONMATCHING, context)
summaries = [self.statistics[i][0] for i in
@@ -96,6 +96,9 @@ QVariantMap QgsClipAlgorithm::processAlgorithm( const QVariantMap &parameters, Q
if ( !maskSource )
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "OVERLAY" ) ) );

if ( featureSource->hasSpatialIndex() == QgsFeatureSource::SpatialIndexNotPresent )
feedback->reportError( QObject::tr( "No spatial index exists for input layer, performance will be severely degraded" ) );

QString dest;
QgsWkbTypes::GeometryType sinkType = QgsWkbTypes::geometryType( featureSource->wkbType() );
std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest, featureSource->fields(), QgsWkbTypes::multiType( featureSource->wkbType() ), featureSource->sourceCrs() ) );
@@ -70,6 +70,9 @@ QVariantMap QgsExtractByExtentAlgorithm::processAlgorithm( const QVariantMap &pa
if ( !featureSource )
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "INPUT" ) ) );

if ( featureSource->hasSpatialIndex() == QgsFeatureSource::SpatialIndexNotPresent )
feedback->reportError( QObject::tr( "No spatial index exists for input layer, performance will be severely degraded" ) );

QgsRectangle extent = parameterAsExtent( parameters, QStringLiteral( "EXTENT" ), context, featureSource->sourceCrs() );
bool clip = parameterAsBoolean( parameters, QStringLiteral( "CLIP" ), context );

0 comments on commit 0efd579

Please sign in to comment.
You can’t perform that action at this time.