1

I am using Sentinel-2 images and I want to clip the image with a shapefile I made. (The shapefile was smoothed with Smooth polygon with a 10m PAEK tolerance).

I have tried the Raster clip tool and the Image Analysis Toolbars with moderate success. I have gotten reasonable clips but the colors change, and I cannot access the attribute table.

How can I clip the raster without altering the way it look?

Because I will also be applying this method to 8A,11,5 composites.

RGB composite image and shapefile outline.

RGB composite image and shapefile outline

Raster clip (spatial analysis) and input parameters. Saved as a .tif and checked both boxes.

Raster clip spatial analysis inputs

This is the result.

Raster clip analysis result.

And when I used the Image Analysis Toolbar, I used the default parameters

Img Analysis Toolbar inputs

And I got a result that is more or less the same. Some of the sources I have found say to clip each raster separately but when I tried, my result is still skewed.

Is it the statistics I need to recalculate?

How can I get clips to be the same as the original raster?

Or, is it OK for the values to be different?

I am going to apply a water mask and get the area of a plant that I am familiar with, the bright green seen in the photos.

This is the environment used

enter image description here-

  • 1
    Possible duplicate of Clipping raster layer properties change – ahmadhanb Jan 7 at 1:15
  • @ahmadhanb This question appears to be different than the one you link to. The OP is referring to multiband imagery here as opposed to single band raster derivatives in the link you provide. – Aaron Jan 7 at 4:49
  • 1
    @Aaron I agree with you that the OP is asking about multiband imagery and I assumed the solution is same as the one I marked as duplicate. However, after testing I found the solution is slightly different. – ahmadhanb Jan 7 at 5:10
1

a possible solution to get the statistics correctly after clipping the image is to save the statistics of the original image as XML and load the saved XML file to the clippied image.

To do that:

  • Go to the Properties of the original image -> Symbology -> Under Statistics, click on Save as XML

enter image description here

  • Load the same XML file to the original image from the Properties of the original image -> Symbology -> Under Statistics, change For each Raster dataset to From custom settings below, click on Load XML

enter image description here

  • Do the step 2 for the clipped image to load the same XML file

Here is a multiband image before clip:

enter image description here

Here is a multiband image after clip:

enter image description here

You may need to change the stretch type to None first then click Apply and reuse Standard deviation and click Apply to activate the changes.

  • I did need to apply those changes in order to load the xml, so I applied the changes for the original image and the clip. The result is slightly darker, but that isn't consequential. Thank you, guys! – A. McCrea Jan 7 at 16:53
  • I just changed the contrast to the same level and now they are the same – A. McCrea Jan 7 at 17:09

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.