0

I try to clip a hillshade raster and I get this error. The hillshade was the result of a reprojected DEM from WGS84 to WGS84UTM. When I to clip the hillshade or even the reprojected DEM, I get the error. Clipping the original WGS84 DEM works fine.

Any help?

enter image description here

2
  • 1
    I assume -srcwin means source windows i.e the hillshade raster. Does it have to do with the fact that it is not a rectangle after the reprojection via warp? Still -srcwin is not in the gdal code editor. The -projwin should be used not the -srcwin – Stelios M Apr 22 '15 at 16:54
  • @AndreJ you are absolutely right. I forgot to change the PROJECT CRS to WGS UTM. I did that and it works fine now. You should post your comment as an answer so I can accept it and give you the points – Stelios M Apr 24 '15 at 7:26
1

You write that you have reprojected the DEM from WGS84 to UTM, but the -projwin coordinates you give are in degrees.

That does not work. You have to work either in degrees, or a projected CRS in metres (or else).

Turning On-the-fly-reprojection OFF and work solely in one CRS is a good way to avoid such errors in raster operations.

1

Stelios is kind of on the right lines in his comment. However, you are using Projected coordinates in the dialog box and that is fine but it throws the error because the y value of corner 2 is less than the y value of corner 1. Fix it simply by swapping them over (i.e. go lower right to upper left instead of UL to LR).

5
  • Opposite, right? Currently, it's UL to LR but should be LL to UR. – mkennedy Apr 22 '15 at 17:11
  • Yep, but still, why does it work when I clip a rectangle raster instead of the "distorted" image above? – Stelios M Apr 22 '15 at 17:25
  • I swapped the points and still I get the same error. It must be the fact that the raster is not a rectangle. This is kinda bizarre, you should be aple to clip no matter what form the source raster has – Stelios M Apr 22 '15 at 19:23
  • If you simply swapped the points (both x and Y) then of course you will get the same error because your X dimension will now be negative. Swap only the Y values. It describes the same area and keeps both dimensions positive. – MappaGnosis Apr 23 '15 at 6:27
  • @MappaGnosis I tried that and it still pops the same error. It does not have to do with the extend of the clipper. The problem is in the input image for some reason – Stelios M Apr 23 '15 at 12:35

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.