Skip to content

examples module

get_ee_path(name)

Get the Earth Engine asset ID of an example dataset.

Parameters:

Name Type Description Default
name str

The name of the dataset, such as contents, countries, us_cities, us_states, china, CONUS_HU8, chn_admin_level0, chn_admin_level1, chn_admin_level2, chn_admin_line

required

Returns:

Type Description
str

The Earth Engine asset ID of the dataset.

Source code in geemap/examples/__init__.py
def get_ee_path(name):
    """Get the Earth Engine asset ID of an example dataset.

    Args:
        name (str): The name of the dataset, such as contents, countries, us_cities, us_states,
            china, CONUS_HU8, chn_admin_level0, chn_admin_level1, chn_admin_level2, chn_admin_line

    Returns:
        str: The Earth Engine asset ID of the dataset.
    """
    return f"{'users/giswqs/public/'}{name}"

Get a list of HTTP URLs to the example datasets.

Returns:

Type Description
list

A list of HTTP URLs to the example datasets.

Source code in geemap/examples/__init__.py
def get_links():
    """Get a list of HTTP URLs to the example datasets.

    Returns:
        list: A list of HTTP URLs to the example datasets.
    """

    return list(datasets.values())

get_names()

Get a list of names of the example datasets.

Returns:

Type Description
list

A list of names of the example datasets.

Source code in geemap/examples/__init__.py
def get_names():
    """Get a list of names of the example datasets.

    Returns:
        list: A list of names of the example datasets.
    """

    return list(datasets.keys())

get_path(name)

Get the HTTP URL to an example dataset.

Parameters:

Name Type Description Default
name str

The name of the dataset.

required

Exceptions:

Type Description
ValueError

If the dataset name is not found.

Returns:

Type Description
str

The HTTP URL to the dataset.

Source code in geemap/examples/__init__.py
def get_path(name):
    """Get the HTTP URL to an example dataset.

    Args:
        name (str): The name of the dataset.

    Raises:
        ValueError: If the dataset name is not found.

    Returns:
        str: The HTTP URL to the dataset.
    """
    if name in datasets:
        return datasets[name]
    else:
        raise ValueError(
            f"{name} not found in example datasets. It must be one of {list(datasets.keys())}"
        )

Last update: 2022-09-24
Back to top