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 f48e74f commit ea1d17c
Showing 1 changed file with 11 additions and 12 deletions.
@@ -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 ea1d17c

Please sign in to comment.