File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -313,10 +313,24 @@ void QgsWFSData::endElement( const XML_Char* el )
313313 }
314314 else if ( elementName == GML_NAMESPACE + NS_SEPARATOR + " featureMember" )
315315 {
316+ // MH090531: Check if all feature attributes are initialised, sometimes attribute values are missing.
317+ // We fill the not initialized ones with empty strings, otherwise the feature cannot be exported to shp later
318+ QgsAttributeMap currentFeatureAttributes = mCurrentFeature ->attributeMap ();
319+ QMap<QString, QPair<int , QgsField> >::const_iterator att_it = mThematicAttributes .constBegin ();
320+ for (; att_it != mThematicAttributes .constEnd (); ++att_it)
321+ {
322+ int attIndex = att_it.value ().first ;
323+ QgsAttributeMap::const_iterator findIt = currentFeatureAttributes.find (attIndex);
324+ if (findIt == currentFeatureAttributes.constEnd ())
325+ {
326+ mCurrentFeature ->addAttribute (attIndex, QVariant (" " ));
327+ }
328+ }
329+
330+
316331 mCurrentFeature ->setGeometryAndOwnership ( mCurrentWKB , mCurrentWKBSize );
317332 mFeatures << mCurrentFeature ;
318333 ++mFeatureCount ;
319- // qWarning("Removing featureMember from stack");
320334 mParseModeStack .pop ();
321335 }
322336 else if ( elementName == GML_NAMESPACE + NS_SEPARATOR + " Point" )
You can’t perform that action at this time.
0 commit comments