mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	Fixed Split vector layer algorithm
Previously it would leave all output files except for the first one empty
This commit is contained in:
		
							parent
							
								
									aab3bfddc4
								
							
						
					
					
						commit
						efcbe2f55b
					
				@ -67,13 +67,12 @@ class VectorSplit(GeoAlgorithm):
 | 
			
		||||
        geomType = layer.wkbType()
 | 
			
		||||
 | 
			
		||||
        total = 100.0 / len(uniqueValues)
 | 
			
		||||
        features = vector.features(layer)
 | 
			
		||||
 | 
			
		||||
        for count, i in enumerate(uniqueValues):
 | 
			
		||||
            fName = u'{0}_{1}.shp'.format(baseName, unicode(i).strip())
 | 
			
		||||
 | 
			
		||||
            writer = vector.VectorWriter(fName, None, fields, geomType, crs)
 | 
			
		||||
            for f in features:
 | 
			
		||||
            for f in vector.features(layer):
 | 
			
		||||
                if f[fieldName] == i:
 | 
			
		||||
                    writer.addFeature(f)
 | 
			
		||||
            del writer
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user