Skip to content

Commit be6a763

Browse files
authored
Merge pull request #6949 from m-kuhn/wms_overwrite_parent_boundingBoxes
Wms overwrite parent bounding boxes
2 parents cfad3aa + 2ee479e commit be6a763

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎src/providers/wms/qgswmscapabilities.cpp‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,6 @@ void QgsWmsCapabilities::parseLayer( QDomElement const &e, QgsWmsLayerProperty &
872872
}
873873
else if ( tagName == QLatin1String( "BoundingBox" ) )
874874
{
875-
// TODO: overwrite inherited
876875
QgsWmsBoundingBoxProperty bbox;
877876
bbox.box = QgsRectangle( e1.attribute( QStringLiteral( "minx" ) ).toDouble(),
878877
e1.attribute( QStringLiteral( "miny" ) ).toDouble(),
@@ -893,7 +892,18 @@ void QgsWmsCapabilities::parseLayer( QDomElement const &e, QgsWmsLayerProperty &
893892
bbox.box = invAxisBbox;
894893
}
895894

896-
layerProperty.boundingBoxes << bbox;
895+
// Overwrite existing bounding boxes with identical CRS
896+
bool inheritedOverwritten = false;
897+
for ( int i = 0; i < layerProperty.boundingBoxes.size(); i++ )
898+
{
899+
if ( layerProperty.boundingBoxes[i].crs == bbox.crs )
900+
{
901+
layerProperty.boundingBoxes[i] = bbox;
902+
inheritedOverwritten = true;
903+
}
904+
}
905+
if ( ! inheritedOverwritten )
906+
layerProperty.boundingBoxes << bbox;
897907
}
898908
else
899909
{

0 commit comments

Comments
 (0)