Skip to content

Add MLM extension #1542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b9555c8
added missing Classification parameter title
jonas-hurst Mar 18, 2025
f1c10db
added changes to changelog
jonas-hurst Mar 18, 2025
f3e7141
added missing parameters to test_classification_object: title, nodata…
jonas-hurst Mar 18, 2025
1cb33e4
added ml extension
jonas-hurst Mar 26, 2025
7dd6e99
added stac:mlm extension tests
jonas-hurst Mar 26, 2025
a89481b
added collection and asset extension
jonas-hurst Mar 31, 2025
9beabc1
removed TODO
jonas-hurst Mar 31, 2025
7165b61
added documentation
jonas-hurst Apr 2, 2025
478580a
added docstring to classes
jonas-hurst Apr 2, 2025
c74d544
renamed asset extension classes
jonas-hurst Apr 2, 2025
1af5e3e
added mlm extension classes
jonas-hurst Apr 2, 2025
a3bec04
added mlm extension
jonas-hurst Apr 2, 2025
888c899
Merge branch 'main' into main
jonas-hurst Apr 2, 2025
46516ea
removed todos
jonas-hurst Apr 2, 2025
e25e615
Merge remote-tracking branch 'origin/main'
jonas-hurst Apr 2, 2025
56f0ed0
added extension migration
jonas-hurst Apr 2, 2025
10bbb41
removed useless code
jonas-hurst Apr 3, 2025
ceec5f1
fixed docstrings
jonas-hurst Apr 3, 2025
26b221c
fixed __eq__ NotImplemented
jonas-hurst Apr 3, 2025
3cefe9f
fixed repr strings
jonas-hurst Apr 3, 2025
bd81c78
improved test coverage
jonas-hurst Apr 3, 2025
28dc4b3
improved test coverage
jonas-hurst Apr 3, 2025
2fc681e
changed exceptions
jonas-hurst Apr 3, 2025
fcfba65
fixed docstring
jonas-hurst Apr 3, 2025
10b7c93
Merge branch 'main' into main
gadomski Apr 7, 2025
c75f50c
Update CHANGELOG.md
jonas-hurst Apr 14, 2025
f33c75a
fixed typo
jonas-hurst Apr 14, 2025
cfd713d
fixed typo
jonas-hurst Apr 14, 2025
fb35994
fixed typo
jonas-hurst Apr 14, 2025
40b0c8f
fixed typo
jonas-hurst Apr 14, 2025
0fb78c8
fixed typo
jonas-hurst Apr 14, 2025
16bfdcd
line break to satisfy line length requirement
jonas-hurst Apr 14, 2025
69e9bc3
fixed typo in ENTRYPOINT_ASSET_PROP
jonas-hurst Apr 14, 2025
036aa06
fixed typo in COMPILE_METHOD_ASSET_PROP
jonas-hurst Apr 14, 2025
68075aa
removed dummy docstring
jonas-hurst Apr 14, 2025
4d1f860
fixed Enum tuples
jonas-hurst Apr 14, 2025
58feb54
added mlm to CollectionExt
jonas-hurst Apr 14, 2025
a0221f3
added mlm to Asset and ItemAssetDefinition mlm accessor
jonas-hurst Apr 15, 2025
477f5f9
Update CHANGELOG.md
gadomski Apr 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

