Skip to content
Permalink
Browse files

Merge pull request #42100 from elpaso/bugfix-unreported-wms-cascading…

…-fid

WMS cascading: fix unreported issue wih missing fids
  • Loading branch information
elpaso authored and github-actions committed Mar 10, 2021
1 parent 3719d93 commit e2234ccbd27b486658b49a33629c7fcac98cb0c5
Showing with 18 additions and 1 deletion.
  1. +17 −0 src/providers/wms/qgswmsprovider.cpp
  2. +1 −1 src/server/services/wms/qgswmsrenderer.cpp
@@ -3488,6 +3488,23 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa
params.insert( QStringLiteral( "getFeatureInfoUrl" ), requestUrl.toString() );
featureStore.setParams( params );

// Try to parse and set feature id if matches "<some string>.<integer>"
if ( f.value( QLatin1String( "id" ) ).isString() )
{
const thread_local QRegularExpression re{ R"raw(\.(\d+)$)raw" };
const QString idVal { f.value( QLatin1String( "id" ) ).toString() };
const QRegularExpressionMatch match { re.match( idVal ) };
if ( match.hasMatch() )
{
bool ok;
QgsFeatureId id { match.captured( 1 ).toLongLong( &ok ) };
if ( ok )
{
feature.setId( id );
}
}
}

feature.setValid( true );
featureStore.addFeature( feature );

@@ -2368,7 +2368,7 @@ namespace QgsWms
if ( layer && layer->dataProvider() )
fid = QgsServerFeatureId::getServerFid( *feat, layer->dataProvider()->pkAttributeIndexes() );
else
fid = feat->id();
fid = FID_TO_STRING( feat->id() );

typeNameElement.setAttribute( QStringLiteral( "fid" ), QStringLiteral( "%1.%2" ).arg( typeName, fid ) );

0 comments on commit e2234cc

Please sign in to comment.