File size: 1,313 Bytes
c140c33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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)