Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix failing test
  • Loading branch information
nyalldawson committed Aug 13, 2017
1 parent 1a56487 commit 97a8d1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
28 changes: 10 additions & 18 deletions python/plugins/processing/algs/gdal/ogr2ogrpointsonlines.py
Expand Up @@ -31,26 +31,19 @@
QgsProcessingParameterNumber,
QgsProcessingParameterVectorDestination,
QgsProcessingOutputVectorLayer,
QgsProcessing,
QgsVectorFileWriter,
QgsVectorLayer)
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterString
from processing.core.parameters import ParameterNumber
from processing.core.outputs import OutputVector
QgsProcessing)

from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

from processing.tools import dataobjects
from processing.tools.system import isWindows
from processing.tools.vector import ogrConnectionString, ogrLayerName
from processing.tools.vector import ogrConnectionString


class Ogr2OgrPointsOnLines(GdalAlgorithm):

OUTPUT_LAYER = 'OUTPUT_LAYER'
INPUT_LAYER = 'INPUT_LAYER'
OUTPUT = 'OUTPUT'
INPUT = 'INPUT'
DISTANCE = 'DISTANCE'
GEOMETRY = 'GEOMETRY'
OPTIONS = 'OPTIONS'
Expand All @@ -59,7 +52,7 @@ def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT_LAYER,
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer'), [QgsProcessing.TypeVectorLine], optional=False))
self.addParameter(QgsProcessingParameterString(self.GEOMETRY,
self.tr('Geometry column name ("geometry" for Shapefiles, may be different for other formats)'),
Expand All @@ -70,8 +63,7 @@ def initAlgorithm(self, config=None):
self.tr('Additional creation options (see ogr2ogr manual)'),
defaultValue='', optional=True))

self.addParameter(QgsProcessingParameterVectorDestination(self.OUTPUT_LAYER, self.tr('Points along lines'), QgsProcessing.TypeVectorPoint))
self.addOutput(QgsProcessingOutputVectorLayer(self.OUTPUT_LAYER, self.tr("Points along lines"), QgsProcessing.TypeVectorPoint))
self.addParameter(QgsProcessingParameterVectorDestination(self.OUTPUT, self.tr('Points along lines'), QgsProcessing.TypeVectorPoint))

def name(self):
return 'createpointsalonglines'
Expand All @@ -83,15 +75,15 @@ def group(self):
return self.tr('Vector geoprocessing')

def getConsoleCommands(self, parameters, context, feedback):
ogrLayer, layername = self.getOgrCompatibleSource(self.INPUT_LAYER, parameters, context, feedback)
ogrLayer, layername = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback)

distance = str(self.parameterAsDouble(parameters, self.DISTANCE, context))
geometry = str(self.parameterAsString(parameters, self.GEOMETRY, context))
geometry = self.parameterAsString(parameters, self.GEOMETRY, context)

outFile = self.parameterAsOutputLayer(parameters, self.OUTPUT_LAYER, context)
outFile = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)

output = ogrConnectionString(outFile, context)
options = str(self.parameterAsString(parameters, self.OPTIONS, context))
options = self.parameterAsString(parameters, self.OPTIONS, context)

arguments = []
arguments.append(output)
Expand Down
Expand Up @@ -95,11 +95,11 @@ tests:
params:
DISTANCE: 0.25
GEOMETRY: geometry
INPUT_LAYER:
INPUT:
name: lines.gml
type: vector
results:
OUTPUT_LAYER:
OUTPUT:
name: expected/gdal/points_along_lines.gml
type: vector

Expand Down

0 comments on commit 97a8d1a

Please sign in to comment.