s1ard icon indicating copy to clipboard operation
s1ard copied to clipboard

Define MGRS tiles for polar regions

Open johntruckenbrodt opened this issue 3 years ago • 4 comments

Currently the processor makes use of a KML file provided for the Sentinel-2 mission to get the characteristics for individual MGRS tiles. This file does not define areas at the poles:

The MGRS itself grid does define tiles in these areas. An alternative to the KML file has to be found to enable processing of scenes in these regions.

johntruckenbrodt avatar Jun 22 '22 12:06 johntruckenbrodt

The MGRS coordinates can be computed using the mgrs library, which would already be an improvement over using the Sentinel-2 KML file:

>>> import mgrs
>>> m = mgrs.MGRS()
>>> print(m.toMGRS(latitude=51, longitude=11.5, MGRSPrecision=0))
'32UPB'
>>> print(m.MGRSToUTM('32UPB'))
(32, 'N', 600000.0, 5600000.0)

UPS polar tile names can also be retrieved using toMGRS but an equivalent to MGRSToUTM for UPS does not exist.

johntruckenbrodt avatar Sep 01 '22 16:09 johntruckenbrodt

The following can be used to get the geometry of the corresponding tile for a point:

import mgrs
from spatialist.vector import bbox

lat = 84
lon = 11.5

m = mgrs.MGRS()
mgrs_tile = m.toMGRS(latitude=lat, longitude=lon, MGRSPrecision=0)
zone, hem, east, north = m.MGRSToUTM(mgrs_tile)

epsg = 32600 + zone
if hem == 'S':
    epsg += 100

coordinates = {'xmin': east, 'xmax': east + 109800,
               'ymin': north + 100000, 'ymax': north - 9800}

with bbox(coordinates=coordinates, crs=epsg) as geom:
    print(geom.convert2wkt(set3D=False)[0])

This prints the geometry for tile 33XVP:

POLYGON ((400000 9400000,400000 9290200,509800 9290200,509800 9400000,400000 9400000))

which is slightly different to the geometry in the Sentinel-2 KML file:

POLYGON ((399960 9400020,399960 9290220,509760 9290220,509760 9400020,399960 9400020))

However, not all tiles show this difference.

Also, in areas of UTM zone overlap not all MGRS tiles are covered by the S2 KML. This is further described here: https://gis.stackexchange.com/questions/227847/finding-sentinel-tile-for-specific-long-lat-coordinate

johntruckenbrodt avatar Sep 06 '22 12:09 johntruckenbrodt

See here for an explanation of the point above: https://github.com/opendatacube/odc-stac/issues/94#issuecomment-1326270832

johntruckenbrodt avatar Nov 24 '22 12:11 johntruckenbrodt

Here is a first draft: image

johntruckenbrodt avatar Apr 18 '23 07:04 johntruckenbrodt