Skip to content

Commit

Permalink
fix: use application/geo+json for item links (#1495)
Browse files Browse the repository at this point in the history
* fix: use application/geo+json for item links

* chore: update changelog
  • Loading branch information
gadomski authored Jan 16, 2025
1 parent 2261b55 commit 1cf7f3f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

## [Unreleased]


### Added

- Top-level `item_assets` dict on `Collection`s ([#1476](https://github.com/stac-utils/pystac/pull/1476))
Expand All @@ -14,6 +13,10 @@
- Correctly detect absolute file path ref on windows, reflecting change in python 3.13 ([#1475](https://github.com/stac-utils/pystac/pull/14750)) (only effects python 3.13)
- Deprecated `ItemAssetExtension` ([#1476](https://github.com/stac-utils/pystac/pull/1476))

### Fixed

- Use `application/geo+json` for `item` links ([#1495](https://github.com/stac-utils/pystac/pull/1495))

## [v1.11.0] - 2024-09-26

### Added
Expand Down
2 changes: 1 addition & 1 deletion pystac/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def child(cls: type[L], c: Catalog, title: str | None = None) -> L:
def item(cls: type[L], item: Item, title: str | None = None) -> L:
"""Creates a link to an Item."""
return cls(
pystac.RelType.ITEM, item, title=title, media_type=pystac.MediaType.JSON
pystac.RelType.ITEM, item, title=title, media_type=pystac.MediaType.GEOJSON
)

@classmethod
Expand Down
6 changes: 6 additions & 0 deletions tests/test_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,9 @@ def test_is_hierarchical(rel: str) -> None:
)
def test_is_not_hierarchical(rel: str) -> None:
assert not Link(rel, "a-target").is_hierarchical()


def test_item_link_type(item: Item) -> None:
# https://github.com/stac-utils/pystac/issues/1494
link = Link.item(item)
assert link.media_type == "application/geo+json"

0 comments on commit 1cf7f3f

Please sign in to comment.