- `Collection.from_items` for creating a `pystac.Collection` from an `ItemCollection` ([#1522](https://github.com/stac-utils/pystac/pull/1522))
- `extensions.mlm` for supporting the [MLM](https://github.com/stac-extensions/mlm) extension ([#1542](https://github.com/stac-utils/pystac/pull/1542))

### Fixed

Expand Down
3 changes: 3 additions & 0 deletions docs/api/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pystac.extensions
grid.GridExtension
item_assets.ItemAssetsExtension
mgrs.MgrsExtension
mlm.MLMExtension
mlm.AssetGeneralMLMExtension
mlm.AssetDetailedMLMExtension
pointcloud.PointcloudExtension
projection.ProjectionExtension
raster.RasterExtension
Expand Down
8 changes: 8 additions & 0 deletions docs/api/extensions/mlm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pystac.extensions.mlm
============================

.. automodule:: pystac.extensions.mlm
:members:
:inherited-members: StringEnum, Generic, PropertiesExtension, ExtensionManagementMixin
:undoc-members:

2 changes: 2 additions & 0 deletions pystac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
warnings.filterwarnings("ignore", category=DeprecationWarning)
import pystac.extensions.label
import pystac.extensions.mgrs
import pystac.extensions.mlm
import pystac.extensions.pointcloud
import pystac.extensions.projection
import pystac.extensions.raster
Expand All @@ -123,6 +124,7 @@
pystac.extensions.item_assets.ITEM_ASSETS_EXTENSION_HOOKS,
pystac.extensions.label.LABEL_EXTENSION_HOOKS,
pystac.extensions.mgrs.MGRS_EXTENSION_HOOKS,
pystac.extensions.mlm.MLM_EXTENSION_HOOKS,
pystac.extensions.pointcloud.POINTCLOUD_EXTENSION_HOOKS,
pystac.extensions.projection.PROJECTION_EXTENSION_HOOKS,
pystac.extensions.raster.RASTER_EXTENSION_HOOKS,
Expand Down
26 changes: 26 additions & 0 deletions pystac/extensions/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
from pystac.extensions.grid import GridExtension
from pystac.extensions.item_assets import ItemAssetsExtension
from pystac.extensions.mgrs import MgrsExtension
from pystac.extensions.mlm import (
AssetDetailedMLMExtension,
AssetGeneralMLMExtension,
MLMExtension,
)
from pystac.extensions.pointcloud import PointcloudExtension
from pystac.extensions.projection import ProjectionExtension
from pystac.extensions.raster import RasterExtension
Expand Down Expand Up @@ -48,6 +53,7 @@
"grid",
"item_assets",
"mgrs",
"mlm",
"pc",
"proj",
"raster",
Expand All @@ -71,6 +77,7 @@
GridExtension.name: GridExtension,
ItemAssetsExtension.name: ItemAssetsExtension,
MgrsExtension.name: MgrsExtension,
MLMExtension.name: MLMExtension,
PointcloudExtension.name: PointcloudExtension,
ProjectionExtension.name: ProjectionExtension,
RasterExtension.name: RasterExtension,
Expand Down Expand Up @@ -153,6 +160,10 @@ def cube(self) -> DatacubeExtension[Collection]:
def item_assets(self) -> dict[str, ItemAssetDefinition]:
return ItemAssetsExtension.ext(self.stac_object).item_assets

@property
def mlm(self) -> MLMExtension[Collection]:
return MLMExtension.ext(self.stac_object)

@property
def render(self) -> dict[str, Render]:
return RenderExtension.ext(self.stac_object).renders
Expand Down Expand Up @@ -225,6 +236,10 @@ def grid(self) -> GridExtension:
def mgrs(self) -> MgrsExtension:
return MgrsExtension.ext(self.stac_object)

@property
def mlm(self) -> MLMExtension[Item]:
return MLMExtension.ext(self.stac_object)

@property
def pc(self) -> PointcloudExtension[Item]:
return PointcloudExtension.ext(self.stac_object)
Expand Down Expand Up @@ -389,6 +404,13 @@ class AssetExt(_AssetExt[Asset]):
def file(self) -> FileExtension[Asset]:
return FileExtension.ext(self.stac_object)

@property
def mlm(self) -> AssetGeneralMLMExtension[Asset] | AssetDetailedMLMExtension:
if "mlm:name" in self.stac_object.extra_fields:
return AssetDetailedMLMExtension.ext(self.stac_object)
else:
return AssetGeneralMLMExtension.ext(self.stac_object)

@property
def timestamps(self) -> TimestampsExtension[Asset]:
return TimestampsExtension.ext(self.stac_object)
Expand All @@ -406,6 +428,10 @@ class ItemAssetExt(_AssetExt[ItemAssetDefinition]):

stac_object: ItemAssetDefinition

@property
def mlm(self) -> MLMExtension[ItemAssetDefinition]:
return MLMExtension.ext(self.stac_object)


@dataclass
class LinkExt(_AssetsExt[Link]):
Expand Down
Loading