File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -120,23 +120,21 @@ bool QgsVectorLayerImport::addFeature( QgsFeature& feat )
120
120
{
121
121
const QgsAttributeMap &attrs = feat.attributeMap ();
122
122
123
- QgsAttributeMap newAttrs;
123
+ QgsFeature newFeat;
124
+ newFeat.setGeometry ( *feat.geometry () );
125
+
124
126
for ( QgsAttributeMap::const_iterator it = attrs.begin (); it != attrs.end (); it++ )
125
127
{
128
+ // add only mapped attributes (un-mapped ones are not present in the
129
+ // destination layer)
126
130
if ( mOldToNewAttrIdx .contains ( it.key () ) )
127
131
{
128
132
QgsDebugMsgLevel ( QString ( " moving field from pos %1 to %2" ).arg ( it.key () ).arg ( mOldToNewAttrIdx .value ( it.key () ) ), 3 );
129
- newAttrs.insert ( mOldToNewAttrIdx .value ( it.key () ), *it );
130
- }
131
- else
132
- {
133
- QgsDebugMsgLevel ( QString ( " added attr pos %1" ).arg ( it.key () ), 3 );
134
- newAttrs.insert ( it.key (), *it );
133
+ newFeat.addAttribute ( mOldToNewAttrIdx .value ( it.key () ), *it );
135
134
}
136
135
}
137
- feat.setAttributeMap ( newAttrs );
138
136
139
- mFeatureBuffer .append ( feat );
137
+ mFeatureBuffer .append ( newFeat );
140
138
141
139
if ( mFeatureBuffer .count () >= FEATURE_BUFFER_SIZE )
142
140
{
You can’t perform that action at this time.
0 commit comments