[gdal-dev] gdal_merge problems: Negative size passed to PyString_FromStringAndSize

Andreas Neumann a.neumann at carto.net
Wed May 6 10:48:06 EDT 2009


Hi,

when trying to merge several tif-files (which had been converted
previously from Intergraph cit files), I am running into this error
message:

------------------
Traceback (most recent call last):
  File "/usr/local/bin/gdal_merge.py", line 427, in <module>
    fi.copy_into( t_fh, band, band, nodata )
  File "/usr/local/bin/gdal_merge.py", line 227, in copy_into
    nodata_arg )
  File "/usr/local/bin/gdal_merge.py", line 47, in raster_copy
    nodata )
  File "/usr/local/bin/gdal_merge.py", line 83, in raster_copy_with_nodata
    t_xsize, t_ysize )
  File
"/usr/lib/python2.5/site-packages/GDAL-1.6.0-py2.5-linux-x86_64.egg/osgeo/gdal.py",
line 835, in ReadAsArray
    buf_xsize, buf_ysize, buf_obj )
  File
"/usr/lib/python2.5/site-packages/GDAL-1.6.0-py2.5-linux-x86_64.egg/osgeo/gdal_array.py",
line 133, in BandReadAsArray
    buf_xsize, buf_ysize, datatype )
  File
"/usr/lib/python2.5/site-packages/GDAL-1.6.0-py2.5-linux-x86_64.egg/osgeo/gdal.py",
line 760, in ReadRaster
    return _gdal.Band_ReadRaster(*args, **kwargs)
SystemError: Negative size passed to PyString_FromStringAndSize
-------------------

Here is the full output on the console:

-------------------
user at server:/home/www/mapserverdata/lk_alt$ gdal_merge.py -o lk_temp.tif
-v -pct -n 0 -co "COMPRESS=PACKBITS" -co "TFW=YES" -co "NBITS=1" -of GTiff
*.tif

Filename: a01.tif
File Size: 28472x26038x1
Pixel Size: 21.309260 x -21.309260
UL:(697464582.163983,246084878.899647)  
LR:(698071299.411614,245530028.390592)
Copy 0,0,28472,26038 to 188240,126705,28472,26038.

Filename: a02.tif
File Size: 24160x28218x1
Pixel Size: 21.230390 x -21.230390
UL:(697286138.813619,245944920.434487)  
LR:(697799065.024075,245345841.303417)
Copy 0,0,24160,28218 to 179866,133273,24071,28114.

Filename: a03.tif
File Size: 26216x27335x1
Pixel Size: 21.269071 x -21.269071
UL:(697114396.075814,245751868.805884)  
LR:(697671986.053984,245170478.736716)
Copy 0,0,26216,27335 to 171807,142332,26167,27284.

Filename: a04.tif
File Size: 17872x19283x1
Pixel Size: 21.261870 x -21.261870
UL:(697099986.585252,245480003.161529)  
LR:(697479978.724770,245070010.523530)
Copy 0,0,17872,19283 to 171130,155090,17833,19241.

Filename: a08.tif
File Size: 23752x16245x1
Pixel Size: 21.232318 x -21.232318
UL:(698050620.444508,244842631.462299)  
LR:(698554930.459851,244497712.457615)
Copy 0,0,23752,16245 to 215742,185001,23666,16187.

Filename: a11.tif
File Size: 24400x16474x1
Pixel Size: 21.323216 x -21.323216
UL:(697718296.416720,244772005.407177)  
LR:(698238582.877453,244420726.753320)
Copy 0,0,24400,16474 to 200146,188315,24417,16485.

Filename: a12.tif
File Size: 24408x16596x1
Pixel Size: 21.254795 x -21.254795
UL:(697739107.795265,244895195.793969)  
LR:(698257894.833442,244542451.214913)
Copy 0,0,24408,16596 to 201123,182534,24346,16554.

Filename: a13.tif
File Size: 24528x16717x1
Pixel Size: 21.205679 x -21.205679
UL:(697550378.662813,244869450.636213)  
LR:(698070511.552925,244514955.303369)
Copy 0,0,24528,16717 to 192266,183742,24410,16636.

Filename: a14.tif
File Size: 23704x15928x1
Pixel Size: 21.194084 x -21.194084
UL:(697467610.635638,244699489.553303)  
LR:(697969995.203918,244361910.182582)
Copy 0,0,23704,15928 to 188382,191718,23576,15843.

Filename: a15.tif
File Size: 26600x23647x1
Pixel Size: 21.363833 x -21.363833
UL:(697203460.772593,245052711.229103)  
LR:(697771738.725908,244547520.674139)
Copy 0,0,26600,23647 to 175986,175142,26669,23708.

