SNAP: Clip Raster by Shapefile

I have a sentinel GRD image that i want to analyse only in some specific areas. Is there a way to create a subset with clipping or similar? I have done it with Raster -> Subset, but it is rather time consuming and not exact…
thanks

If you use the Subset operator on the command line with gpt, you can specify a polygon.
This will subset to the bounding box of the polygon.

Please have also a look at the following threads:


1 Like

Thanks a lot. I will check them out

Import a shapefile and use it in the land-sea mask module.

4 Likes

Hi,
this approach worked for me before. But now the result is same as the source image instead of image with “clipped” areas. Did something change in SNAP? I think that I am applying the same settings as before.

can you please post a screenshot of your raster and the imported vector, the masking module and the result?



It looks like the process ignores the vector. I laso tried to save the result as Geo Tiff and this error apeared.


It is impossible that this small polygon would be that big. Isn’t it?

that indicates that your raster is projected in degrees and your shapefile in UTM - is this possible?

I don’t think so. This is coordinate system of my shapefile.

Or this one is wrong? The vector fits when is overlayed on the top of the raster…

and your Raster as well?

It also looks like your polygon has small holes, is this true?

Yes, raster as well.
And there are small holes. But I tried it also with polygon without holes and the result is the same.

have you saved your product after importing the vector?

You can also draw a polygon manually and check if this technically works.

1 Like

At first I did not. When I saved after importing vector and then tried to process the result was the same.

But I wass succesful with creating my own area. So this works. I just do not understand, why my shapefiles do not. I have a lot of them and I planned to process it automatically…

you can export your vector back into a shapefile (right-click) and then see if it is still at the correct location in a GIS. Otherwise something went wrong at the import already or the projections do not match.

When I export vector that I imported before and then open in GIS as shp, it notices me that there is a difference in coordinate systems

When I just close the window, the polygon fit the area perfectly. Same thing happend when I export geometry that I draw by myself.

And I am importing like that… select the raster then file->Import->Vector Data->Esri Shapefile

I am also wondering why the results are that big? I mean, when I mask (clip) the area that is really small, it still has more than 3GB. The black area around the area of interest that I masked. Can I make it smaller somehow?

the only reason I could think of would be that the raster is not UTM projected.

This is what I choose when I do the Doppler Terrain Correction

Nevermind. The mistake was probably made while the separated polygons were made. It works with shapefile of all polygons together. I could work with that.

Thanks for your time and help!

Hi. I tried this. The process works fine, but the results are not what I wanted.

If I display the result, it gives me a picture that has the same extent as the original, but only with data in the masked area. also the used disk space went up from 1.6gb to almost 4gb.

I want everything outside of my shapefile to be clipped away…

then you will have to check “invert vector”

no - my issue is that I want to reduce file size. I want to keep just what is inside of my polygon.

The idea was that this is a better way of creating a subset, but for now it just creates the same set with a lot of no data values and more use of disk space.