Compare commits

..

No commits in common. "5f2679c7d0d8f2462c93dd61170b15cc2408c1d1" and "15adad4d88dd37feefeebbc5c61e9b414d68b9c8" have entirely different histories.

4 changed files with 4 additions and 17 deletions

View File

@ -572,21 +572,8 @@ void QgsBackgroundCachedFeatureIterator::featureReceivedSynchronous( const QVect
mWriterStream.reset( new QDataStream( &mWriterByteArray, QIODevice::WriteOnly ) ); mWriterStream.reset( new QDataStream( &mWriterByteArray, QIODevice::WriteOnly ) );
} }
const auto constList = list; const auto constList = list;
const Qgis::WkbType expectedType { mShared->mWKBType };
bool errorRaised = false;
for ( const QgsFeatureUniqueIdPair &pair : constList ) for ( const QgsFeatureUniqueIdPair &pair : constList )
{ {
if ( !errorRaised && expectedType != pair.first.geometry().wkbType() )
{
if ( QgsWkbTypes::hasZ( pair.first.geometry().wkbType() ) && !QgsWkbTypes::hasZ( expectedType ) )
{
mShared->pushError( QStringLiteral( "Received feature geometry has Z values but the layer type (%1) does not. Please check the WFS connection setting 'Force initial GetFeature'." ).arg( QgsWkbTypes::displayString( expectedType ) ) );
}
else
{
mShared->pushError( QStringLiteral( "Received feature with geometry type %1, expected %2" ).arg( QgsWkbTypes::displayString( pair.first.geometry().wkbType() ), QgsWkbTypes::displayString( expectedType ) ) );
}
}
*mWriterStream << pair.first; *mWriterStream << pair.first;
} }
if ( !mWriterFile && mWriterByteArray.size() > mWriteTransferThreshold ) if ( !mWriterFile && mWriterByteArray.size() > mWriteTransferThreshold )

View File

@ -188,9 +188,6 @@ class QgsBackgroundCachedSharedData
//! Called when an error must be raised to the provider //! Called when an error must be raised to the provider
virtual void pushError( const QString &errorMsg ) const = 0; virtual void pushError( const QString &errorMsg ) const = 0;
//! Geometry type of the features in this layer (used by WFS only)
Qgis::WkbType mWKBType = Qgis::WkbType::Unknown;
protected: protected:
//////////// Input members. Implementations should define them to meaningful values //////////// Input members. Implementations should define them to meaningful values

View File

@ -245,7 +245,7 @@ QList<QgsProviderSublayerDetails> QgsWfsProviderMetadata::querySublayers( const
details.setWkbType( provider.wkbType() ); details.setWkbType( provider.wkbType() );
res << details; res << details;
// If set: always issue a GetFeature because the guessed type can't be trusted, // Always issue a GetFeature because the guessed type can't be trusted,
// for example when dealing with Z geometries identified as 2D. // for example when dealing with Z geometries identified as 2D.
const bool forceInitialGetFeature = dsUri.hasParam( QgsWFSConstants::URI_PARAM_FORCE_INITIAL_GET_FEATURE ) const bool forceInitialGetFeature = dsUri.hasParam( QgsWFSConstants::URI_PARAM_FORCE_INITIAL_GET_FEATURE )
&& dsUri.param( QgsWFSConstants::URI_PARAM_FORCE_INITIAL_GET_FEATURE ).toUpper() == QStringLiteral( "TRUE" ); && dsUri.param( QgsWFSConstants::URI_PARAM_FORCE_INITIAL_GET_FEATURE ).toUpper() == QStringLiteral( "TRUE" );

View File

@ -141,6 +141,9 @@ class QgsWFSSharedData : public QObject, public QgsBackgroundCachedSharedData
*/ */
bool mServerPrefersCoordinatesForTransactions_1_1 = false; bool mServerPrefersCoordinatesForTransactions_1_1 = false;
//! Geometry type of the features in this layer
Qgis::WkbType mWKBType = Qgis::WkbType::Unknown;
//! Geometry type filter to ensure geometries returned by the layer are of type mWKBType. //! Geometry type filter to ensure geometries returned by the layer are of type mWKBType.
QString mWFSGeometryTypeFilter; QString mWFSGeometryTypeFilter;