Skip to content

Commit 51cba99

Browse files
committed
[BUGFIX][Server] DescribeFeature does not clean attribute name and GetFeature update
1 parent 6a027e7 commit 51cba99

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/server/services/wfs/qgswfsdescribefeaturetype.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ namespace QgsWfs
263263

264264
//xsd:element
265265
QDomElement attElem = doc.createElement( QStringLiteral( "element" )/*xsd:element*/ );
266-
attElem.setAttribute( QStringLiteral( "name" ), attributeName );
266+
attElem.setAttribute( QStringLiteral( "name" ), attributeName.replace( ' ', '_' ) );
267267
QVariant::Type attributeType = fields.at( idx ).type();
268268
if ( attributeType == QVariant::Int )
269269
attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "integer" ) );

src/server/services/wfs/qgswfsgetfeature.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,17 @@ namespace QgsWfs
248248
QStringList::const_iterator plstIt;
249249
QList<int> idxList;
250250
QgsFields fields = vlayer->fields();
251+
// build corresponding propertyname
252+
QList<QString> propertynames;
253+
for ( int idx = 0; idx < fields.count(); ++idx )
254+
{
255+
propertynames.append( fields.field( idx ).name().replace( ' ', '_' ) );
256+
}
251257
QString fieldName;
252258
for ( plstIt = propertyList.begin(); plstIt != propertyList.end(); ++plstIt )
253259
{
254260
fieldName = *plstIt;
255-
int fieldNameIdx = fields.lookupField( fieldName );
261+
int fieldNameIdx = propertynames.indexOf( fieldName );
256262
if ( fieldNameIdx > -1 )
257263
{
258264
idxList.append( fieldNameIdx );

0 commit comments

Comments
 (0)