File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2030,10 +2030,15 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,
2030
2030
if ( infoFormat == " application/vnd.ogc.gml" )
2031
2031
{
2032
2032
QgsFeature feature;
2033
+ QgsFields fields;
2034
+ feature.initAttributes ( attributes.count () );
2035
+ int index = 0 ;
2033
2036
for ( QMap<int , QVariant>::const_iterator it = attributes.constBegin (); it != attributes.constEnd (); ++it )
2034
2037
{
2035
- feature.setAttribute ( layer->bandName ( it.key () ), QString::number ( it.value ().toDouble () ) );
2038
+ fields.append ( QgsField ( layer->bandName ( it.key () ), QVariant::Double ) );
2039
+ feature.setAttribute ( index++, QString::number ( it.value ().toDouble () ) );
2036
2040
}
2041
+ feature.setFields ( &fields );
2037
2042
2038
2043
QgsCoordinateReferenceSystem layerCrs = layer->crs ();
2039
2044
int version = infoFormat.startsWith ( " application/vnd.ogc.gml/3" ) ? 3 : 2 ;
@@ -2830,14 +2835,13 @@ QDomElement QgsWMSServer::createFeatureGML(
2830
2835
}
2831
2836
2832
2837
// read all allowed attribute values from the feature
2833
- const QSet<QString>& excludedAttributes = layer->excludeAttributesWMS ();
2834
2838
QgsAttributes featureAttributes = feat->attributes ();
2835
2839
const QgsFields* fields = feat->fields ();
2836
2840
for ( int i = 0 ; i < fields->count (); ++i )
2837
2841
{
2838
2842
QString attributeName = fields->at ( i ).name ();
2839
2843
// skip attribute if it is explicitly excluded from WMS publication
2840
- if ( excludedAttributes .contains ( attributeName ) )
2844
+ if ( layer && layer-> excludeAttributesWMS () .contains ( attributeName ) )
2841
2845
{
2842
2846
continue ;
2843
2847
}
You can’t perform that action at this time.
0 commit comments