Skip to content

Commit c3417bb

Browse files
committedSep 13, 2017
[BUFIX][Server] GetFeatureInfo on Raster Layer, fix valid identify
Needs to be manually apply to QGIS 3 Funded by Ifremer
1 parent d8fa85e commit c3417bb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎src/server/qgswmsserver.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,19 +2535,23 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,
25352535
{
25362536
return 1;
25372537
}
2538-
QMap<int, QVariant> attributes;
2538+
QgsRasterIdentifyResult identifyResult;
25392539
// use context extent, width height (comes with request) to use WCS cache
25402540
// We can only use context if raster is not reprojected, otherwise it is difficult
25412541
// to guess correct source resolution
25422542
if ( mMapRenderer->hasCrsTransformEnabled() && layer->dataProvider()->crs() != mMapRenderer->destinationCrs() )
25432543
{
2544-
attributes = layer->dataProvider()->identify( *infoPoint, QgsRaster::IdentifyFormatValue ).results();
2544+
identifyResult = layer->dataProvider()->identify( *infoPoint, QgsRaster::IdentifyFormatValue );
25452545
}
25462546
else
25472547
{
2548-
attributes = layer->dataProvider()->identify( *infoPoint, QgsRaster::IdentifyFormatValue, mMapRenderer->extent(), mMapRenderer->outputSize().width(), mMapRenderer->outputSize().height() ).results();
2548+
identifyResult = layer->dataProvider()->identify( *infoPoint, QgsRaster::IdentifyFormatValue, mMapRenderer->extent(), mMapRenderer->outputSize().width(), mMapRenderer->outputSize().height() );
25492549
}
25502550

2551+
if ( !identifyResult.isValid() )
2552+
return 1;
2553+
2554+
QMap<int, QVariant> attributes = identifyResult.results();
25512555
if ( infoFormat == "application/vnd.ogc.gml" )
25522556
{
25532557
QgsFeature feature;

0 commit comments

Comments
 (0)
Please sign in to comment.