Skip to content

Commit

Permalink
[ftools] Several fixes
Browse files Browse the repository at this point in the history
Fix #8107 Mean coordinates
Fix #8105 Basic statistics
Fix #8104 Unique values
  • Loading branch information
m-kuhn committed Jun 18, 2013
1 parent 59fd5e0 commit 5e4a9df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 5 additions & 4 deletions python/plugins/fTools/tools/doMeanCoords.py
Expand Up @@ -134,6 +134,7 @@ def compute(self, inName, outName, weightField="", times=1, uniqueField=""):
fieldList.append( QgsField("UID", QVariant.String) )
writer = QgsVectorFileWriter(self.shapefileName, self.encoding, fieldList, QGis.WKBPoint, sRs)
outfeat = QgsFeature()
outfeat.setFields( fieldList )
points = []
weights = []
nFeat = provider.featureCount() * len(uniqueValues)
Expand All @@ -150,16 +151,16 @@ def compute(self, inName, outName, weightField="", times=1, uniqueField=""):
nElement += 1
self.progressBar.setValue(nElement)
if single:
check = j.strip()
check = unicode(j).strip()
else:
check = feat.attributes()[uniqueIndex].strip()
if check == j.strip():
check = unicode(feat[uniqueIndex]).strip()
if check == unicode(j).strip():
cx = 0.00
cy = 0.00
if weightIndex == -1:
weight = 1.00
else:
weight = float(feat.attributes()[weightIndex])
weight = float(feat[weightIndex])
geom = QgsGeometry(feat.geometry())
geom = ftools_utils.extractPoints(geom)
for i in geom:
Expand Down
3 changes: 1 addition & 2 deletions python/plugins/fTools/tools/doVisual.py
Expand Up @@ -245,7 +245,7 @@ def list_unique_values( self, vlayer, myField ):
for item in unique:
nElement += 1
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
lstUnique.append(item.strip())
lstUnique.append(unicode(item).strip())
lstCount = len( unique )
return ( lstUnique, lstCount )

Expand Down Expand Up @@ -412,7 +412,6 @@ def nearest_neighbour_analysis( self, vlayer ):
A = vlayer.extent()
A = float( A.width() * A.height() )
index = ftools_utils.createIndex( vprovider )
vprovider.rewind()
nFeat = vprovider.featureCount()
nElement = 0
if nFeat > 0:
Expand Down

0 comments on commit 5e4a9df

Please sign in to comment.