Skip to content
Permalink
Browse files

Workaround to fix WFS provider empty() method

  • Loading branch information
m-kuhn committed Jun 4, 2018
1 parent 280e10e commit 0b96e3ae801fe97f936f4e23b89dbfdef0eae3db
Showing with 23 additions and 0 deletions.
  1. +21 −0 src/providers/wfs/qgswfsprovider.cpp
  2. +2 −0 src/providers/wfs/qgswfsprovider.h
@@ -1199,6 +1199,27 @@ QString QgsWFSProvider::translateMetadataValue( const QString &mdKey, const QVar
{
return value.toString();
}
}

bool QgsWFSProvider::empty() const
{
QgsFeature f;
QgsFeatureRequest request;
request.setSubsetOfAttributes( QgsAttributeList() );
request.setFlags( QgsFeatureRequest::NoGeometry );

// Whoops, the WFS provider returns an empty iterator when we are using
// a setLimit call in combination with a subsetString.
// Remove this method (and default to the QgsVectorDataProvider one)
// once this is fixed
#if 0
request.setLimit( 1 );
#endif
if ( getFeatures( request ).nextFeature( f ) )
return false;
else
return true;

};

bool QgsWFSProvider::describeFeatureType( QString &geometryAttribute, QgsFields &fields, QgsWkbTypes::Type &geomType )
@@ -111,6 +111,8 @@ class QgsWFSProvider : public QgsVectorDataProvider
QString translateMetadataKey( const QString &mdKey ) const override;
QString translateMetadataValue( const QString &mdKey, const QVariant &value ) const override;

bool empty() const override;

public slots:

void reloadData() override;

0 comments on commit 0b96e3a

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