Skip to content
Permalink
Browse files
[sextante] fixed PointsInPolygonWeighted and PointsLayerFromTable alg…
…orithms
  • Loading branch information
volaya committed Feb 26, 2013
1 parent e60891c commit 7267c6e765117ab2c84119cf84be30862fb61aa4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
@@ -39,11 +39,6 @@ class PointsLayerFromTable(GeoAlgorithm):
YFIELD = "YFIELD"
OUTPUT = "OUTPUT"

#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/../images/toolbox.png")
#===========================================================================

def processAlgorithm(self, progress):
source = self.getParameterValue(self.INPUT)
vlayer = QGisLayers.getObjectFromUri(source)
@@ -79,7 +74,7 @@ def defineCharacteristics(self):
self.name = "Points layer from table"
self.group = "Vector creation tools"
self.addParameter(ParameterTable(self.INPUT, "Input layer"))
self.addParameter(ParameterTableField(self.XFIELD, "X field", self.INPUT, ParameterTableField.DATA_TYPE_NUMBER))
self.addParameter(ParameterTableField(self.YFIELD, "Y field", self.INPUT, ParameterTableField.DATA_TYPE_NUMBER))
self.addParameter(ParameterTableField(self.XFIELD, "X field", self.INPUT, ParameterTableField.DATA_TYPE_ANY))
self.addParameter(ParameterTableField(self.YFIELD, "Y field", self.INPUT, ParameterTableField.DATA_TYPE_ANY))
self.addOutput(OutputVector(self.OUTPUT, "Output layer"))

@@ -106,15 +106,15 @@ def processAlgorithm(self, progress):
hasIntersections = True

if hasIntersections:
for i in points:
pointLayer.featureAtId(int(i), ftPoint, True, True)
progress.setText(str(len(points)))
for i in points:
pointLayer.featureAtId(int(i), ftPoint, True, True)
tmpGeom = QgsGeometry(ftPoint.geometry())
if geom.contains(tmpGeom):
try:
weight = float(ftPoint.attributes()[fieldidx])
except:
weight = 1
count += weight
#try:
weight, ok = ftPoint.attributes()[fieldidx].toDouble()
if ok:
count += weight

outFeat.setGeometry(geom)
if idxCount == len(atMap):

0 comments on commit 7267c6e

Please sign in to comment.