@@ -47,7 +47,6 @@ class rasterize(OgrAlgorithm):
4747 DIMENSIONS = 'DIMENSIONS'
4848 WIDTH = 'WIDTH'
4949 HEIGHT = 'HEIGHT'
50- WRITEOVER = 'WRITEOVER'
5150 RTYPE = 'RTYPE'
5251 OUTPUT = 'OUTPUT'
5352 TYPE = ['Byte' , 'Int16' , 'UInt16' , 'UInt32' , 'Int32' , 'Float32' , 'Float64' ]
@@ -71,8 +70,6 @@ def defineCharacteristics(self):
7170 self .addParameter (ParameterVector (self .INPUT , self .tr ('Input layer' )))
7271 self .addParameter (ParameterTableField (self .FIELD ,
7372 self .tr ('Attribute field' ), self .INPUT ))
74- self .addParameter (ParameterBoolean (self .WRITEOVER ,
75- self .tr ('Write values inside an existing raster layer(*)' ), False ))
7673 self .addParameter (ParameterSelection (self .DIMENSIONS ,
7774 self .tr ('Set output raster size (ignored if above option is checked)' ),
7875 ['Output size in pixels' , 'Output resolution in map units per pixel' ], 1 ))
@@ -103,10 +100,9 @@ def defineCharacteristics(self):
103100 self .addParameter (ParameterBoolean (self .TFW ,
104101 self .tr ('Force the generation of an associated ESRI world file (.tfw)' ), False ))
105102 self .addOutput (OutputRaster (self .OUTPUT ,
106- self .tr ('Output layer: mandatory to choose an existing raster layer if the (*) option is selected ' )))
103+ self .tr ('Rasterized ' )))
107104
108105 def processAlgorithm (self , progress ):
109- writeOver = self .getParameterValue (self .WRITEOVER )
110106 inLayer = self .getParameterValue (self .INPUT )
111107 ogrLayer = self .ogrConnectionString (inLayer )[1 :- 1 ]
112108 noData = str (self .getParameterValue (self .NO_DATA ))
@@ -123,27 +119,26 @@ def processAlgorithm(self, progress):
123119 arguments .append ('-a' )
124120 arguments .append (str (self .getParameterValue (self .FIELD )))
125121
126- if not writeOver :
127- arguments .append ('-ot' )
128- arguments .append (self .TYPE [self .getParameterValue (self .RTYPE )])
122+
123+ arguments .append ('-ot' )
124+ arguments .append (self .TYPE [self .getParameterValue (self .RTYPE )])
129125 dimType = self .getParameterValue (self .DIMENSIONS )
130- if not writeOver :
131- if dimType == 0 :
132- # size in pixels
133- arguments .append ('-ts' )
134- arguments .append (str (self .getParameterValue (self .WIDTH )))
135- arguments .append (str (self .getParameterValue (self .HEIGHT )))
136- else :
137- # resolution in map units per pixel
138- arguments .append ('-tr' )
139- arguments .append (str (self .getParameterValue (self .WIDTH )))
140- arguments .append (str (self .getParameterValue (self .HEIGHT )))
141-
142- if len (noData ) > 0 :
143- arguments .append ('-a_nodata' )
144- arguments .append (noData )
145-
146- if (GdalUtils .getFormatShortNameFromFilename (out ) == "GTiff" ) and (writeOver is False ):
126+ if dimType == 0 :
127+ # size in pixels
128+ arguments .append ('-ts' )
129+ arguments .append (str (self .getParameterValue (self .WIDTH )))
130+ arguments .append (str (self .getParameterValue (self .HEIGHT )))
131+ else :
132+ # resolution in map units per pixel
133+ arguments .append ('-tr' )
134+ arguments .append (str (self .getParameterValue (self .WIDTH )))
135+ arguments .append (str (self .getParameterValue (self .HEIGHT )))
136+
137+ if len (noData ) > 0 :
138+ arguments .append ('-a_nodata' )
139+ arguments .append (noData )
140+
141+ if (GdalUtils .getFormatShortNameFromFilename (out ) == "GTiff" ):
147142 arguments .append ("-co COMPRESS=" + compress )
148143 if compress == 'JPEG' :
149144 arguments .append ("-co JPEG_QUALITY=" + jpegcompression )
0 commit comments