1

I uploaded a landsat raster layer in QGIS 3.2 and I need to crop it. I noticed that for every pixel QGIS knows the lat/lon value (as expected). Since each pixel has its associated lat/lon coordinate, is there a way to specify a lat and lon range and crop the raster layer based on that range?

0

There's either GDAL's clip raster by extent or SAGA's clip raster by polygon. Please be aware, that geographic CRS converge towards the poles, thus leading differences in metric distances between one degree of longitude at the equator and one degree of longitude at e.g. 10° latitude.

5
  • Thank you for your solution! So I tried going to Raster -> Extraction -> Clip Raster by Extent. I then choose my raster layer and specify (xmin, xmax, ymin, ymax) as -77.7139, -76.3450, 38.7669, 39.5488. Then I click "run in background". However, I get an error saying "ERROR 1: Error: Computed -srcwin -7413 147549 0 0 has negative width and/or height. Input file size is 7821, 7951." It seems that I am incorrectly choosing my ranges? But I am certain the raster layer is comprised of the ranges I gave. – Andrew Oct 30 '18 at 12:33
  • Did you make sure your raster is a) georeferenced and b) in the same CRS as your coordinates (presumably WGS 84)? – Erik Oct 30 '18 at 12:39
  • 1
    Got it! It was georeferenced but had to change the CRS to WGS 84. Thanks! – Andrew Oct 30 '18 at 12:52
  • Simply assigning a different CRS to a layer usually does not do the trick, you often have to transform/reproject. Changing the projects CRS can prove more helpful sometims. – Erik Oct 30 '18 at 12:54
  • 1
    Or sorry that is what I meant (not well versed in the terminology). I used the Warp (reproject) option in the Raster drop-down menu. – Andrew Oct 30 '18 at 12:57

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.