1

Wondering why gdal2tiles is throwing errors, I've added the gdaldata and gdalplugins environmental variables and my python is at Python27/ArcGIS10.3/, and am wondering if that is messing with the OSGeo4W python located in the C:\OSGeo4W\bin folder, or do I need to direct my environment variables every time I want to use OSGeo4W vs. ArcGIS python versions?

Or is it working and the error I'm seeing below has to do with something else totally separate?

OSGEO4W home is C:\OSGeo4W\

                   -={ OSGeo4W Shell Commands }=-

       bmp2tiff             listgeo              raw2tiff
       cs2cs                nad2bin              rgb2ycbcr
       curl                 ncdump               rpcgen
       dllupdate            ncgen                rpcinfo
       fax2ps               nearblack            testepsg
       fax2tiff             nircmd               textreplace
       gdaladdo             nircmdc              thumbnail
       gdalbuildvrt         ogdi_import          tiff2bw
       gdaldem              ogdi_info            tiff2pdf
       gdalenhance          ogr2ogr              tiff2ps
       gdalinfo             ogrinfo              tiff2rgba
       gdallocationinfo     ogrlineref           tiffcmp
       gdalmanage           ogrtindex            tiffcp
       gdalserver           opj_compress         tiffcrop
       gdalsrsinfo          opj_decompress       tiffdither
       gdaltindex           opj_dump             tiffdump
       gdaltransform        osgeo4w-setup-work   tiffinfo
       gdalwarp             osgeo4w-setup        tiffmedian
       gdal_contour         pal2rgb              tiffset
       gdal_grid            portmap              tiffsplit
       gdal_rasterize       ppm2tiff             w9xpopen
       gdal_translate       proj                 xmlcatalog
       geod                 psql                 xmllint
       geotifcp             python               xxmklink
       gif2tiff             pythonw
       gltpd                ras2tiff


       epsg_tr           gdalmove          make-bat-for-py
       esri2wkt          gdal_auth         mkgraticule
       gcps2vec          gdal_calc         o-help
       gcps2wld          gdal_edit         o4w_env
       gdal2tiles        gdal_fillnodata   pct2rgb
       gdal2xyz          gdal_merge        rgb2pct
       gdalchksum        gdal_polygonize   setup-test
       gdalcompare       gdal_proximity    setup
       gdalident         gdal_retile
       gdalimport        gdal_sieve

GDAL 1.11.2, released 2015/02/10

C:\Users\maugust\Desktop>gdal2tiles.py C:\Users\maugust\Desktop\example_tifs\Pie
rce_2010_84.tif C:\Users\maugust\Desktop\example_tifs\tilegdal
Traceback (most recent call last):
  File "C:\OSGeo4W\bin\gdal2tiles.py", line 2278, in <module>
    gdal2tiles.process()
  File "C:\OSGeo4W\bin\gdal2tiles.py", line 482, in process
    self.open_input()
  File "C:\OSGeo4W\bin\gdal2tiles.py", line 856, in open_input
    self.out_ds.SetMetadataItem('NODATA_VALUES','%i %i %i' % (self.in_nodata[0],
self.in_nodata[1],self.in_nodata[2]))
IndexError: list index out of range

C:\Users\maugust\Desktop>
  • It's not the path variable - your error outputs show that it's finding the right .py file. – Paulo Raposo Nov 18 '15 at 23:07
3

This same error threw me off, too. Adding NODATA transparency value parameter to the call fixed it for me, so instead of

gdal2tiles.py -z 1-10 ~/hfp_wgs/hdr.adf hpf-tiles

I called

gdal2tiles.py -z 1-10 -a 0,0,0 ~/hfp_wgs/hdr.adf hpf-tiles

and it started working. Note that the value had to be three numbers, one for each of RGB channels.

  • 1
    I have a grayscale TIF, and was running into this error: using your -a tip works, but I get the warning: NODATA_VALUES metadata item doesn't have the same number of values as the number of bands. Ignoring it for mask. Is this ok? – Ahmed Fasih Nov 29 '15 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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