fix Merge shapefiles tool in fTools (fix #7570)

This commit is contained in:
Alexander Bruy 2013-04-11 15:22:03 +04:00
parent 6ebedbc59d
commit f8834f201a

View File

@ -283,8 +283,12 @@ class ShapeMergeThread( QThread ):
self.geom = newLayer.wkbType()
vprovider = newLayer.dataProvider()
fields = QgsFields()
for f in mergedFields:
fields.append(f)
writer = QgsVectorFileWriter( self.outputFileName, self.outputEncoding,
mergedFields, self.geom, self.crs )
fields, self.geom, self.crs )
shapeIndex = 0
for fileName in self.shapes:
@ -308,8 +312,8 @@ class ShapeMergeThread( QThread ):
# fill available attributes with values
fieldIndex = 0
for v in inFeat.attributes():
if fieldMap.has_key(shapeIndex) and fieldMap[shapeIndex].has_key(layerIndex):
mergedAttrs[ fieldMap[shapeIndex][layerIndex] ] = v
if fieldMap.has_key(shapeIndex) and fieldMap[shapeIndex].has_key(fieldIndex):
mergedAttrs[ fieldMap[shapeIndex][fieldIndex] ] = v
fieldIndex += 1
inGeom = QgsGeometry( inFeat.geometry() )