add EPSG code field to landsat
Closed this issue · 5 comments
landsat-8 does not include the eo:epsg field, as this is not readily available in the index file.
Determine where the EPSG can be determined or calculated from and add to landsat transform lambda.
Might be able to use gdalsrsinfo
Like just do it on one of the files - /vsicurl/http://landsat-pds.s3.amazonaws.com/c1/L8/025/006/LC08_L1TP_025006_20180628_20180628_01_RT/LC08_L1TP_025006_20180628_20180628_01_RT_B1.TIF
There's an experimental EPSG lookup, that doesn't work for me, but the last line of the output, in the projcs section, says: 'AUTHORITY["EPSG","32620"]]'
There's probably someway to do a similar lookup directly from the MTL file, but I don't know it.
I'm using this for CBERS-4, which generates only UTM. I guess LS8 do not use UTM for near polar scenes, but maybe an extension checking also for few (hopefully) additional projections could be used. It is not generic but will work for LS8 archive, and will not require access to TIFF.
def epsg_from_utm_zone(zone):
"""
Returns the WGS-84 EPSG for a given UTM zone
Input:
zone(int): Zone, positive values for North
Output:
epsg code(int).
"""
if zone > 0:
epsg = 32600 + zone
else:
epsg = 32700 - zone
return epsg
The issue is that we don't have access to the datafile (we don't want to download it just to get projection info). But we do have the scene geometry, so we need to determine the UTM zone from the scene center lat/lon, and hope it's correct. I'm assuming USGS uses UTM zone based on the center, but they may use different logic.
I see, thought the information was on CSV for LS but checked not that it is not. I anticipate problems in obtaining the zone from the scene center, specially if the scene center it is located in the UTM zone overlap. Last time I checked USGS's data processor (LPGS) source code could be downloaded, if you use exactly the same algorithm they use to choose the zone then you'd be safer.
It would be nice to have an EPSG code indicating just 'UTM' without zone information, I doubt that people using the image will be concerned about the zone in which the image is.
This repo will no longer be responsible for mapping Landsat metadata fields to STAC fields, it will instead rely on ingesting existing STAC catalogs, so this is to be figured out elsewhere.