[BUGFIX][Server] DescribeFeature does not clean attribute name and GetFeature update

This commit is contained in:
rldhont 2018-03-19 17:49:07 +01:00
parent 16ba918bc8
commit 9b7ef06aa2
2 changed files with 8 additions and 2 deletions

View File

@ -263,7 +263,7 @@ namespace QgsWfs
//xsd:element
QDomElement attElem = doc.createElement( QStringLiteral( "element" )/*xsd:element*/ );
attElem.setAttribute( QStringLiteral( "name" ), attributeName );
attElem.setAttribute( QStringLiteral( "name" ), attributeName.replace( ' ', '_' ) );
QVariant::Type attributeType = fields.at( idx ).type();
if ( attributeType == QVariant::Int )
attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "integer" ) );

View File

@ -248,11 +248,17 @@ namespace QgsWfs
QStringList::const_iterator plstIt;
QList<int> idxList;
QgsFields fields = vlayer->fields();
// build corresponding propertyname
QList<QString> propertynames;
for ( int idx = 0; idx < fields.count(); ++idx )
{
propertynames.append( fields.field( idx ).name().replace( ' ', '_' ) );
}
QString fieldName;
for ( plstIt = propertyList.begin(); plstIt != propertyList.end(); ++plstIt )
{
fieldName = *plstIt;
int fieldNameIdx = fields.lookupField( fieldName );
int fieldNameIdx = propertynames.indexOf( fieldName );
if ( fieldNameIdx > -1 )
{
idxList.append( fieldNameIdx );