comparison gdal_translate.xml @ 0:2241ff3e5b7c draft default tip

Uploaded
author mnhn65mo
date Thu, 02 Aug 2018 06:30:23 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:2241ff3e5b7c
1 <tool id="gdal_translate" name="GDAL Translate" version="0.1.0">*
2 <description>converts raster data between different formats.</description>
3 <requirements>
4 <requirement type="package" version="2.1.0">gdal</requirement>
5 <requirement type="package" version="3.5.0">geos</requirement>
6 <requirement type="package" version="9b">jpeg</requirement>
7 <requirement type="package" version="1.5.90">libjpeg-turbo</requirement>
8 </requirements>
9 <command detect_errors="exit_code"><![CDATA[
10 gdal_translate
11
12 '$typeinput.input1' '$output'
13 #if $settings.advanced=='advanced'
14
15 #unless $settings.ot=='eg : Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64'
16 -ot $settings.ot
17 #end unless
18
19 $settings.strict
20
21 #unless $settings.b=='e.g : -b 1 -b 2 -b 3'
22 $settings.b
23 #end unless
24
25 #unless $settings.mask=='e.g : -mask 1'
26 '$settings.mask'
27 #end unless
28
29 #if $settings.condi_resample.resample=='resampling'
30 -r $settings.condi_resample.r
31 #end if
32
33 #if $settings.outsize.outsize=='outsize_x'
34 -outsize xsize $settings.outsize.outx$settings.outsize.outsize_percent
35 #else
36 -outsize ysize $settings.outsize.outy$settings.outsize.outsize_percent
37 #end if
38
39 #if $settings.condi_expand.expand=='expand'
40 -expand $settings.condi_expand.expand_value
41 #end if
42
43 #if $settings.condi_scale.scale=='scale'
44 -scale $settings.condi_scale.src_min $settings.condi_scale.src_max $settings.condi_scale.dst_min $settings.condi_scale.dst_max
45 #end if
46
47 #if $settings.condi_srcwin.srcwin=='srcwin'
48 -srcwin $settings.condi_srcwin.xoff $settings.condi_srcwin.yoff $settings.condi_srcwin.xsize $settings.condi_srcwin.ysize
49 #end if
50
51 #if $settings.condi_a_ullr.a_ullr=='a_ullr'
52 -a_ullr $settings.condi_a_ullr.ulx $settings.condi_a_ullr.uly $settings.condi_a_ullr.lrx $settings.condi_a_ullr.lry
53 #end if
54
55 $settings.epoeco
56 ## $settings.sds
57 $settings.stats
58 $settings.norat
59
60 #unless $settings.co=='e.g : COMPRESS=JPEG'
61 -co '$settings.co'
62 #end unless
63
64 #unless $settings.mo=='META-TAG=VALUE'
65 -mo '$settings.mo'
66 #end unless
67
68 #unless $settings.oo=='NAME=VALUE'
69 -oo '$settings.oo'
70 #end unless
71
72 #unless $settings.a_srs==''
73 -a_srs '$settings.a_srs'
74 #end unless
75
76 #end if
77 -q
78 -of '$of'
79
80 ]]></command>
81 <inputs>
82 <conditional name="typeinput">
83 <param type="select" name="input" display="radio" label="Gdal supported input file" help="http://www.gdal.org/formats_list.html">
84 <option value="dataset">Data file</option>
85 <option value="subdataset">Subdataset</option>
86 </param>
87 <when value="dataset">
88 <param type="data" label="Input data" name="input1"/>
89 </when>
90 <when value="subdataset">
91 <param type="data" label="Tabular of subdatasets" name="subdata_tab"/>
92 <param name="input1" type="select" label="Chose your subdata">
93 <options from_dataset="subdata_tab">
94 <column name="value" index="0"/>
95 </options>
96 <sanitizer>
97 <valid initial="string.printable">
98 <add value="&quot;"/>
99 </valid>
100 </sanitizer>
101 </param>
102 </when>
103 </conditional>
104 <param name="of" type="text" label="Output format" value="gtiff" help="Select the output format. The default is GeoTIFF (GTiff). Use the short format name. http://www.gdal.org/formats_list.html"/>
105 <conditional name="settings">
106 <param name="advanced" type="select" label="Specify advanced parameters">
107 <option value="simple" selected="true">No, use program defaults.</option>
108 <option value="advanced">Yes, see full parameter list.</option>
109 </param>
110 <when value="simple">
111 </when>
112 <when value="advanced">
113
114 <param name="ot" type="text" label="-ot type" value="eg : Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64"/>
115 <param name="strict" type="boolean" truevalue="-strict" falsevalue="" checked="false" label="-strict"/>
116 <param name="b" type="text" label="-b band" value="e.g : -b 1 -b 2 -b 3"/>
117 <param name="mask" type="text" label="-mask band" value="e.g : -mask 1"/>
118
119 <conditional name="condi_resample">
120 <param label="-r" name="resample" type="boolean" truevalue="resampling" falsevalue="no_resampling" checked="false" help="Use a resampling algorithm"/>
121 <when value="resampling">
122 <param name="r" type="select" label="Reseampling algorithm" >
123 <option value="nearest" selected="true"/>
124 <option value="bilinear"/>
125 <option value="cubic"/>
126 <option value="cubicspline"/>
127 <option value="lanczos"/>
128 <option value="average"/>
129 <option value="mode"/>
130 </param>
131 </when>
132 <when value="no_resampling">
133 </when>
134 </conditional>
135
136 <param name="stats" type="boolean" truevalue="-stats" falsevalue="" checked="false" label="-stats" />
137 <param name="norat" type="boolean" truevalue="-norat" falsevalue="" checked="false" label="-norat" />
138 <param name="co" type="text" label="-co" value="e.g : COMPRESS=JPEG" />
139 <param name="mo" type="text" label="-mo" value="META-TAG=VALUE" />
140 <param name="oo" type="text" label="-oo" value="NAME=VALUE" />
141
142 <conditional name="condi_expand">
143 <param name="expand" type="select" label="-expand gray|rgb|rgba" >
144 <option value="no_expand" selected="true">Don't use the -expand option</option>
145 <option value="expand">Use the -expand option</option>
146 </param>
147 <when value="no_expand">
148 </when>
149 <when value="expand">
150 <param name="expand_value" type="select" label="Color table" display="radio" multiple="False">
151 <option value="gray" selected="true">GRAY</option>
152 <option value="rgb">RGB</option>
153 <option value="rgba">RGBA</option>
154 </param>
155 </when>
156 </conditional>
157
158 <conditional name="outsize">
159 <param name="outsize" type="select" label="-outsize" >
160 <option value="outsize_x" selected="true">xsize</option>
161 <option value="outsize_y">ysize</option>
162 </param>
163 <when value="outsize_x">
164 <param name="outsize_percent" type="boolean" truevalue="%" falsevalue="" checked="true" label="Use percentage"/>
165 <param name="outx" label="xsize" type="integer" value="100"/>
166 </when>
167 <when value="outsize_y">
168 <param name="outsize_percent" type="boolean" truevalue="%" falsevalue="" checked="true" label="Use percentage"/>
169 <param name="outy" label="ysize" type="integer" value="100"/>
170 </when>
171 </conditional>
172
173 <conditional name="condi_scale">
174 <param name="scale" type="select" label="-squale" >
175 <option value="no_scale" selected="true">Don't use the -scale option</option>
176 <option value="scale">Use the -scale option</option>
177 </param>
178 <when value="no_scale">
179 </when>
180 <when value="scale">
181 <param name="src_min" type="integer" label="src_min" value="0"/>
182 <param name="src_max" type="integer" label="src_max" value="0"/>
183 <param name="dst_min" type="integer" label="dst_min" value="0"/>
184 <param name="dst_max" type="integer" label="dst_max" value="0"/>
185 </when>
186 </conditional>
187
188 <conditional name="condi_srcwin">
189 <param name="srcwin" type="select" label="-srcwin" >
190 <option value="no_srcwin" selected="true">Don't use the -srcwin option</option>
191 <option value="srcwin">Use the -srcwin option</option>
192 </param>
193 <when value="no_srcwin">
194 </when>
195 <when value="srcwin">
196 <param name="xoff" type="integer" label="xoff" value="0"/>
197 <param name="yoff" type="integer" label="yoff" value="0"/>
198 <param name="xsize" type="integer" label="xsize" value="0"/>
199 <param name="ysize" type="integer" label="ysize" value="0"/>
200 </when>
201 </conditional>
202
203 <conditional name="condi_a_ullr">
204 <param name="a_ullr" type="select" label="-a_ullr" >
205 <option value="no_a_ullr" selected="true">Don't use the -a_ullr option</option>
206 <option value="a_ullr">Use the -a_ullr option</option>
207 </param>
208 <when value="no_a_ullr">
209 </when>
210 <when value="a_ullr">
211 <param name="ulx" type="integer" label="ulx" value="0"/>
212 <param name="uly" type="integer" label="uly" value="0"/>
213 <param name="lrx" type="integer" label="lrx" value="0"/>
214 <param name="lry" type="integer" label="lry" value="0"/>
215 </when>
216 </conditional>
217
218 <param name="epoeco" type="select" label="Display error when outside the source raster" display="radio" multiple="False">
219 <option value="" selected="true">Default, no error</option>
220 <option value="-epo">-epo : Error when partially outside</option>
221 <option value="-eco">-eco : Error when completely outside</option>
222 </param>
223 <param name="a_srs" type="text" label="-a_srs" value="" />
224
225 <!--
226 <param name="sds" type="boolean" truevalue="-sds" falsevalue="" checked="false" label="-sds" help="Copy all subdatasets of this file to individual output files. Use with formats like HDF or OGDI that have subdatasets. The output file naming scheme has changed in GDAL 1.11 (e.g. ofile_1.tif, ofile_2.tif)."/>
227 Ici il y a surement une gestion de fichiers de sorties multiple à faire
228 -->
229
230 </when>
231 </conditional>
232 </inputs>
233
234 <outputs>
235 <data name="output" auto_format="true" label="${on_string}.${of}"/> <!--label="${input.name}.${of}-->
236 </outputs>
237
238
239 <tests>
240 <test>
241 <param name="input1" value="stere.tif"/>
242 <param name="of" value="JPEG" />
243 <param name="advanced" value="simple"/>
244 <output name="output" file="stere.jpg"/>
245 </test>
246
247 <test> <!-- gdal_translate "/tmp/tmpt_qdGu/files/000/dataset_1.dat" "/tmp/tmpt_qdGu/files/000/dataset_2.dat" -b 1 -outsize xsize 75% -of jpeg -->
248 <param name="input1" value="stere.tif"/>
249 <param name="of" value="JPEG" />
250 <param name="advanced" value="advanced"/>
251 <param name="b" value="-b 1"/>
252 <param name="outsize" value="outsize_x"/>
253 <param name="outx" value="75"/>
254 <param name="outsize_percent" value="%"/>
255 <output name="output" file="stere_advanced1.jpg"/>
256 </test>
257
258 <test> <!-- gdal_translate "/tmp/tmpt_qdGu/files/000/dataset_1.dat" "/tmp/tmpt_qdGu/files/000/dataset_2.dat" -b 1 -b 2 -r cubic -outsize ysize 75 -of png -->
259 <param name="input1" value="stere.tif"/>
260 <param name="of" value="png" />
261 <param name="advanced" value="advanced"/>
262 <param name="b" value="-b 1 -b 2"/>
263 <param name="resample" value="resampling"/>
264 <param name="r" value="cubic"/>
265 <param name="outsize" value="outsize_y"/>
266 <param name="outy" value="75"/>
267 <param name="outsize_percent" value=""/>
268 <output name="output" file="stere_advanced2.png"/>
269 </test>
270
271 <test> <!-- gdal_translate "/tmp/tmpki1Dk8/files/000/dataset_1.dat" "/tmp/tmpki1Dk8/files/000/dataset_4.dat" -outsize xsize 100% -a_ullr -180 90 180 -90 -a_srs 'WGS84' -of gtiff -->
272 <param name="input1" value="world.png"/>
273 <param name="of" value="gtiff" />
274 <param name="advanced" value="advanced"/>
275 <param name="a_ullr" value="a_ullr"/>
276 <param name="ulx" value="-180"/>
277 <param name="uly" value="90"/>
278 <param name="lrx" value="180"/>
279 <param name="lry" value="-90"/>
280 <param name="a_srs" value="WGS84"/>
281 <output name="output" file="geoworld.tif"/>
282 </test>
283
284 </tests>
285
286 <help><![CDATA[
287 ===============
288 Gdal_translate
289 ===============
290
291 **What it does**
292
293 The gdal_translate utility can be used to convert raster data between different formats, potentially performing some operations like subsettings, resampling, and rescaling pixels in the process.
294
295 |
296
297 **How to use it**
298
299 Select from history a raster file/subdataset.
300
301 Specifiy output format using short name (http://www.gdal.org/formats_list.html).
302
303 |
304
305 **Other options, advanced usage**
306
307 *-ot*
308
309 For the output bands to be of the indicated data type.
310
311 |
312
313 *-strict*
314
315 Don't be forgiving of mismatches and lost data when translating to the output format.
316
317 |
318
319 *-b band*
320
321 Select an input band band for output. Bands are numbered from 1. Multiple -b switches may be used to select a set of input bands to write to the output file, or to reorder bands. Starting with GDAL 1.8.0, band can also be set to "mask,1" (or just "mask") to mean the mask band of the first band of the input dataset.
322
323 |
324
325 *-mask band*
326
327 Select an input band band to create output dataset mask band. Bands are numbered from 1. band can be set to "none" to avoid copying the global mask of the input dataset if it exists. Otherwise it is copied by default ("auto"), unless the mask is an alpha channel, or if it is explicitly used to be a regular band of the output dataset ("-b mask"). band can also be set to "mask,1" (or just "mask") to mean the mask band of the 1st band of the input dataset.
328
329 |
330
331 *-r {nearest (default),bilinear,cubic,cubicspline,lanczos,average,mode}*
332
333 Select a resampling algorithm.
334
335 |
336
337 *-stats*
338
339 Force (re)computation of statistics.
340
341 |
342
343 *-norat*
344
345 Do not copy source RAT into destination dataset.
346
347 |
348
349 *-co "NAME=VALUE"*
350
351 Passes a creation option to the output format driver. Multiple -co options may be listed. See format specific documentation for legal creation options for each format.
352
353 |
354
355 *-mo "META-TAG=VALUE"*
356
357 Passes a metadata key and value to set on the output dataset if possible.
358
359 |
360
361 *-oo NAME=VALUE*
362
363 Dataset open option (format specific)
364
365 |
366
367 *-expand gray|rgb|rgba*
368
369 To expose a dataset with 1 band with a color table as a dataset with 3 (RGB) or 4 (RGBA) bands. Useful for output drivers such as JPEG, JPEG2000, MrSID, ECW that don't support color indexed datasets. The 'gray' value enables to expand a dataset with a color table that only contains gray levels to a gray indexed dataset.
370
371 |
372
373 *-outsize xsize[%]|0 ysize[%]|0*
374
375 Set the size of the output file. Outsize is in pixels and lines unless '%' is attached in which case it is as a fraction of the input image size. Starting with GDAL 2.0, if one of the 2 values is set to 0, its value will be determined from the other one, while maintaining the aspect ratio of the source dataset.
376
377 |
378
379 *-scale [src_min src_max [dst_min dst_max]]*
380
381 Rescale the input pixels values from the range src_min to src_max to the range dst_min to dst_max. If omitted the output range is 0 to 255. If omitted the input range is automatically computed from the source data. Before GDAL 1.11, it can be specified only once, and in that case, it applies to all bands of the output dataset. Starting with GDAL 1.11, -scale can be repeated several times (if specified only once, it also applies to all bands of the output dataset), so as to specify per band parameters. It is also possible to use the "-scale_bn" syntax where bn is a band number (e.g. "-scale_2" for the 2nd band of the output dataset) to specify the parameters of one or several specific bands.
382
383 |
384
385 *-srcwin xoff yoff xsize ysize*
386
387 Selects a subwindow from the source image for copying based on pixel/line location.
388
389 |
390
391 *-a_ullr ulx uly lrx lry*
392
393 Assign/override the georeferenced bounds of the output file. This assigns georeferenced bounds to the output file, ignoring what would have been derived from the source file. So this does not cause reprojection to the specified SRS.
394
395 |
396
397 *-epo: (Error when Partially Outside)*
398
399 If this option is set, -srcwin or -projwin values that falls partially outside the source raster extent will be considered as an error. The default behaviour starting with GDAL 1.10 is to accept such requests, when they were considered as an error before.
400
401 |
402
403 *-eco: (Error when Completely Outside)*
404
405 Same as -epo, except that the criterion for erroring out is when the request falls completely outside the source raster extent.
406
407 |
408
409 *-a_srs srs_def*
410
411 Override the projection for the output file. The srs_def may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT. No reprojection is done.
412
413 |
414
415 **Sources**
416
417 http://www.gdal.org
418
419 http://www.gdal.org/gdal_translate.html
420
421 Raster Processing Tutorial : https://trac.osgeo.org/gdal/wiki/UserDocs/RasterProcTutorial
422 ]]></help>
423 </tool>