Skip to content

feat: Add user-defined Oblique Stereographic CRS fixture - #71

Merged
kylebarron merged 3 commits into
mainfrom
kyle/oblique-stereographic-crs
Sep 25, 2026
Merged

kylebarron merged 3 commits into
mainfrom
kyle/oblique-stereographic-crs

Conversation

@kylebarron

@kylebarron kylebarron commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Upstream PR source-cooperative/cog-viewer#40 has a GeoTIFF that doesn't render correctly because we don't parse the CRS correctly.

Change list

  • Add small version of problematic file
  • add test that the CRS is stored in geo keys, not as EPSG:2953

Note

Written by Claude (Claude Code) on behalf of @kylebarron, not by @kylebarron.

From source-cooperative/cog-viewer#40

Adds real_data/source-coop-dataforcanada/O2308000_7586000_cog.tif, a 128x128 extract of a source.coop/dataforcanada COG (44 KB).

The CRS is New Brunswick Stereographic (equivalent to EPSG:2953), but it is stored as user-defined geo keys (ProjectedCSTypeGeoKey = 32767, ProjCoordTransGeoKey = CT_ObliqueStereographic). The projection origin is in ProjNatOriginLatGeoKey / ProjNatOriginLongGeoKey / ProjScaleAtNatOriginGeoKey. A parser that reads the ProjCenter* keys for this method gets an origin of (0, 0) and puts the image near Null Island.

A plain gdal_translate of the source doesn't keep those keys: GDAL identifies the CRS as EPSG:2953 by name and writes ProjectedCSTypeGeoKey = 2953 instead. The extract assigns the same WKT with the PROJCS/GEOGCS authority codes removed. All 19 geo keys in the extract match the source file. The README has the exact command and the listgeo output.

pixi run check passes locally.

🤖 Written by Claude Code

kylebarron and others added 2 commits September 25, 2026 12:18
128x128 extract of a source.coop/dataforcanada COG whose CRS (New Brunswick
Stereographic, equivalent to EPSG:2953) is stored as user-defined geo keys
with the projection origin in ProjNatOrigin*/ProjScaleAtNatOrigin rather than
ProjCenter*. Parsers that read the ProjCenter* keys for
CT_ObliqueStereographic place the image near (0, 0).

From source-cooperative/cog-viewer#40

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Regenerating the fixture with a plain gdal_translate silently writes
ProjectedCSTypeGeoKey = 2953 instead of the user-defined keys the fixture
exists to exercise. Read the raw GeoKeys with async-tiff and assert the full
set, and run pytest in CI.

async-tiff comes from PyPI because conda-forge has no osx-arm64 build.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comment thread tests/test_real_data.py Outdated
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@kylebarron
kylebarron enabled auto-merge (squash) September 25, 2026 17:24
@kylebarron
kylebarron merged commit f298013 into main Sep 25, 2026
1 check passed
@kylebarron
kylebarron deleted the kyle/oblique-stereographic-crs branch September 25, 2026 17:24
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.

1 participant