Skip to content

Catalog

pystac.Catalog

Bases: Container

Source code in src/pystac/catalog.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class Catalog(Container):
    @classmethod
    def get_type(cls) -> str:
        return CATALOG_TYPE

    def __init__(
        self,
        id: str,
        description: str,
        title: str | None = None,
        stac_extensions: list[str] | None = None,
        # TODO allow extra fields here for backwards compatibility
        stac_version: str | None = None,
        links: list[Link | dict[str, Any]] | None = None,
        **kwargs: Any,
    ):
        """Creates a new catalog.

        Args:
            id: This catalog's id
            description: This catalog's description
            title: This catalog's title
        """
        self.description = description
        self.title = title
        super().__init__(id, stac_version, stac_extensions, links, **kwargs)

    def _to_dict(self) -> dict[str, Any]:
        """Converts this catalog to a dictionary."""
        d: dict[str, Any] = {
            "type": self.get_type(),
            "stac_version": self.stac_version,
        }
        if self.stac_extensions is not None:
            d["stac_extensions"] = self.stac_extensions
        d["id"] = self.id
        if self.title is not None:
            d["title"] = self.title
        d["description"] = self.description
        d["links"] = [link.to_dict() for link in self.iter_links()]
        d.update(copy.deepcopy(self.extra_fields))
        return d

__init__

__init__(
    id: str,
    description: str,
    title: str | None = None,
    stac_extensions: list[str] | None = None,
    stac_version: str | None = None,
    links: list[Link | dict[str, Any]] | None = None,
    **kwargs: Any,
)

Creates a new catalog.

Parameters:

Name Type Description Default
id str

This catalog's id

required
description str

This catalog's description

required
title str | None

This catalog's title

None
Source code in src/pystac/catalog.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def __init__(
    self,
    id: str,
    description: str,
    title: str | None = None,
    stac_extensions: list[str] | None = None,
    # TODO allow extra fields here for backwards compatibility
    stac_version: str | None = None,
    links: list[Link | dict[str, Any]] | None = None,
    **kwargs: Any,
):
    """Creates a new catalog.

    Args:
        id: This catalog's id
        description: This catalog's description
        title: This catalog's title
    """
    self.description = description
    self.title = title
    super().__init__(id, stac_version, stac_extensions, links, **kwargs)

_to_dict

_to_dict() -> dict[str, Any]

Converts this catalog to a dictionary.

Source code in src/pystac/catalog.py
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
def _to_dict(self) -> dict[str, Any]:
    """Converts this catalog to a dictionary."""
    d: dict[str, Any] = {
        "type": self.get_type(),
        "stac_version": self.stac_version,
    }
    if self.stac_extensions is not None:
        d["stac_extensions"] = self.stac_extensions
    d["id"] = self.id
    if self.title is not None:
        d["title"] = self.title
    d["description"] = self.description
    d["links"] = [link.to_dict() for link in self.iter_links()]
    d.update(copy.deepcopy(self.extra_fields))
    return d