[GIS] cropping gtif with gdal_translate or qgis clipper

gdal-translateqgis

I have a Gtiff which loads into QGIS and seems to be OK. It's a US topo. When I try to clip it to remove the margins it fails (from QGIS or from cmd line) with this error:

dt1:gdal_translate -projwin 253.875 38.625 254 38.5 -of GTiff  CO_Salida_West_451198_1983_24000_geo.tif topo.tif

Input file size is 6579, 8096
Computed -srcwin 3441 7202 0 0 from projected window.
Error: Computed -srcwin 3441 7202 0 0 has negative width and/or height.

I also tried it with the corresponding negative value for longitude
The output from gdalinfo:

Driver: GTiff/GeoTIFF
Files: CO_Salida_West_451198_1983_24000_geo.tif
Size is 6579, 8096
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["NAD27",
        DATUM["North_American_Datum_1927",
            SPHEROID["Clarke 1866",6378206.4,294.9786982139006,
                AUTHORITY["EPSG","7008"]],
            AUTHORITY["EPSG","6267"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4267"]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",33],
    PARAMETER["standard_parallel_2",45],
    PARAMETER["latitude_of_origin",38.5],
    PARAMETER["central_meridian",-106.0629999999992],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-6739.200995264532139,14674.596086209008718)
Pixel Size = (2.032000000000000,-2.032000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  TIFFTAG_XRESOLUTION=300
  TIFFTAG_YRESOLUTION=300
Image Structure Metadata:
  COMPRESSION=YCbCr JPEG
  INTERLEAVE=PIXEL
  SOURCE_COLOR_SPACE=YCbCr
Corner Coordinates:
Upper Left  (   -6739.201,   14674.596) (106d 8'26.95"W, 38d37'58.41"N)
Lower Left  (   -6739.201,   -1776.476) (106d 8'26.36"W, 38d29' 1.98"N)
Upper Right (    6629.327,   14674.596) (105d59'11.22"W, 38d37'58.41"N)
Lower Right (    6629.327,   -1776.476) (105d59'11.80"W, 38d29' 1.98"N)
Center      (     -54.937,    6449.060) (106d 3'49.08"W, 38d33'30.29"N)
Band 1 Block=512x512 Type=Byte, ColorInterp=Red
  Overviews: 3290x4048, 1645x2024, 823x1012, 412x506, 206x253, 103x127, 52x64
Band 2 Block=512x512 Type=Byte, ColorInterp=Green
  Overviews: 3290x4048, 1645x2024, 823x1012, 412x506, 206x253, 103x127, 52x64
Band 3 Block=512x512 Type=Byte, ColorInterp=Blue
  Overviews: 3290x4048, 1645x2024, 823x1012, 412x506, 206x253, 103x127, 52x64

Best Answer

Check your coordinations values and order of them. I had same problem because I had wrong order of coordination values. You recieved this error when output size of raster is negative.