Filename: a16.tif
File Size: 25752x20613x1
Pixel Size: 21.239623 x -21.239623
UL:(697230262.042617,245223588.146429)  
LR:(697777224.810537,244785775.800392)
Copy 0,0,25752,20613 to 177244,167123,25668,20546.

Filename: a17a.tif
File Size: 33472x32446x1
Pixel Size: 10.649660 x -10.649660
UL:(697137093.161691,245272668.126460)  
LR:(697493558.572938,244927129.266120)
Copy 0,0,33472,32446 to 172872,164820,16728,16216.

Filename: a17b.tif
File Size: 28648x27155x1
Pixel Size: 10.646166 x -10.646166
UL:(697155315.453531,245126818.638231)  
LR:(697460306.821276,244837721.996542)
Copy 0,0,28648,27155 to 173727,171665,14313,13567.

Filename: a17c.tif
File Size: 25536x20030x1
Pixel Size: 10.703696 x -10.703696
UL:(697106785.470579,244992288.887373)  
LR:(697380115.045865,244777893.861018)
Copy 0,0,25536,20030 to 171449,177978,12828,10061.

Filename: a18.tif
File Size: 24320x15931x1
Pixel Size: 21.267855 x -21.267855
UL:(696988895.367595,244903125.100124)  
LR:(697506129.596569,244564306.905150)
Copy 0,0,24320,15931 to 165917,182162,24273,15900.

Filename: a19.tif
File Size: 24120x15834x1
Pixel Size: 21.231927 x -21.231927
UL:(696987778.979646,244682174.526910)  
LR:(697499893.051158,244345988.199865)
Copy 0,0,24120,15834 to 165865,192531,24033,15777.

Filename: a20.tif
File Size: 23928x30047x1
Pixel Size: 21.197387 x -21.197387
UL:(697159122.101568,244758201.154124)  
LR:(697666333.189349,244121283.252311)
Copy 0,0,23928,30047 to 173905,188963,23803,29890.

Filename: a21.tif
File Size: 24408x16665x1
Pixel Size: 21.297079 x -21.297079
UL:(697492717.281869,244504989.972687)  
LR:(698012536.394027,244150074.145740)
Copy 0,0,24408,16665 to 189560,200846,24395,16656.

Filename: a22.tif
File Size: 23616x16571x1
Pixel Size: 21.264780 x -21.264780
UL:(697417036.817021,244399776.304582)  
LR:(697919225.865369,244047397.632488)
Copy 0,0,23616,16571 to 186009,205783,23567,16537.

Filename: a23.tif
File Size: 25624x29314x1
Pixel Size: 21.223764 x -21.223764
UL:(697662502.145363,244415030.489332)  
LR:(698206339.866522,243792877.080104)
Copy 0,0,25624,29314 to 197528,205067,25522,29197.

Filename: a25.tif
File Size: 25472x25427x1
Pixel Size: 42.431795 x -42.431795
UL:(697837651.400476,244274906.596461)  
LR:(698918474.082743,243195993.344970)
Copy 0,0,25472,25427 to 205747,211643,50722,50632.
Traceback (most recent call last):
  File "/usr/local/bin/gdal_merge.py", line 427, in <module>
    fi.copy_into( t_fh, band, band, nodata )
  File "/usr/local/bin/gdal_merge.py", line 227, in copy_into
    nodata_arg )
  File "/usr/local/bin/gdal_merge.py", line 47, in raster_copy
    nodata )
  File "/usr/local/bin/gdal_merge.py", line 83, in raster_copy_with_nodata
    t_xsize, t_ysize )
  File
"/usr/lib/python2.5/site-packages/GDAL-1.6.0-py2.5-linux-x86_64.egg/osgeo/gdal.py",
line 835, in ReadAsArray
    buf_xsize, buf_ysize, buf_obj )
  File
"/usr/lib/python2.5/site-packages/GDAL-1.6.0-py2.5-linux-x86_64.egg/osgeo/gdal_array.py",
line 133, in BandReadAsArray
    buf_xsize, buf_ysize, datatype )
  File
"/usr/lib/python2.5/site-packages/GDAL-1.6.0-py2.5-linux-x86_64.egg/osgeo/gdal.py",
line 760, in ReadRaster
    return _gdal.Band_ReadRaster(*args, **kwargs)
SystemError: Negative size passed to PyString_FromStringAndSize
-------------------

Is this a problem with my data, georeferencing or projection or is it a
problem in gdal_merge?

Thanks for any idea what might be wrong in this case!

Andreas

-- 
Andreas Neumann
http://www.carto.net/neumann/
http://www.svgopen.org/



More information about the gdal-dev mailing list