@@ -65,6 +65,7 @@ class OgrToPostGis(GdalAlgorithm):
65
65
SEGMENTIZE = 'SEGMENTIZE'
66
66
SPAT = 'SPAT'
67
67
CLIP = 'CLIP'
68
+ FIELDS = 'FIELDS'
68
69
WHERE = 'WHERE'
69
70
GT = 'GT'
70
71
OVERWRITE = 'OVERWRITE'
@@ -127,6 +128,10 @@ def initAlgorithm(self, config=None):
127
128
self .addParameter (QgsProcessingParameterBoolean (self .CLIP ,
128
129
self .tr ('Clip the input layer using the above (rectangle) extent' ),
129
130
defaultValue = False ))
131
+ self .addParameter (QgsProcessingParameterField (self .FIELDS ,
132
+ self .tr ('Fields to include (leave empty to use all fields)' ),
133
+ parentLayerParameterName = self .INPUT ,
134
+ allowMultiple = True , optional = True ))
130
135
self .addParameter (QgsProcessingParameterString (self .WHERE ,
131
136
self .tr ('Select features using a SQL "WHERE" statement (Ex: column=\' value\' )' ),
132
137
defaultValue = '' , optional = True ))
@@ -210,6 +215,8 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
210
215
segmentize = self .parameterAsString (parameters , self .SEGMENTIZE , context )
211
216
spat = self .parameterAsExtent (parameters , self .SPAT , context )
212
217
clip = self .parameterAsBool (parameters , self .CLIP , context )
218
+ include_fields = self .parameterAsFields (parameters , self .FIELDS , context )
219
+ fields_string = '-select "' + ',' .join (include_fields ) + '"'
213
220
where = self .parameterAsString (parameters , self .WHERE , context )
214
221
wherestring = '-where "' + where + '"'
215
222
gt = self .parameterAsString (parameters , self .GT , context )
@@ -244,6 +251,8 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
244
251
arguments .append (launderstring )
245
252
if append :
246
253
arguments .append ('-append' )
254
+ if include_fields :
255
+ arguments .append (fields_string )
247
256
if addfields :
248
257
arguments .append ('-addfields' )
249
258
if overwrite :
0 commit comments