Skip to content

Commit

Permalink
[processing][ogr] Fix conversion of non-disk based layer sources
Browse files Browse the repository at this point in the history
to GDAL commands

Fixes #19946
  • Loading branch information
nyalldawson committed Sep 28, 2018
1 parent f1ced30 commit 7977450
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/GdalAlgorithm.py
Expand Up @@ -115,7 +115,7 @@ def getOgrCompatibleSource(self, parameter_name, parameters, context, feedback,
else:
# vector layer, but not OGR - get OGR compatible path
# TODO - handle "selected features only" mode!!
ogr_data_path = GdalUtils.ogrConnectionString(input_layer.dataProvider().dataSourceUri(), context)
ogr_data_path = GdalUtils.ogrConnectionStringFromLayer(input_layer)
ogr_layer_name = GdalUtils.ogrLayerName(input_layer.dataProvider().dataSourceUri())
return ogr_data_path, ogr_layer_name

Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/gdal/GdalUtils.py
Expand Up @@ -259,10 +259,10 @@ def gdalHelpPath():
return helpPath if helpPath is not None else 'http://www.gdal.org/'

@staticmethod
def ogrConnectionString(uri, context):
"""Generates OGR connection string from layer source
def ogrConnectionStringFromLayer(layer):
"""Generates OGR connection string from a layer
"""
return GdalUtils.ogrConnectionStringAndFormat(uri, context)[0]
return GdalUtils.ogrConnectionStringAndFormatFromLayer(layer)[0]

@staticmethod
def ogrConnectionStringAndFormat(uri, context):
Expand Down
Expand Up @@ -130,7 +130,7 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
uri = GeoDB(uri=uri).uri

inLayer = self.getParameterValue(self.INPUT_LAYER)
ogrLayer = GdalUtils.ogrConnectionString(inLayer, context)
ogrLayer = GdalUtils.ogrConnectionStringFromLayer(inLayer)
shapeEncoding = self.getParameterValue(self.SHAPE_ENCODING)
schema = str(self.getParameterValue(self.SCHEMA))
table = str(self.getParameterValue(self.TABLE))
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ogrinfo.py
Expand Up @@ -85,7 +85,7 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
if inLayer is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

connectionString = GdalUtils.ogrConnectionString(inLayer.source(), context)
connectionString = GdalUtils.ogrConnectionStringFromLayer(inLayer)
arguments.append(connectionString)
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]

Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/rasterize_over.py
Expand Up @@ -78,8 +78,8 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
inLayer = QgsProcessingUtils.mapLayerFromString(self.getParameterValue(self.INPUT), context)
inRasterLayer = QgsProcessingUtils.mapLayerFromString(self.getParameterValue(self.INPUT_RASTER), context)

ogrLayer = GdalUtils.ogrConnectionString(inLayer, context)
ogrRasterLayer = GdalUtils.ogrConnectionString(inRasterLayer, context)
ogrLayer = GdalUtils.ogrConnectionStringFromLayer(inLayer)
ogrRasterLayer = GdalUtils.ogrConnectionStringFromLayer(inRasterLayer)

arguments = []
arguments.append('-a')
Expand Down

0 comments on commit 7977450

Please sign in to comment.