Skip to content
Permalink
Browse files

[BUGFIX][QGIS Server] WFS GetFeature with propertyname retrieves requ…

…ested fields
  • Loading branch information
rldhont committed Apr 29, 2016
1 parent 4276167 commit dc94df51a689a45258d2017c81e1e750f72ae4c8
Showing with 11 additions and 12 deletions.
  1. +11 −12 src/server/qgswfsserver.cpp
@@ -507,16 +507,16 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
QgsFeature feature;

mWithGeom = true;
//QgsAttributeList attrIndexes = provider->attributeIndexes();

//Using pending attributes and pending fields
QgsAttributeList attrIndexes = layer->pendingAllAttributesList();

QDomNodeList queryChildNodes = queryElem.childNodes();
if ( queryChildNodes.size() )
{
QStringList::const_iterator alstIt;
QList<int> idxList;
QMap<QString, int> fieldMap = provider->fieldNameMap();
QMap<QString, int>::const_iterator fieldIt;
QgsFields fields = layer->pendingFields();
QString fieldName;
QDomElement propertyElem;
for ( int q = 0; q < queryChildNodes.size(); q++ )
@@ -529,10 +529,10 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
{
fieldName = fieldName.section( ":", 1, 1 );
}
fieldIt = fieldMap.find( fieldName );
if ( fieldIt != fieldMap.end() )
int fieldNameIdx = fields.fieldNameIndex( fieldName );
if ( fieldNameIdx > -1 )
{
idxList.append( fieldIt.value() );
idxList.append( fieldNameIdx );
}
}
}
@@ -896,7 +896,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
//map extent
searchRect = layer->extent();

//QgsAttributeList attrIndexes = provider->attributeIndexes();
//Using pending attributes and pending fields
QgsAttributeList attrIndexes = layer->pendingAllAttributesList();
if ( mPropertyName != "*" )
{
@@ -905,16 +905,15 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
{
QStringList::const_iterator alstIt;
QList<int> idxList;
QMap<QString, int> fieldMap = provider->fieldNameMap();
QMap<QString, int>::const_iterator fieldIt;
QgsFields fields = layer->pendingFields();
QString fieldName;
for ( alstIt = attrList.begin(); alstIt != attrList.end(); ++alstIt )
{
fieldName = *alstIt;
fieldIt = fieldMap.find( fieldName );
if ( fieldIt != fieldMap.end() )
int fieldNameIdx = fields.fieldNameIndex( fieldName );
if ( fieldNameIdx > -1 )
{
idxList.append( fieldIt.value() );
idxList.append( fieldNameIdx );
}
}
if ( !idxList.isEmpty() )

0 comments on commit dc94df5

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