Python API¶
from pystac.extensions.themes import Theme, ThemeConcept, ThemesExtension
| Entry point | Behavior |
|---|---|
ThemesExtension.ext(obj, add_if_missing=False) |
Wrap a Catalog, Collection, or Item. |
ThemesExtension.summaries(collection, add_if_missing=False) |
Wrap Collection summaries. |
extension.apply(themes) |
Replace the object's themes with a list of Theme values. |
extension.themes |
Read, replace, or clear themes using None. |
ThemesExtension.get_schema_uri() |
Return the Themes v1.0.0 schema URL. |
ThemesExtension.has_extension(obj) |
Check for that URL in stac_extensions. |
ThemesExtension.add_to(obj) |
Add the schema URL if absent. |
ThemesExtension.remove_from(obj) |
Remove the schema declaration. |
Theme.to_dict() / Theme.from_dict(data) |
Serialize or deserialize a theme. |
ThemeConcept.to_dict() / ThemeConcept.from_dict(data) |
Serialize or deserialize a concept. |
ext() and summaries() raise pystac.ExtensionNotImplemented when the declaration is missing unless add_if_missing=True. ext() raises pystac.ExtensionTypeError for unsupported objects.
Use ThemesExtension.ext(obj) directly. PySTAC does not provide item.ext.themes or catalog.ext.themes, and this package does not register those shortcuts. There is no from_item() alias.
pystac.extensions.themes
¶
Implements the :stac-ext:Themes Extension <themes>.
SCHEMA_URI: str = 'https://stac-extensions.github.io/themes/v1.0.0/schema.json'
module-attribute
¶
THEMES_PROP: str = 'themes'
module-attribute
¶
THEMES_EXTENSION_HOOKS: ExtensionHooks = ThemesExtensionHooks()
module-attribute
¶
ThemeConcept
¶
A concept in a knowledge organization system or controlled vocabulary.
Source code in pystac/extensions/themes.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
from_dict(d: dict[str, Any]) -> ThemeConcept
classmethod
¶
Deserialize a concept from its STAC representation.
Source code in pystac/extensions/themes.py
70 71 72 73 74 75 76 77 78 | |
to_dict() -> dict[str, Any]
¶
Serialize this concept to its STAC representation.
Source code in pystac/extensions/themes.py
59 60 61 62 63 64 65 66 67 68 | |
Theme
¶
A set of concepts from a knowledge organization system.
Source code in pystac/extensions/themes.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
from_dict(d: dict[str, Any]) -> Theme
classmethod
¶
Deserialize a theme from its STAC representation.
Source code in pystac/extensions/themes.py
101 102 103 104 105 106 107 108 109 110 | |
to_dict() -> dict[str, Any]
¶
Serialize this theme to its STAC representation.
Source code in pystac/extensions/themes.py
94 95 96 97 98 99 | |
ThemesExtension
¶
Bases: Generic[T], PropertiesExtension, ExtensionManagementMixin[Catalog | Collection | Item]
The Themes Extension for Catalogs, Collections, and Items.
Source code in pystac/extensions/themes.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
themes: list[Theme] | None
property
writable
¶
The themes for the extended object, or None when absent.
apply(themes: list[Theme]) -> None
¶
Apply Themes Extension fields to the extended STAC object.
Source code in pystac/extensions/themes.py
125 126 127 | |
ext(obj: T, add_if_missing: bool = False) -> ThemesExtension[T]
classmethod
¶
Wrap a Catalog, Collection, or Item to access its themes.
| Parameters: |
|
|---|
| Raises: |
|
|---|
Source code in pystac/extensions/themes.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
get_schema_uri() -> str
classmethod
¶
Return the Themes v1.0.0 schema URI.
Source code in pystac/extensions/themes.py
145 146 147 148 | |
summaries(obj: pystac.Collection, add_if_missing: bool = False) -> SummariesThemesExtension
classmethod
¶
Return the Themes Extension wrapper for Collection summaries.
Source code in pystac/extensions/themes.py
174 175 176 177 178 179 180 | |
CatalogThemesExtension
¶
Bases: ThemesExtension[Catalog]
Read and write themes on a STAC Catalog.
Source code in pystac/extensions/themes.py
183 184 185 186 187 188 189 190 191 192 193 194 | |
CollectionThemesExtension
¶
Bases: ThemesExtension[Collection]
Read and write themes on a STAC Collection.
Source code in pystac/extensions/themes.py
197 198 199 200 201 202 203 204 205 206 207 208 | |
ItemThemesExtension
¶
Bases: ThemesExtension[Item]
Read and write themes on a STAC Item.
Source code in pystac/extensions/themes.py
211 212 213 214 215 216 217 218 219 220 221 222 | |
SummariesThemesExtension
¶
Bases: SummariesExtension
The Themes Extension for Collection summaries.
Source code in pystac/extensions/themes.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
themes: list[Theme] | None
property
writable
¶
The themes in Collection summaries, or None when absent.
ThemesExtensionHooks
¶
Bases: ExtensionHooks
Declare the schema and STAC object types supported by Themes.
Source code in pystac/extensions/themes.py
244 245 246 247 248 249 250 251 252 253 | |