mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
return only base URL as connection string
adopt ogrinfo and ogrtabletopostgis algorithms so they can work with WFS
This commit is contained in:
parent
4b7eaa4b9c
commit
af77d68716
@ -119,8 +119,8 @@ class GdalAlgorithm(QgsProcessingAlgorithm):
|
||||
elif input_layer.dataProvider().name().lower() == 'wfs':
|
||||
uri = QgsDataSourceUri(input_layer.source())
|
||||
baseUrl = uri.param('url').split('?')[0]
|
||||
ogr_data_path = "WFS:{}".format(baseUrl)
|
||||
ogr_layer_name = uri.param('typename')
|
||||
ogr_data_path = "WFS:{} {}".format(baseUrl, ogr_layer_name)
|
||||
else:
|
||||
# vector layer, but not OGR - get OGR compatible path
|
||||
# TODO - handle "selected features only" mode!!
|
||||
|
@ -344,8 +344,7 @@ class GdalUtils:
|
||||
elif provider.lower() == "wfs":
|
||||
uri = QgsDataSourceUri(layer.source())
|
||||
baseUrl = uri.param('url').split('?')[0]
|
||||
layerName = uri.param('typename')
|
||||
ogrstr = "WFS:{} {}".format(baseUrl, layerName)
|
||||
ogrstr = "WFS:{}".format(baseUrl)
|
||||
format = 'WFS'
|
||||
else:
|
||||
ogrstr = str(layer.source()).split("|")[0]
|
||||
|
@ -126,7 +126,7 @@ class Ogr2OgrTableToPostGisList(GdalAlgorithm):
|
||||
uri = GeoDB(uri=uri).uri
|
||||
|
||||
inLayer = self.getParameterValue(self.INPUT_LAYER)
|
||||
ogrLayer = GdalUtils.ogrConnectionStringFromLayer(inLayer)
|
||||
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)
|
||||
shapeEncoding = self.getParameterValue(self.SHAPE_ENCODING)
|
||||
schema = str(self.getParameterValue(self.SCHEMA))
|
||||
table = str(self.getParameterValue(self.TABLE))
|
||||
@ -161,7 +161,7 @@ class Ogr2OgrTableToPostGisList(GdalAlgorithm):
|
||||
arguments.append('"')
|
||||
arguments.append(ogrLayer)
|
||||
arguments.append('-nlt NONE')
|
||||
arguments.append(GdalUtils.ogrLayerName(inLayer))
|
||||
arguments.append(layerName)
|
||||
if launder:
|
||||
arguments.append(launderstring)
|
||||
if append:
|
||||
@ -175,7 +175,7 @@ class Ogr2OgrTableToPostGisList(GdalAlgorithm):
|
||||
elif primary_key is not None:
|
||||
arguments.append("-lco FID=" + primary_key)
|
||||
if len(table) == 0:
|
||||
table = GdalUtils.ogrLayerName(inLayer).lower()
|
||||
table = layerName.lower()
|
||||
if schema:
|
||||
table = '{}.{}'.format(schema, table)
|
||||
arguments.append('-nln')
|
||||
|
@ -81,8 +81,9 @@ class ogrinfo(GdalAlgorithm):
|
||||
if inLayer is None:
|
||||
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))
|
||||
|
||||
connectionString = GdalUtils.ogrConnectionStringFromLayer(inLayer)
|
||||
arguments.append(connectionString)
|
||||
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)
|
||||
arguments.append(ogrLayer)
|
||||
arguments.append(layerName)
|
||||
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
|
||||
|
||||
def processAlgorithm(self, parameters, context, feedback):
|
||||
|
Loading…
x
Reference in New Issue
Block a user