Skip to content

Conversation

@floriandeboissieu
Copy link

@floriandeboissieu floriandeboissieu commented Oct 14, 2025

Description:
The migration of projection to latest version systematically pops the field epsg. If extension URI is pointing to versions 1.0.0 or 1.1.0, it is also changed to point to version 2.0.0. However, if schema URI is v1.2.0, the extension schema URI is not updated. Although it is not necessary to validate items as both properties proj:code and proj:epsg are authorized in that v1.2.0, I propose to update it as well to v2.0.0 when migrating so that the change is explicit for all versions < 2.0.0. That would help finding out that a change occurred without having to inspect all assets.

PR Checklist:

  • Pre-commit hooks pass (run pre-commit run --all-files)
  • Tests pass (run pytest)
  • Documentation has been updated to reflect changes, if applicable
  • This PR maintains or improves overall codebase code coverage.
  • Changes are added to the CHANGELOG. See the docs for information about adding to the changelog.

The migration of projection to latest version systematically pops the field epsg. If extension URI is pointing to versions 1.0.0 or 1.1.0, it is also changed to point to version 2.0.0. 
However, if schema URI is v1.2.0 the extension schema URI is not changed. I propose to change it as well in that case so that the change is explicit for all versions < 2.0.0. That would help finding out that a change occurred.
@floriandeboissieu floriandeboissieu changed the title Add projection v1.2.0 to the list schema URIs in projection.py Add projection v1.2.0 to the list of schema URIs in projection.py Oct 14, 2025
@gadomski gadomski self-requested a review October 20, 2025 16:03
@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.32%. Comparing base (065a631) to head (5f86cfb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1590   +/-   ##
=======================================
  Coverage   92.32%   92.32%           
=======================================
  Files          55       55           
  Lines        8381     8381           
  Branches      966      966           
=======================================
  Hits         7738     7738           
  Misses        457      457           
  Partials      186      186           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@gadomski gadomski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, and could you add a simple regression test? The code in

def test_migrate_item() -> None:
old = "https://stac-extensions.github.io/projection/v1.1.0/schema.json"
current = "https://stac-extensions.github.io/projection/v2.0.0/schema.json"
path = TestCases.get_path("data-files/projection/example-with-version-1.1.json")
item = Item.from_file(path)
assert old not in item.stac_extensions
assert current in item.stac_extensions
assert item.ext.proj.epsg == 32614
assert item.ext.proj.code == "EPSG:32614"
assert item.assets["B1"].ext.proj.epsg == 32614
assert item.assets["B1"].ext.proj.code == "EPSG:32614"
assert item.assets["B8"].ext.proj.epsg == 9999
assert item.assets["B8"].ext.proj.code == "EPSG:9999"
should provide a guide, and you don't need to assert all the code+epsg stuff ... just a check that the extension URI updates should be enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants