Uncomment the following line to install leafmap if needed.
# !pip install -U leafmap
import leafmap
url = "https://earth-search.aws.element84.com/v1/"
collection = "sentinel-2-l2a"
time_range = "2020-12-01/2020-12-31"
bbox = [-122.2751, 47.5469, -121.9613, 47.7458]
search = leafmap.stac_search(
url=url,
max_items=10,
collections=[collection],
bbox=bbox,
datetime=time_range,
query={"eo:cloud_cover": {"lt": 10}},
sortby=[{"field": "properties.eo:cloud_cover", "direction": "asc"}],
)
search
search = leafmap.stac_search(
url=url,
max_items=10,
collections=[collection],
bbox=bbox,
datetime=time_range,
get_collection=True,
)
# search
search = leafmap.stac_search(
url=url,
max_items=10,
collections=[collection],
bbox=bbox,
datetime=time_range,
get_gdf=True,
)
search.head()
search = leafmap.stac_search(
url=url,
max_items=10,
collections=[collection],
bbox=bbox,
datetime=time_range,
get_assets=True,
)
# search
search = leafmap.stac_search(
url=url,
max_items=10,
collections=[collection],
bbox=bbox,
datetime=time_range,
get_info=True,
)
# search
search = leafmap.stac_search(
url=url,
max_items=10,
collections=[collection],
bbox=bbox,
datetime=time_range,
get_links=True,
)
search
Search and visualize open geospatial dataset interactively
leafmap.show_youtube_video("https://youtu.be/7OEraGYOWiU")
m = leafmap.Map(center=[37.7517, -122.4433], zoom=8)
m
The search results can be accessed using one of the following methods:
# m.stac_gdf # The GeoDataFrame of the STAC search results
# m.stac_dict # The STAC search results as a dictionary
# m.stac_item # The selected STAC item of the search result