Skip to content
Permalink
Browse files

[processing] fix wrong tools description (fix #9852)

  • Loading branch information
alexbruy committed Mar 24, 2014
1 parent 7c2038d commit 3797ffae4132916a056045acefc7378d97abbb0c
@@ -43,7 +43,7 @@ class PointsFromLines(GeoAlgorithm):
OUTPUT_LAYER = 'OUTPUT_LAYER'

def defineCharacteristics(self):
self.name = 'Get raster values at line nodes'
self.name = 'Generate points (pixel centroids) along line'
self.group = 'Vector analysis tools'

self.addParameter(ParameterRaster(self.INPUT_RASTER, 'Raster layer'))
@@ -32,7 +32,7 @@
from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterVector import ParameterVector
from processing.outputs.OutputVector import OutputVector
from processing.tools import dataobjects, vector
from processing.tools import dataobjects, vector, raster
from processing.tools.general import *


@@ -44,7 +44,7 @@ class PointsFromPolygons(GeoAlgorithm):
OUTPUT_LAYER = 'OUTPUT_LAYER'

def defineCharacteristics(self):
self.name = 'Get raster values at polygon nodes'
self.name = 'Generate points (pixel centroids) inside polygons'
self.group = 'Vector analysis tools'

self.addParameter(ParameterRaster(self.INPUT_RASTER, 'Raster layer'))
@@ -92,12 +92,12 @@ def processAlgorithm(self, progress):
yMin = bbox.yMinimum()
yMax = bbox.yMaximum()

(startRow, startColumn) = mapToPixel(xMin, yMax, geoTransform)
(endRow, endColumn) = mapToPixel(xMax, yMin, geoTransform)
(startRow, startColumn) = raster.mapToPixel(xMin, yMax, geoTransform)
(endRow, endColumn) = raster.mapToPixel(xMax, yMin, geoTransform)

for row in xrange(startRow, endRow + 1):
for col in xrange(startColumn, endColumn + 1):
(x, y) = pixelToMap(row, col, geoTransform)
(x, y) = raster.pixelToMap(row, col, geoTransform)
point.setX(x)
point.setY(y)

@@ -5,13 +5,13 @@

from qgis.core import *

vector = processing.getobject(Input_vector)
raster = processing.getobject(Input_raster)
vector = processing.getObject(Input_vector)
raster = processing.getObject(Input_raster)

geometryType = vector.geometryType()
if geometryType == QGis.Point:
processing.runalg('qgis:saveselectedfeatures', vector, Output_layer)
elif geometryType == QGis.Line:
processing.runalg('qgis:pointsfromlines', raster, vector, Output_layer)
processing.runalg('qgis:generatepointspixelcentroidsalongline', raster, vector, Output_layer)
elif geometryType == QGis.Polygon:
processing.runalg('qgis:pointsfrompolygons', raster, vector, Output_layer)
processing.runalg('qgis:generatepointspixelcentroidsinsidepolygons', raster, vector, Output_layer)

0 comments on commit 3797ffa

Please sign in to comment.
You can’t perform that action at this time.