1

I am attempting to merge 600+ .tif files using gdal_merge.py (GDAL 2.2.2, released 2017/09/15) but I'm getting this error:

ERROR 1: Attempt to create 590x-369 dataset is illegal,sizes must be larger than zero.

I have created all the files with Python and individually they display correctly in QGIS. If I gdalinfo one of the .tif files I get this:

Driver: GTiff/GeoTIFF
Files: 561700_186000.tif
Size is 10, 10
Coordinate System is:
PROJCS["OSGB 1936 / British National Grid",
    GEOGCS["OSGB 1936",
        DATUM["OSGB_1936",
            SPHEROID["Airy 1830",6377563.396,299.3249646,
                AUTHORITY["EPSG","7001"]],
            TOWGS84[446.448,-125.157,542.06,0.15,0.247,0.842,-20.489],
            AUTHORITY["EPSG","6277"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4277"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",49],
    PARAMETER["central_meridian",-2],
    PARAMETER["scale_factor",0.9996012717],
    PARAMETER["false_easting",400000],
    PARAMETER["false_northing",-100000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","27700"]]
Origin = (561700.000000000000000,186900.000000000000000)
Pixel Size = (100.000000000000000,100.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  561700.000,  186900.000) (  0d19'58.22"E, 51d33'26.27"N)
Lower Left  (  561700.000,  187900.000) (  0d19'59.88"E, 51d33'58.61"N)
Upper Right (  562700.000,  186900.000) (  0d20'50.11"E, 51d33'25.23"N)
Lower Right (  562700.000,  187900.000) (  0d20'51.78"E, 51d33'57.58"N)
Center      (  562200.000,  187400.000) (  0d20'25.00"E, 51d33'41.92"N)
Band 1 Block=10x10 Type=Float32, ColorInterp=Gray

Which seems OK. Any ideas why I can't merge these files?

  • ah, just noticed the minus before 369! why would that be there? – kungphil Feb 28 '18 at 15:04
  • 4
    Perhaps it is because the upper corner is at 186900 and the lower corner is at 187900. They should be reversed. BTW. gdalbuildvrt is better than gdal_merge.py for most use cases. – user30184 Feb 28 '18 at 15:09

Your Answer

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

Browse other questions tagged or ask your own question.