Skip to content

Commit

Permalink
[processing] use numeric parameter for buffer distance
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Nov 12, 2016
1 parent 256efcc commit e1ee477
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions python/plugins/processing/algs/gdal/ogr2ogrbuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterString
from processing.core.parameters import ParameterNumber
from processing.core.parameters import ParameterBoolean
from processing.core.parameters import ParameterTableField
from processing.core.outputs import OutputVector
Expand Down Expand Up @@ -59,8 +60,10 @@ def defineCharacteristics(self):
self.addParameter(ParameterString(self.GEOMETRY,
self.tr('Geometry column name ("geometry" for Shapefiles, may be different for other formats)'),
'geometry', optional=False))
self.addParameter(ParameterString(self.DISTANCE,
self.tr('Buffer distance'), '1000', optional=False))
self.addParameter(ParameterNumber(self.DISTANCE,
self.tr('Buffer distance'),
0.0, 99999999.999999, 1000.0,
optional=False))
self.addParameter(ParameterBoolean(self.DISSOLVEALL,
self.tr('Dissolve all results'), False))
self.addParameter(ParameterTableField(self.FIELD,
Expand Down Expand Up @@ -124,4 +127,4 @@ def getConsoleCommands(self):
return commands

def commandName(self):
return "ogr2ogr"
return 'ogr2ogr'
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ tests:
name: OGR buffer lines
params:
DISSOLVEALL: false
DISTANCE: '1'
DISTANCE: 1.0
GEOMETRY: geometry
INPUT_LAYER:
name: lines.gml
Expand All @@ -91,7 +91,7 @@ tests:
name: OGR basic polygon buffer
params:
DISSOLVEALL: false
DISTANCE: '0.5'
DISTANCE: 0.5
GEOMETRY: geometry
INPUT_LAYER:
name: polys.gml
Expand All @@ -106,7 +106,7 @@ tests:
name: OGR polygon buffer with dissolve
params:
DISSOLVEALL: true
DISTANCE: '0.5'
DISTANCE: 0.5
GEOMETRY: geometry
INPUT_LAYER:
name: polys.gml
Expand Down

0 comments on commit e1ee477

Please sign in to comment.