gdal_translate with -projwin errors out

by J.Alex   Last Updated October 03, 2018 21:22 PM

I'm trying to use gdal_translate to crop a section of the raster into a new file. I was given direction to use -projwin for two reasons. 1) -srswin required a pixel location but the process would not have pixel available but the geo location. 2) Previous testing showed that -srswin caused a slight shift in the pixels once the crop raster was laid over the original raster.

But the following command will not work. Thoughts/answers/resources to better understand what is happening here would be appreciated.

#  gdal_translate \
>   -of NITF \
>   -projwin -58.57700 -34.44500 -58.57300 -34.44900 \
>   -projwin_srs "+proj=longlat +datum=WGS84 +no_defs" \
>   in.NTF \
>   out_crop.NTF
Input file size is 43008, 43008
ERROR 0: -projwin_srs ignored since the dataset has no projection.
ERROR 1: Error: Computed -srcwin -59 -35 0 0 has negative width and/or height.

#gdalinfo
"coordinateSystem":{
    "wkt":""
  },
  "gcps":{
    "coordinateSystem":{
      "wkt":"GEOGCS[\"WGS 84\",\n    DATUM[\"WGS_1984\",\n        SPHEROID[\"WGS 84\",6378137,298.257223563,\n            AUTHORITY[\"EPSG\",\"7030\"]],\n        AUTHORITY[\"EPSG\",\"6326\"]],\n    PRIMEM[\"Greenwich\",0,\n        AUTHORITY[\"EPSG\",\"8901\"]],\n    UNIT[\"degree\",0.0174532925199433,\n        AUTHORITY[\"EPSG\",\"9122\"]],\n    AUTHORITY[\"EPSG\",\"4326\"]]"
    },
    "gcpList":[
      {
        "id":"UpperLeft",
        "info":"",
        "pixel":0.5,
        "line":0.5,
        "x":-58.52,
        "y":-34.543611111111112,
        "z":0.0
      },
      {
        "id":"UpperRight",
        "info":"",
        "pixel":43007.5,
        "line":0.5,
        "x":-58.699444444444438,
        "y":-34.537777777777777,
        "z":0.0
      },
      {
        "id":"LowerRight",
        "info":"",
        "pixel":43007.5,
        "line":43007.5,
        "x":-58.699444444444438,
        "y":-34.402777777777779,
        "z":0.0
      },
      {
        "id":"LowerLeft",
        "info":"",
        "pixel":0.5,
        "line":43007.5,
        "x":-58.519444444444446,
        "y":-34.408333333333331,
        "z":0.0
      }
    ]


Related Questions


When should I use gdal_merge?

Updated February 22, 2018 16:22 PM


Can I change the pixel sizes in a world file?

Updated July 03, 2018 02:22 AM