[QGIS Commit] r10867 - trunk/qgis/src/providers/wfs
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun May 31 08:10:28 EDT 2009
Author: mhugent
Date: 2009-05-31 08:10:28 -0400 (Sun, 31 May 2009)
New Revision: 10867
Modified:
trunk/qgis/src/providers/wfs/qgswfsdata.cpp
Log:
Fix for problem with features that cannot be exported to shape
Modified: trunk/qgis/src/providers/wfs/qgswfsdata.cpp
===================================================================
--- trunk/qgis/src/providers/wfs/qgswfsdata.cpp 2009-05-31 07:43:15 UTC (rev 10866)
+++ trunk/qgis/src/providers/wfs/qgswfsdata.cpp 2009-05-31 12:10:28 UTC (rev 10867)
@@ -313,10 +313,24 @@
}
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" )
More information about the QGIS-commit
mailing list