Skip to content
Permalink
Browse files

[processing] simple test for ogr buffering

  • Loading branch information
alexbruy committed Nov 12, 2016
1 parent 159fda6 commit 5991eccb472d0efdb7c36ce7cfb2c48205736751
@@ -111,7 +111,7 @@ def getConsoleCommands(self):
if field is not None and multi:
arguments.append('-explodecollections')

if len(options) > 0:
if options is not None and len(options) > 0:
arguments.append(options)

commands = []
@@ -0,0 +1,16 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>buffer_lines</Name>
<ElementPath>buffer_lines</ElementPath>
<!--POLYGON-->
<GeometryType>3</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>7</FeatureCount>
<ExtentXMin>-2.00000</ExtentXMin>
<ExtentXMax>12.00000</ExtentXMax>
<ExtentYMin>-4.00000</ExtentYMin>
<ExtentYMax>6.00000</ExtentYMax>
</DatasetSpecificInfo>
</GMLFeatureClass>
</GMLFeatureClassList>

Large diffs are not rendered by default.

@@ -72,3 +72,17 @@ tests:
- 'Geometry: Line String'
- 'Feature Count: [6|7]' # On some platforms returns 6 instead of 7...

- algorithm: gdalogr:buffervectors
name: OGR buffer lines
params:
DISSOLVEALL: false
DISTANCE: '1'
GEOMETRY: geometry
INPUT_LAYER:
name: lines.gml
type: vector
MULTI: false
results:
OUTPUT_LAYER:
name: expected/gdal/buffer_lines.gml
type: vector
@@ -331,12 +331,7 @@ def exportVectorLayer(layer, supported=None):
del writer
return output
else:
isASCII = True
try:
str(layer.source())
except UnicodeEncodeError:
isASCII = False
if not os.path.splitext(layer.source())[1].lower() in supported or not isASCII:
if not os.path.splitext(layer.source())[1].lower() in supported:
writer = QgsVectorFileWriter(
output, systemEncoding,
layer.fields(), layer.wkbType(),
@@ -347,7 +342,7 @@ def exportVectorLayer(layer, supported=None):
del writer
return output
else:
return str(layer.source())
return layer.source()


def exportRasterLayer(layer):
@@ -538,7 +538,6 @@ def ogrConnectionString(uri):
return '"' + ogrstr + '"'


#
# The uri parameter is an URI from any QGIS provider,
# so could have different formats.
# Example formats:
@@ -623,7 +622,7 @@ def __init__(self, destination, encoding, fields, geometryType,

if encoding is None:
settings = QSettings()
encoding = settings.value('/Processing/encoding', 'System', type=str)
encoding = settings.value('/Processing/encoding', 'System', str)

if self.destination.startswith(self.MEMORY_LAYER_PREFIX):
self.isNotFileBased = True
@@ -650,8 +649,6 @@ def __init__(self, destination, encoding, fields, geometryType,
QgsCredentials.instance().put(connInfo, user, passwd)
else:
raise GeoAlgorithmExecutionException("Couldn't connect to database")
# fix_print_with_import
print(uri.uri())
try:
db = postgis.GeoDB(host=uri.host(), port=int(uri.port()),
dbname=uri.database(), user=user, passwd=passwd)
@@ -682,8 +679,6 @@ def _runSQL(sql):
elif self.destination.startswith(self.SPATIALITE_LAYER_PREFIX):
self.isNotFileBased = True
uri = QgsDataSourceUri(self.destination[len(self.SPATIALITE_LAYER_PREFIX):])
# fix_print_with_import
print(uri.uri())
try:
db = spatialite.GeoDB(uri=uri)
except spatialite.DbError as e:

0 comments on commit 5991ecc

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