EPSG code of Sentinel-2 images

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.

4 Likes

Thanks a lot!

Going a step further, you can use these few lines of Python code:

from pyproj import CRS

epsg_code = CRS.from_string("+proj=utm +zone=31 +north").to_authority()[1]
print(epsg_code)  # '32631'