Skip to content

Commit 1cf7f3f

Browse files
authored
fix: use application/geo+json for item links (#1495)
* fix: use application/geo+json for item links * chore: update changelog
1 parent 2261b55 commit 1cf7f3f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
## [Unreleased]
44

5-
65
### Added
76

87
- Top-level `item_assets` dict on `Collection`s ([#1476](https://github.com/stac-utils/pystac/pull/1476))
@@ -14,6 +13,10 @@
1413
- 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)
1514
- Deprecated `ItemAssetExtension` ([#1476](https://github.com/stac-utils/pystac/pull/1476))
1615

16+
### Fixed
17+
18+
- Use `application/geo+json` for `item` links ([#1495](https://github.com/stac-utils/pystac/pull/1495))
19+
1720
## [v1.11.0] - 2024-09-26
1821

1922
### Added

pystac/link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def child(cls: type[L], c: Catalog, title: str | None = None) -> L:
475475
def item(cls: type[L], item: Item, title: str | None = None) -> L:
476476
"""Creates a link to an Item."""
477477
return cls(
478-
pystac.RelType.ITEM, item, title=title, media_type=pystac.MediaType.JSON
478+
pystac.RelType.ITEM, item, title=title, media_type=pystac.MediaType.GEOJSON
479479
)
480480

481481
@classmethod

tests/test_link.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,9 @@ def test_is_hierarchical(rel: str) -> None:
346346
)
347347
def test_is_not_hierarchical(rel: str) -> None:
348348
assert not Link(rel, "a-target").is_hierarchical()
349+
350+
351+
def test_item_link_type(item: Item) -> None:
352+
# https://github.com/stac-utils/pystac/issues/1494
353+
link = Link.item(item)
354+
assert link.media_type == "application/geo+json"

0 commit comments

Comments
 (0)