0

I am trying to crop a TIFF file in QGIS 3.2. What I am currently doing is going to Raster -> Extraction -> Clip Raster by Extent... . Then I type in my min and max x,y values. The new raster layer is the cropped image but all of my layers from the original TIFF image are gone. Attached is a screenshot of the before (noncrop.jpg) and after (crop.jpg) images. Note in the photos the layers are different for the Cresults raster vs. the Clipped (extent). How do I clip the Cresults TIFF image without losing its classes?

Figure 1. QGIS screenshot of the original TIFF image with multiple classes.

Figure 1. QGIS screenshot of the original TIFF image with multiple classes.

Figure 2. QGIS screenshot of the original TIFF image with the Cropped image overlayed. Note the missing classes in the cropped image. Figure 2. QGIS screenshot of the original TIFF image with the Cropped image overlayed. Note the missing classes in the cropped image.

3
  • Save the style of the original image as qml and load the qml style file to the cropped image
    – ahmadhanb
    Nov 5, 2018 at 13:53
  • Could you please clarify this? I am unsure how to change the style of the original TIFF image to qml and then apply that style to the cropped image. Sorry, still trying to get used to using QGIS.
    – Andrew
    Nov 5, 2018 at 14:01
  • I posted an answer for your question.
    – ahmadhanb
    Nov 5, 2018 at 14:04

1 Answer 1

1

Go to the Layer Properties -> Style -> Save Style of the original raster tiff file (before clip) to use it on the clipped image:

enter image description here

Go the cropped image -> Layer Properties -> Style -> Load style to load the saved QML file on the cropped image so that it will have same colors of the original image.

2
  • Perfect. Worked like a charm!
    – Andrew
    Nov 5, 2018 at 14:36
  • @Andrew Glad it worked :)
    – ahmadhanb
    Nov 5, 2018 at 14:40

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.