Skip to content

examples module

Get a list of HTTP URLs to the example datasets.

Returns:

Name Type Description
list

A list of HTTP URLs to the example datasets.

Source code in leafmap/examples/__init__.py
46
47
48
49
50
51
52
53
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:

Name Type Description
list

A list of names of the example datasets.

Source code in leafmap/examples/__init__.py
36
37
38
39
40
41
42
43
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

Raises:

Type Description
ValueError

If the dataset name is not found.

Returns:

Name Type Description
str

The HTTP URL to the dataset.

Source code in leafmap/examples/__init__.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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())}"
        )