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

Use the Earth Engine Data Catalog STAC list #346

Closed
giswqs opened this issue Mar 8, 2021 · 1 comment
Closed

Use the Earth Engine Data Catalog STAC list #346

giswqs opened this issue Mar 8, 2021 · 1 comment
Assignees
Labels
Feature Request New feature or request

Comments

@giswqs
Copy link
Member

giswqs commented Mar 8, 2021

Improve the dataset module to use the Earth Engine Data Catalog STAC list

https://gee.stac.cloud/?t=catalogs

@giswqs giswqs added the Feature Request New feature or request label Mar 8, 2021
@giswqs giswqs self-assigned this Mar 8, 2021
@giswqs
Copy link
Member Author

giswqs commented Mar 8, 2021

geemap now uses the GEE Data Catalog STAC list to stay current.

def get_ee_stac_list():
    """Gets the STAC list of the Earth Engine Data Catalog.

    Raises:
        Exception: If the JSON file fails to download.

    Returns:
        list: The list of Earth Engine asset IDs.
    """
    try:
        stac_url = (
            "https://earthengine-stac.storage.googleapis.com/catalog/catalog.json"
        )

        datasets = []
        with urllib.request.urlopen(stac_url) as url:
            data = json.loads(url.read().decode())
            for link in data["links"]:
                if "id" in link:
                    datasets.append(link["id"])

        return datasets

    except Exception as e:
        raise Exception(e)

@giswqs giswqs closed this as completed Mar 8, 2021
giswqs added a commit that referenced this issue Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant