Skip to content

Commit

Permalink
[BUGFIX][QGIS Server] WFS GetFeature with propertyname retrieves requ…
Browse files Browse the repository at this point in the history
…ested fields
  • Loading branch information
rldhont committed Apr 29, 2016
1 parent f48e74f commit ea1d17c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/server/qgswfsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++ )
Expand All @@ -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 );
}
}
}
Expand Down Expand Up @@ -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 != "*" )
{
Expand All @@ -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() )
Expand Down

0 comments on commit ea1d17c

Please sign in to comment.