Skip to content

Commit

Permalink
Merge pull request #1419 from marcel-dancak/master
Browse files Browse the repository at this point in the history
Mapserver's GetProjectSettings/GetFeatureInfo bug-fixes
  • Loading branch information
mhugent committed Jun 6, 2014
2 parents 4850111 + bf82848 commit 126c3d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/mapserver/qgsserverprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,9 +649,14 @@ void QgsServerProjectParser::addLayerProjectSettings( QDomElement& layerElem, QD
displayField = vLayer->attributeDisplayName( idx );
}
QDomElement attributeElem = doc.createElement( "Attribute" );
attributeElem.setAttribute( "name", vLayer->attributeDisplayName( idx ) );
attributeElem.setAttribute( "name", field.name() );
attributeElem.setAttribute( "type", QVariant::typeToName( field.type() ) );
attributeElem.setAttribute( "typeName", field.typeName() );
QString alias = vLayer->attributeAlias( idx );
if ( !alias.isEmpty() )
{
attributeElem.setAttribute( "alias", alias );
}

//edit type to text
attributeElem.setAttribute( "editType", vLayer->editorWidgetV2( idx ) );
Expand Down
8 changes: 7 additions & 1 deletion src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2869,12 +2869,18 @@ QDomElement QgsWMSServer::createFeatureGML(
}
}

//read all attribute values from the feature
//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 ) )
{
continue;
}
QDomElement fieldElem = doc.createElement( "qgs:" + attributeName.replace( QString( " " ), QString( "_" ) ) );
QString fieldTextString = featureAttributes[i].toString();
if ( layer )
Expand Down

0 comments on commit 126c3d3

Please sign in to comment.