@@ -47,7 +47,6 @@ class rasterize(OgrAlgorithm):
47
47
DIMENSIONS = 'DIMENSIONS'
48
48
WIDTH = 'WIDTH'
49
49
HEIGHT = 'HEIGHT'
50
- WRITEOVER = 'WRITEOVER'
51
50
RTYPE = 'RTYPE'
52
51
OUTPUT = 'OUTPUT'
53
52
TYPE = ['Byte' , 'Int16' , 'UInt16' , 'UInt32' , 'Int32' , 'Float32' , 'Float64' ]
@@ -71,8 +70,6 @@ def defineCharacteristics(self):
71
70
self .addParameter (ParameterVector (self .INPUT , self .tr ('Input layer' )))
72
71
self .addParameter (ParameterTableField (self .FIELD ,
73
72
self .tr ('Attribute field' ), self .INPUT ))
74
- self .addParameter (ParameterBoolean (self .WRITEOVER ,
75
- self .tr ('Write values inside an existing raster layer(*)' ), False ))
76
73
self .addParameter (ParameterSelection (self .DIMENSIONS ,
77
74
self .tr ('Set output raster size (ignored if above option is checked)' ),
78
75
['Output size in pixels' , 'Output resolution in map units per pixel' ], 1 ))
@@ -103,10 +100,9 @@ def defineCharacteristics(self):
103
100
self .addParameter (ParameterBoolean (self .TFW ,
104
101
self .tr ('Force the generation of an associated ESRI world file (.tfw)' ), False ))
105
102
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 ' )))
107
104
108
105
def processAlgorithm (self , progress ):
109
- writeOver = self .getParameterValue (self .WRITEOVER )
110
106
inLayer = self .getParameterValue (self .INPUT )
111
107
ogrLayer = self .ogrConnectionString (inLayer )[1 :- 1 ]
112
108
noData = str (self .getParameterValue (self .NO_DATA ))
@@ -123,27 +119,26 @@ def processAlgorithm(self, progress):
123
119
arguments .append ('-a' )
124
120
arguments .append (str (self .getParameterValue (self .FIELD )))
125
121
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 )])
129
125
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" ):
147
142
arguments .append ("-co COMPRESS=" + compress )
148
143
if compress == 'JPEG' :
149
144
arguments .append ("-co JPEG_QUALITY=" + jpegcompression )
0 commit comments