20 lines
689 B
Python
20 lines
689 B
Python
import geopandas as gpd
|
|
import planetary_computer
|
|
import pystac_client
|
|
import odc.stac
|
|
|
|
bbox = [105.5, 9.2, 106.3, 10.0]
|
|
time_range = "2023-01-01/2023-01-30"
|
|
catalog = pystac_client.Client.open("https://planetarycomputer.microsoft.com/api/stac/v1", modifier=planetary_computer.sign_inplace)
|
|
items = list(catalog.search(collections=["sentinel-2-l2a"], bbox=bbox, datetime=time_range).items())[:1]
|
|
items = [planetary_computer.sign(item) for item in items]
|
|
|
|
x = 561609
|
|
y = 1024183
|
|
try:
|
|
ds = odc.stac.load(items, bands=["B02"], crs="EPSG:32648", resolution=10, x=(x-80, x+80), y=(y-80, y+80))
|
|
print("Success with x/y:", ds.dims)
|
|
except Exception as e:
|
|
print("Error with x/y:", e)
|
|
|