Fergui / m2m-api

API to search and download data using Machine-to-Machine (M2M) API from USGS.
MIT License
12 stars 4 forks source link

Different spatial coverage in scenes downloaded from USGS LANDSAT data #1

Open romass12 opened 1 year ago

romass12 commented 1 year ago

I am using M2M Python API to download scenes of Landsat 8 data for North America region, as shown in the code snippet below.

datasetName = "landsat_band_files_c2_l1"
spatialFilter =  {'filterType' : "mbr",
                  'lowerLeft' : {'latitude' : 31.8, 'longitude' : -157.99},
                  'upperRight' : { 'latitude' : 65.02, 'longitude' : -98}}
temporalFilter = {'start' : '2023-01-11', 'end' : '2023-01-13'}
serviceUrl = "https://m2m.cr.usgs.gov/api/api/json/stable/"

The band files I want are 5 and 7, the names are as given below

'LC08_L1TP_118066_20230113_20230113_02_RT_B5.TIF' 'LC08_L1TP_118066_20230113_20230113_02_RT_B7.TIF' Now, to plot and visualise, re-projection to EPSG:4326 is required. But on reprojection, the lat-lon extent are totally different from what I had requested for

test = rxr.open_rasterio(all_landsat_bands[0], masked=True) #first band image path
test = test.rio.reproject("EPSG:4326")
test.rio.bounds()

The output of the extent is :


(111.75961616451919,
 -9.73691271889413,
 113.84988985109456,
 -7.6224410148753226)

Why is the spatial extent of the scenes downloaded different from what was mentioned in spatialFilter?

Fergui commented 12 months ago

Can you share how you requested the data using the M2M Python API?

The issue is also described and discussed here: https://gis.stackexchange.com/questions/449502/different-spatial-coverage-in-scenes-downloaded-from-usgs-landsat-data