Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following gdal_retile command I am trying to run, but it errors on the --optfile: -v -r bilinear -levels 8 -ps 512 512 -co "tiled=YES" -targetDir pyramid --optfile files.txt

   Unrecognised command option: -
        [-v] [-co NAME=VALUE]* [-of out_format]
        [-ps pixelWidth pixelHeight]
        [-ot  {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
        [ -tileIndex tileIndexName [-tileIndexField fieldName]]
        [ -csv fileName [-csvDelim delimiter]]
        [-s_srs srs_def]  [-pyramidOnly] -levels numberoflevels
        [-r {near/bilinear/cubic/cubicspline/lanczos}]
        -targetDir TileDirectory input_files

Any idea why this does not work?

share|improve this question
does it work without the optfile part? – underdark Nov 6 '12 at 20:01
Can you show the contents of your files.txt? When using --optfile, the text file should contain the absolute path names. – dmci Nov 7 '12 at 8:47

One alternative that may work for you would be to first create a virtual raster and then run

gdalbuildvrt -te xmin_vrt ymin_vrt xmax_vrt ymax_vrt -srcnodata "0 0 0" your.vrt ./path/*.tif -v -r bilinear -levels 8 -ps 512 512 -co "tiled=YES" -targetDir pyramid -co "COMPRESS=LZW" -targetDir pyramid ./path/your.vrt

share|improve this answer
creative workaround! I like it. It won't generate pyramids for each input image though, just on the vrt, so may not work for some. See my answer for another alternative. – matt wilkie Nov 9 '12 at 5:22

from my testing: Unrecognised command option: - is because a filename in files.txt has a dash in it. Enclose the names in quotes ("this-is-an-image.tif") and it will work fine.

Unfortunately the gdal_retile will not operate on multiple files ticket seems to be true; perhaps give it a bump. Here is a Windows cmd line snippet to work around that:

for %a in (*.tif) do gdal_retile "%a" -targetDir pyramids

to use in batch file double up the percents, e.g. %%a

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.