Skip to content

Commit

Permalink
pin to projection extension v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hrodmn committed Feb 28, 2025
1 parent 838a991 commit 81f6150
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions 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 @@ -39,7 +39,6 @@
26.0
],
"properties": {
"proj:code": "EPSG:4326",
"proj:geometry": {
"type": "Polygon",
"coordinates": [
Expand Down
8 changes: 8 additions & 0 deletions src/stactools/global_mangrove_watch/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ def create_item(
# ensure proj:epsg gets set (pystac bug)
item.properties["proj:epsg"] = EPSG

# we need to stick with projection extension v1.1.0 in order to maintain
# compatibility with the STACIT driver in older GDAL versions
for i, extension in enumerate(item.stac_extensions):
if "projection/v2.0" in extension:
_extension = item.stac_extensions.pop(i)
item.stac_extensions.append(_extension.replace("v2.0.0", "v1.2.0"))
_ = item.properties.pop("proj:code")

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 81f6150

Please sign in to comment.