Layer stackin in SNAP for Sentinel 2

is it possible to make layer stacking in SNAP for sentinel 2 level 2A (after sen2cor processing) images?


Hi Wojtek,
have you tried with the Subset tool? It allows to select the bands you need, at least before doing sen2cor processing (The curious thing is that I’m not very sure about if you can do the sen2cor processing after making a subset)

Dear Wojtek,

In SNAP, it is possible to perform the layer stacking between 2 products using the “Collocation” module (“Raster” --> “Geometric Operations” --> “Collocation”).

The Collocation Tool allows to collocate two spatially overlapping products. Collocating two products implies that the pixel values of one product (the slave) are resampled into the geographical raster of the other (the master).
In order to avoid naming conflicts, the Collocation Tool allows to rename both master and slave components such as bands, flag codings and bitmask definitions according to a user defined pattern.



Dear Skudo,

The “Subset” module allows the users to re-size in spectral or/and spatial domain the product.
Concerning Sen2Cor, it accepts as input only S2 products in original format (S2 SAFE) and therefore if you apply the “Subset” tool and save you can not run Sen2Cor.



Thanks Fabrizio that was my doubt.

Can the collocate tool also be used for Fusion of say: SAR data and optical? say sentinel 1 and sentinel 2?

Because these two functions are separated in ENVI i.e. Layerstacking and Fusion. Layerstacking is usually used for stacking bands from the same sensor like Landsat bands, but fusion is used for separate sensors to enhance accuracies.



Dear Pamela,

Collocation Tool can be used for S1 and S2 data fusion, but please be informed that you should have the same projection for both of the images.
The output product will contain all the bands from S1 and S2 data.

Best Regards,

1 Like


Did someone is aware of a benchmarking study between the collocation tool in SNAP and other soft about the collocation error ?

Do you know which is the average RMS error for the tool ? @marpet @ABraun you are generally well informed :stuck_out_tongue: if you have an answer would be great !

Thanks in advance

I’m not aware of such a comparison.

The collocation error is also dependent on the source products.
The kind of the geo-codings of the inputs, their accuracy. The accuracy of the collocation is always dependent to the input products.
I can tell you how the collocation works. It iterates over all the pixels in the master products and tries to find the closest pixel in the slave product.

Thanks for your answer Marco.

I know how the tool work but yeah I was wondering if a (few ?) benchmark exist comparing especially coregistration of Sentinel-1 and Sentinel-2 data between SNAP and other free or charged software.

It’s kind of a hot topic but I struggle to find accurate papers on that stuff.

Well, thank you again for your answer :slight_smile:


After atmospheric correction in sen2cor, I got L2A data with 1o m resolution. Then I need to stack band 2,3,4 and 8, but I cannot open
S2A_USER_MSI_L2A_TL_MPS__20160710T111549_A005480_T37MEN_Bxx_10m.jp2 in SNAP, also ENVI, ERDAS.

is it possible to use Collocation tool to stack the layers? Other option?
Please help, thanks!


I think this was already answered by @ABraun.

After collocation, I would like to change the band order in my resulting image. Is that possible with SNAP?
Thank you

you could create new bands with the band maths operator at the end of your stack (don’t select ‘virtual layer’ and make sure you save your product first!) and then you can delete the first ones. I don’t know any better solution, sorry.

thank you, but that is too much work :wink: I need to re-shuffle 12 bands of several images after collocation. I hope this item can be considered for an upcoming SNAP version.

If you just want to group bands in the GUI then you could use the band grouping.
Chose from the context menu of the product the Properties entry.
There you can change the value.
Unfortunately, there is no documentation for this in the SNAP help.
But it is explained here:

Thank you. Could you explain this further, please? Also to give you the context, maybe it helps or maybe you might have another suggestion for the whole issue.

I am working with iCOR output of sentinel 2, and it consists of three images (excluding intermediary files): one with the 10-m resolution bands, one with the 20-m resolution bands, and one with 60-m resolution bands plus spatially resampled bands of all the others resolutions. But, I want to have one image with all Sentinel 2 bands resampled to 10 m pixel size (while preserving the original resolution - so I can’t just resample the 60-m pixels size output). So I need to mix and match!

The documentation says

pattern := {’:’ } | “” (empty string)
groupPath := {’/’ }
groupName := any non-empty string without characters ‘:’ and ‘/’

An example for pattern applicable to Envisat AATSR data is

I am sorry but this is not clear to me. What is meant by “pattern”, for example?

Let’s say I have an “image1” with two bands (image1_b1 and image1_b2), and I want to add to it two bands from another “image2” that can contain more bands than two (image2_b1 and image2_b2). Yet, I need to re-order the bands in the final grouping to, for example, image1_b1 followed by image2_b1 followed by image1_b2 followed by image2_b2.

If I am to use “band grouping”, could you give the script of the example above, if it is not too much to ask?

Okay, this is a different use case as I initially thought. Forget the groups.

Creating multi-resolution product is currently not supported in SNAP. So it will not work to combine the different resolutions in one product. You would need to resample the 20m and 60m bands to 10m and then you can merge them into a single product along with the 10m bands.

Yes. This is what I have done and it works well with the collocation. But, I am just asking if I can change the order of the bands so that I can plot meaningful spectra, for example.

Using the names you gave above, the following might work:


Then all image1_b* and all image2_b* should be in separate groups.
These are then shown separately and can be selected in the spectrum view.