Skip to content

Commit

Permalink
Fixes #5520 - Invalid BBOX in WMS GetCapabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Oct 23, 2018
1 parent 2fce570 commit da22f7c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/server/services/wms/qgswmsgetcapabilities.cpp
Expand Up @@ -1017,7 +1017,24 @@ namespace QgsWms
appendCrsElementsToLayer( doc, layerElem, crsList, outputCrsList );

//Ex_GeographicBoundingBox
appendLayerBoundingBoxes( doc, layerElem, l->extent(), l->crs(), crsList, outputCrsList, project );
QgsRectangle extent = l->extent(); // layer extent by default
if ( l->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( l );
if ( vl && vl->featureCount() == 0 )
{
// if there's no feature, use the wms extent defined in the
// project...
extent = QgsServerProjectUtils::wmsExtent( *project );
if ( extent.isNull() )
{
// or the CRS extent otherwise
extent = vl->crs().bounds();
}
}
}

appendLayerBoundingBoxes( doc, layerElem, extent, l->crs(), crsList, outputCrsList, project );
}

// add details about supported styles of the layer
Expand Down

0 comments on commit da22f7c

Please sign in to comment.