Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for problem with features that cannot be exported to shape
git-svn-id: http://svn.osgeo.org/qgis/trunk@10867 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 31, 2009
1 parent 63a5d29 commit 0862fd1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/providers/wfs/qgswfsdata.cpp
Expand Up @@ -313,10 +313,24 @@ void QgsWFSData::endElement( const XML_Char* el )
}
else if ( elementName == GML_NAMESPACE + NS_SEPARATOR + "featureMember" )
{
//MH090531: Check if all feature attributes are initialised, sometimes attribute values are missing.
//We fill the not initialized ones with empty strings, otherwise the feature cannot be exported to shp later
QgsAttributeMap currentFeatureAttributes = mCurrentFeature->attributeMap();
QMap<QString, QPair<int, QgsField> >::const_iterator att_it = mThematicAttributes.constBegin();
for(; att_it != mThematicAttributes.constEnd(); ++att_it)
{
int attIndex = att_it.value().first;
QgsAttributeMap::const_iterator findIt = currentFeatureAttributes.find(attIndex);
if(findIt == currentFeatureAttributes.constEnd())
{
mCurrentFeature->addAttribute(attIndex, QVariant(""));
}
}


mCurrentFeature->setGeometryAndOwnership( mCurrentWKB, mCurrentWKBSize );
mFeatures << mCurrentFeature;
++mFeatureCount;
//qWarning("Removing featureMember from stack");
mParseModeStack.pop();
}
else if ( elementName == GML_NAMESPACE + NS_SEPARATOR + "Point" )
Expand Down

0 comments on commit 0862fd1

Please sign in to comment.