mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-04 00:04:03 -04:00
Merge pull request #61963 from elpaso/bugfix-gh61399-wms-getcap-fails-on-split
[wmts] Be nice and accept redundant spaces in coord tuples
This commit is contained in:
commit
f3a55eb615
@ -1793,7 +1793,7 @@ void QgsWmsCapabilities::parseWMTSContents( const QDomElement &element )
|
||||
|
||||
tileMatrix.scaleDenom = secondChildElement.firstChildElement( QStringLiteral( "ScaleDenominator" ) ).text().toDouble();
|
||||
|
||||
QStringList topLeft = secondChildElement.firstChildElement( QStringLiteral( "TopLeftCorner" ) ).text().split( ' ' );
|
||||
QStringList topLeft = secondChildElement.firstChildElement( QStringLiteral( "TopLeftCorner" ) ).text().split( ' ', Qt::SkipEmptyParts );
|
||||
if ( topLeft.size() == 2 )
|
||||
{
|
||||
if ( invert )
|
||||
@ -1856,8 +1856,8 @@ void QgsWmsCapabilities::parseWMTSContents( const QDomElement &element )
|
||||
QDomElement bbox = childElement.firstChildElement( QStringLiteral( "ows:WGS84BoundingBox" ) );
|
||||
if ( !bbox.isNull() )
|
||||
{
|
||||
QStringList ll = bbox.firstChildElement( QStringLiteral( "ows:LowerCorner" ) ).text().split( ' ' );
|
||||
QStringList ur = bbox.firstChildElement( QStringLiteral( "ows:UpperCorner" ) ).text().split( ' ' );
|
||||
QStringList ll = bbox.firstChildElement( QStringLiteral( "ows:LowerCorner" ) ).text().split( ' ', Qt::SkipEmptyParts );
|
||||
QStringList ur = bbox.firstChildElement( QStringLiteral( "ows:UpperCorner" ) ).text().split( ' ', Qt::SkipEmptyParts );
|
||||
|
||||
if ( ll.size() == 2 && ur.size() == 2 )
|
||||
{
|
||||
@ -1872,8 +1872,8 @@ void QgsWmsCapabilities::parseWMTSContents( const QDomElement &element )
|
||||
!bbox.isNull();
|
||||
bbox = bbox.nextSiblingElement( QStringLiteral( "ows:BoundingBox" ) ) )
|
||||
{
|
||||
QStringList ll = bbox.firstChildElement( QStringLiteral( "ows:LowerCorner" ) ).text().split( ' ' );
|
||||
QStringList ur = bbox.firstChildElement( QStringLiteral( "ows:UpperCorner" ) ).text().split( ' ' );
|
||||
QStringList ll = bbox.firstChildElement( QStringLiteral( "ows:LowerCorner" ) ).text().split( ' ', Qt::SkipEmptyParts );
|
||||
QStringList ur = bbox.firstChildElement( QStringLiteral( "ows:UpperCorner" ) ).text().split( ' ', Qt::SkipEmptyParts );
|
||||
|
||||
if ( ll.size() == 2 && ur.size() == 2 )
|
||||
{
|
||||
|
@ -596,6 +596,44 @@ class TestQgsWmsCapabilities : public QObject
|
||||
QCOMPARE( res.end(), range.end() );
|
||||
QCOMPARE( static_cast<int>( resFormat ), format );
|
||||
}
|
||||
|
||||
void wmtsWithRedundantSpaces()
|
||||
{
|
||||
QgsWmsCapabilities capabilities;
|
||||
const QgsWmsParserSettings config;
|
||||
|
||||
// Note: Redundant spaces in the coordinate tuples
|
||||
const QByteArray configData( R"""(<Capabilities>
|
||||
<Contents>
|
||||
<Layer>
|
||||
<ows:Identifier>Layer1</ows:Identifier>
|
||||
<ows:WGS84BoundingBox>
|
||||
<ows:LowerCorner>109.999000 -45.081000</ows:LowerCorner>
|
||||
<ows:UpperCorner>155.005000 -9.978000</ows:UpperCorner>
|
||||
</ows:WGS84BoundingBox>
|
||||
</Layer>
|
||||
<TileMatrixSet>
|
||||
<ows:Identifier>WholeWorld_CRS_84</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:OGC:1.3:CRS84</ows:SupportedCRS>
|
||||
<WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GlobalCRS84Pixel</WellKnownScaleSet>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>1g</ows:Identifier>
|
||||
<ScaleDenominator>397569609.975977</ScaleDenominator>
|
||||
<TopLeftCorner>-180 90</TopLeftCorner>
|
||||
<TileWidth>320</TileWidth>
|
||||
<TileHeight>200</TileHeight>
|
||||
<MatrixWidth>2</MatrixWidth>
|
||||
<MatrixHeight>1</MatrixHeight>
|
||||
</TileMatrix>
|
||||
</TileMatrixSet>
|
||||
</Contents>
|
||||
</Capabilities>)""" );
|
||||
|
||||
QVERIFY( capabilities.parseResponse( configData, config ) );
|
||||
QCOMPARE( capabilities.supportedTileMatrixSets().size(), 1 );
|
||||
QgsWmtsTileLayer layer = capabilities.supportedTileLayers().at( 0 );
|
||||
QCOMPARE( layer.boundingBoxes.first().box, QgsRectangle( 109.999, -45.081, 155.005, -9.978 ) );
|
||||
}
|
||||
};
|
||||
|
||||
QGSTEST_MAIN( TestQgsWmsCapabilities )
|
||||
|
Loading…
x
Reference in New Issue
Block a user