Skip to content

Commit

Permalink
[WFS provider] Use QgsOgcCrsUtils::parseCrsName() to be able to handl…
Browse files Browse the repository at this point in the history
…e OGC HTTP URIs (fixes #29391)
  • Loading branch information
rouault authored and github-actions[bot] committed Sep 28, 2022
1 parent c1e4cf5 commit c065728
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/providers/wfs/qgswfscapabilities.cpp
Expand Up @@ -657,16 +657,12 @@ void QgsWfsCapabilities::capabilitiesReplyFinished()

QString QgsWfsCapabilities::NormalizeSRSName( const QString &crsName )
{
const QRegularExpression re( QRegularExpression::anchoredPattern( QStringLiteral( "urn:ogc:def:crs:([^:]+).+?([^:]+)" ) ), QRegularExpression::CaseInsensitiveOption );
if ( const QRegularExpressionMatch match = re.match( crsName ); match.hasMatch() )
QString authority;
QString code;
const QgsOgcCrsUtils::CRSFlavor crsFlavor = QgsOgcCrsUtils::parseCrsName( crsName, authority, code );
if ( crsFlavor != QgsOgcCrsUtils::CRSFlavor::UNKNOWN )
{
return match.captured( 1 ) + ':' + match.captured( 2 );
}
// urn:x-ogc:def:crs:EPSG:xxxx as returned by http://maps.warwickshire.gov.uk/gs/ows? in WFS 1.1
const QRegularExpression re2( QRegularExpression::anchoredPattern( QStringLiteral( "urn:x-ogc:def:crs:([^:]+).+?([^:]+)" ) ), QRegularExpression::CaseInsensitiveOption );
if ( const QRegularExpressionMatch match = re2.match( crsName ); match.hasMatch() )
{
return match.captured( 1 ) + ':' + match.captured( 2 );
return authority + ':' + code;
}
return crsName;
}
Expand Down

0 comments on commit c065728

Please sign in to comment.