huggingface-solara / etc /cog_test.py
Jonathan Marokhovsky
Made the cog-focused page, reorganized into more of an app framework, and updated the requirements
c140c33
raw
history blame contribute delete
No virus
1.31 kB
from typing import List
from pystac_client import Client
import leafmap
# s2_url = "https://earth-search.aws.element84.com/v1/collections/sentinel-2-l2a"
# client = Client.open(s2_url)
#
# s2_cols = client.get_collections()
# cog_ids: List[str] = list()
# for collection in s2_cols:
# cog_ids.append(collection.id)
#
# selected_cog = client.get_collection(cog_ids[1])
# selected_cog
esa_url = "https://services.terrascope.be/stac/"
client = Client.open(esa_url)
collections = client.get_collections()
stac_ids: List[str] = list()
for collection in collections:
stac_ids.append(collection.id)
center_point = [41.633484, -70.154371]
converted_center_point = dict(type="Point", coordinates=center_point)
m = leafmap.Map(center=center_point, zoom=8, height="500px")
esa_results = client.search(
collections=[stac_ids[15]],
intersects=converted_center_point,
max_items=12,
datetime="2021-01-01/2023-09-22",
query=["eo:cloud_cover<5"],
)
# import pystac
#
# lulc_url = (
# "https://api.impactobservatory.com/stac-aws/collections/io-10m-annual-lulc/items"
# )
# collections = pystac
# print(collections)
# import leafmap
#
# esa_url = "https://services.terrascope.be/stac/api/"
#
# m = leafmap.Map(center=[41.633484, -70.154371], zoom=8, height="500px")
# m.add_stac_layer(esa_url)