Sentinel-2: How to know the S2 tiles from latitude/longitude geographical coordinates?

904 Views Asked by At

In Sentinel-2, how to know the S2 tiles from latitude/longitude geographical coordinates?

2

There are 2 best solutions below

0
On

A late answer but maybe someone will need it.

If you don't want to use the API (or an account or connection), there is a KML files that has the definitions of the tiles: https://sentinel.esa.int/documents/247904/1955685/S2A_OPER_GIP_TILPAR_MPC__20151209T095117_V20150622T000000_21000101T000000_B00.kml

You can parse that and make polygons from the coordinates and check if your point is inside the polygon (e.g. with shapely). Not sure if this will be faster than the API though.

Do not forget that the tiles have overlaps, i.e. a coordinate may exist in up to 4 tiles at the same time.

0
On

You have to login on https://scihub.copernicus.eu/dhus in order to request user and password for the API.

Then, you can use this function:

lat is the geographical latitude, lon the longitude and tiles contains the tiles in the grid:

    def S2tile_fromLATLON(float(lat),float(lon)):
        
        # query scenes
        api = SentinelAPI('USER', 'PASSWORD', 'https://scihub.copernicus.eu/dhus')
        
        footprint = 'POINT(%s %s)' % (lon, lat)
        
      
        product = api.query(footprint, 
                        date=('20190101', '20190301'), 
                        platformname='Sentinel-2', 
                        producttype= 'S2MSI1C', 
                        area_relation='Contains',
                        )
        # get tile
        tiles=[]
        for value in product.values():
            tile = value['tileid']
            if len(tiles)==0:
                print(tile)
                tiles.append(tile)
            aux=0
            for j in range(0,len(tiles)):
                if tile==tiles[j]:
                    aux=1
            if aux==0:
                print(tile)
                tiles.append(tile)
                  
        return tiles

You can also find the tiles using the .Kml file. But if you need to find tiles of many coordinates or automate a process it is recommended to use the API. The API result is all the tiles from a given coordinates, including overlapped tiles.