Hello. How do I get the EPSG code of sentinel-2 images downloaded from directly from ESA using SNAP?
No need for SNAP to do that. Each S-2 image is a “granule” which has a file name which includes the so-called MGRS tile code. MGRS tiles are in UTM projection, which means EPSG=326NN in the Northern Hemisphere, and 327NN in the Southern. The actual NN zone is given by the first 2 digits in the MGRS tile name. The first character will give you the hemisphere (C-M is South, N to X is North). For some unknown reason, some rocket scientist decided to put a ‘T’ in front of the tile name.
So, this S-2 image: T31UFT_20180503T104019_B04_10m.jp2 is for MGRS tile 31UFT, in zone 31N, thus has EPSG=32631
All you need to do is parse the file name.
Thanks a lot!