Skip to content

Commit b9555c8

Browse files
committed
added missing Classification parameter title
1 parent 1b89b9d commit b9555c8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pystac/extensions/classification.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def apply(
6060
value: int,
6161
description: str | None = None,
6262
name: str | None = None,
63+
title: str | None = None,
6364
color_hint: str | None = None,
6465
nodata: bool | None = None,
6566
percentage: float | None = None,
@@ -74,6 +75,7 @@ def apply(
7475
name: Short name of the class for machine readability. Must consist only
7576
of letters, numbers, -, and _ characters. Required as of v2.0 of
7677
this extension.
78+
title: Human-readable name for use in, e.g., a map legend
7779
color_hint: An optional hexadecimal string-encoded representation of the
7880
RGB color that is suggested to represent this class (six hexadecimal
7981
characters, all capitalized)
@@ -90,6 +92,7 @@ def apply(
9092
"As of v2.0.0 of the classification extension, 'name' is required"
9193
)
9294
self.name = name
95+
self.title = title
9396
self.description = description
9497
self.color_hint = color_hint
9598
self.nodata = nodata
@@ -108,6 +111,7 @@ def create(
108111
value: int,
109112
description: str | None = None,
110113
name: str | None = None,
114+
title: str | None = None,
111115
color_hint: str | None = None,
112116
nodata: bool | None = None,
113117
percentage: float | None = None,
@@ -122,6 +126,7 @@ def create(
122126
name: Short name of the class for machine readability. Must consist only
123127
of letters, numbers, -, and _ characters. Required as of v2.0 of
124128
this extension.
129+
title: Human-readable name for use in, e.g., a map legend
125130
color_hint: An optional hexadecimal string-encoded representation of the
126131
RGB color that is suggested to represent this class (six hexadecimal
127132
characters, all capitalized)
@@ -134,6 +139,7 @@ def create(
134139
c.apply(
135140
value=value,
136141
name=name,
142+
title=title,
137143
description=description,
138144
color_hint=color_hint,
139145
nodata=nodata,
@@ -189,6 +195,17 @@ def name(self, v: str) -> None:
189195
)
190196
self.properties["name"] = v
191197

198+
@property
199+
def title(self) -> str | None:
200+
return self.properties.get("title")
201+
202+
@title.setter
203+
def title(self, v: str) -> None:
204+
if v is not None:
205+
self.properties["title"] = v
206+
else:
207+
self.properties.pop("title", None)
208+
192209
@property
193210
def color_hint(self) -> str | None:
194211
"""Get or set the optional color hint for this class.

0 commit comments

Comments
 (0)