24 QString QgsSpatialIndexAlgorithm::name()
const
26 return QStringLiteral(
"createspatialindex" );
29 QString QgsSpatialIndexAlgorithm::displayName()
const
31 return QObject::tr(
"Create spatial index" );
34 QStringList QgsSpatialIndexAlgorithm::tags()
const
36 return QObject::tr(
"table,spatial,geometry,index,create,vector" ).split(
',' );
39 QString QgsSpatialIndexAlgorithm::group()
const
41 return QObject::tr(
"Vector general" );
44 QString QgsSpatialIndexAlgorithm::groupId()
const
46 return QStringLiteral(
"vectorgeneral" );
49 QgsProcessingAlgorithm::Flags QgsSpatialIndexAlgorithm::flags()
const
55 QString QgsSpatialIndexAlgorithm::shortHelpString()
const
57 return QObject::tr(
"Creates an index to speed up access to the features "
58 "in a layer based on their spatial location. Support "
59 "for spatial index creation is dependent on the layer's "
63 QgsSpatialIndexAlgorithm *QgsSpatialIndexAlgorithm::createInstance()
const
65 return new QgsSpatialIndexAlgorithm();
68 void QgsSpatialIndexAlgorithm::initAlgorithm(
const QVariantMap & )
77 QgsVectorLayer *layer = parameterAsVectorLayer( parameters, QStringLiteral(
"INPUT" ), context );
80 throw QgsProcessingException( QObject::tr(
"Could not load source layer for %1." ).arg( QStringLiteral(
"INPUT" ) ) );
88 feedback->
pushInfo( QObject::tr(
"Could not create spatial index" ) );
93 feedback->
pushInfo( QObject::tr(
"Layer's data provider does not support spatial indexes" ) );
97 outputs.insert( QStringLiteral(
"OUTPUT" ), layer->
id() );