File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
python/plugins/processing Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,11 @@ def getCustomParametersDialog(self):
50
50
def processAlgorithm (self , progress ):
51
51
commands = self .getConsoleCommands ()
52
52
layers = dataobjects .getVectorLayers ()
53
+ supported = dataobjects .getSupportedOutputVectorLayerExtensions ()
53
54
for i , c in enumerate (commands ):
54
55
for layer in layers :
55
56
if layer .source () in c :
56
- c = c .replace (layer .source (), dataobjects .exportVectorLayer (layer ))
57
+ c = c .replace (layer .source (), dataobjects .exportVectorLayer (layer , supported ))
57
58
58
59
commands [i ] = c
59
60
GdalUtils .runGdal (commands , progress )
Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ def getObjectFromUri(uri, forceLoad=True):
271
271
return None
272
272
273
273
274
- def exportVectorLayer (layer ):
274
+ def exportVectorLayer (layer , supported = None ):
275
275
"""Takes a QgsVectorLayer and returns the filename to refer to it,
276
276
which allows external apps which support only file-based layers to
277
277
use it. It performs the necessary export in case the input layer
@@ -285,6 +285,7 @@ def exportVectorLayer(layer):
285
285
a new file if the original one contains non-ascii characters.
286
286
"""
287
287
288
+ supported = supported or ["shp" ]
288
289
settings = QSettings ()
289
290
systemEncoding = settings .value ('/UI/encoding' , 'System' )
290
291
@@ -317,7 +318,7 @@ def exportVectorLayer(layer):
317
318
unicode (layer .source ()).decode ('ascii' )
318
319
except UnicodeEncodeError :
319
320
isASCII = False
320
- if not unicode ( layer . source ()). endswith ( 'shp' ) or not isASCII :
321
+ if not os . path . splitext ()[ 1 ] in supported or not isASCII :
321
322
writer = QgsVectorFileWriter (
322
323
output , systemEncoding ,
323
324
layer .pendingFields (), provider .geometryType (),
You can’t perform that action at this time.
0 commit comments