Skip to content

Commit

Permalink
pin to projection extension v1.2.0 (#4)
Browse files Browse the repository at this point in the history
maintains backwards compatibility with older versions of GDAL
  • Loading branch information
hrodmn authored Feb 28, 2025
1 parent 98ae0f8 commit 300ba45
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ number as needed.

## [Unreleased]

## [0.2.2]

### Fixed

- Pin projection extension to v1.2.0 for backwards compatabality with GDAL's STACIT driver

## [0.2.1]

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion examples/GMW_N26W082_2020_v3/GMW_N26W082_2020_v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "Feature",
"stac_version": "1.1.0",
"stac_extensions": [
"https://stac-extensions.github.io/projection/v2.0.0/schema.json"
"https://stac-extensions.github.io/projection/v1.2.0/schema.json"
],
"id": "GMW_N26W082_2020_v3",
"geometry": {
Expand Down Expand Up @@ -88,6 +88,7 @@
0.0,
1.0
],
"proj:epsg": 4326,
"datetime": "2020-12-31T00:00:00Z"
},
"links": [
Expand Down
4 changes: 2 additions & 2 deletions examples/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@
"bbox": [
[
-180.0,
90.0,
-90.0,
180.0,
-90.0
90.0
]
]
},
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "stactools-global-mangrove-watch"
version = "0.2.1"
version = "0.2.2"
description = "A stactools package for the Global Mangrove Watch dataset"
readme = "README.md"
authors = [{ name = "Henry Rodman", email = "[email protected]" }]
Expand Down
15 changes: 15 additions & 0 deletions src/stactools/global_mangrove_watch/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,21 @@ def create_item(
transform=rasterio.transform.from_bounds(*item_attributes["bbox"], *ITEM_SHAPE),
)

# ensure proj:epsg gets set (pystac bug)
item.properties["proj:epsg"] = EPSG

# we need to stick with projection extension <v2.0 in order to maintain
# compatibility with the STACIT driver in older GDAL versions
extensions = ["https://stac-extensions.github.io/projection/v1.2.0/schema.json"]
extensions.extend(
(
e
for e in item.stac_extensions
if not e.startswith("https://stac-extensions.github.io/projection")
)
)
item.stac_extensions = extensions

assert isinstance(item, Item)

return item
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 300ba45

Please sign in to comment.