Skip to content
Permalink
Browse files

Mapserver: fixed GetFeatureInfo request on raster layers

  • Loading branch information
Marcel Dancak
Marcel Dancak committed Sep 30, 2014
1 parent b044d4d commit c17957fec99076de292af2bbf5d89d1e3063088f
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/mapserver/qgswmsserver.cpp
@@ -2030,10 +2030,15 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,
if ( infoFormat == "application/vnd.ogc.gml" )
{
QgsFeature feature;
QgsFields fields;
feature.initAttributes( attributes.count() );
int index = 0;
for ( QMap<int, QVariant>::const_iterator it = attributes.constBegin(); it != attributes.constEnd(); ++it )
{
feature.setAttribute( layer->bandName( it.key() ), QString::number( it.value().toDouble() ) );
fields.append( QgsField( layer->bandName( it.key() ), QVariant::Double ) );
feature.setAttribute( index++, QString::number( it.value().toDouble() ) );
}
feature.setFields( &fields );

QgsCoordinateReferenceSystem layerCrs = layer->crs();
int version = infoFormat.startsWith( "application/vnd.ogc.gml/3" ) ? 3 : 2;
@@ -2830,14 +2835,13 @@ QDomElement QgsWMSServer::createFeatureGML(
}

//read all allowed attribute values from the feature
const QSet<QString>& excludedAttributes = layer->excludeAttributesWMS();
QgsAttributes featureAttributes = feat->attributes();
const QgsFields* fields = feat->fields();
for ( int i = 0; i < fields->count(); ++i )
{
QString attributeName = fields->at( i ).name();
//skip attribute if it is explicitly excluded from WMS publication
if ( excludedAttributes.contains( attributeName ) )
if ( layer && layer->excludeAttributesWMS().contains( attributeName ) )
{
continue;
}

0 comments on commit c17957f

Please sign in to comment.
You can’t perform that action at this time.