Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve add_stac_layer to support pystac.Item #944

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Improve add_stac_layer to support pystac.Item #944

merged 1 commit into from
Oct 30, 2024

Conversation

giswqs
Copy link
Member

@giswqs giswqs commented Oct 30, 2024

Fix #940

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]
result = 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"}],
)
item = result.get_all_items()[-1]
m = leafmap.Map()
m.add_stac_layer(item, assets=["nir", "red", "green"])
m

image

Copy link

@github-actions github-actions bot temporarily deployed to pull request October 30, 2024 13:51 Inactive
@mergify mergify bot merged commit f0a22c5 into master Oct 30, 2024
16 checks passed
Copy link

mergify bot commented Oct 30, 2024

Thanks for the contribution @giswqs 🤩

@mergify mergify bot deleted the stac branch October 30, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: add_stac_layer to accept a pystac.item.Item directly
1 participant