Skip to content

feat: Expose GeogTOWGS84GeoKey and ProjRectifiedGridAngleGeoKey - #368

Merged
kylebarron merged 1 commit into
mainfrom
kyle/geokeys-towgs84-rectified-grid-angle
Oct 26, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/geokeys-towgs84-rectified-grid-angle

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

Closes #367

GDAL writes GeogTOWGS84GeoKey (2062) for any CRS carrying +towgs84= and ProjRectifiedGridAngleGeoKey (3096) for every Hotine Oblique Mercator file (CT codes 3 and 9815, which includes +proj=somerc). GeoKeyDirectory skipped both as unknown keys, so a GeoKey-to-CRS builder could not recover the datum shift or the grid angle.

Changes

  • GeoKeyTag: add GeogTOWGS84 = 2062 and ProjRectifiedGridAngle = 3096.
  • GeoKeyDirectory: add geog_towgs84: Option<Vec<f64>> (3 or 7 doubles, read with into_f64_vec) and proj_rectified_grid_angle: Option<f64>.
  • Python GeoKeyDirectory: same two fields, wired into keys(), __getitem__, both From impls, and the .pyi stub with docstrings.

Tests

  • New Rust unit test building a directory with a 7-value TOWGS84 list and a grid angle through from_tags.
  • The existing fixtures/other/geogtowgs_subset_USGS_13_s14w171.tif already carries a 3-value key 2062; the Rust test that opens it now asserts the value, and the Python test_ifd_dict expected dict gains geog_towgs84: [0.0, 0.0, 0.0].

cargo test --all --all-features passes apart from test_ome_tiff_single_channel, which timed out fetching its remote file from cildata.crbs.ucsd.edu and is unrelated. cargo clippy for both crates, cargo fmt with the CI config, and the full Python suite (52 tests) pass.

🤖 Written by Claude Code

🤖 Generated with Claude Code

GDAL writes GeogTOWGS84GeoKey (2062) for any CRS with +towgs84 and
ProjRectifiedGridAngleGeoKey (3096) for every Hotine Oblique Mercator
file, but GeoKeyDirectory skipped both as unknown keys, so a GeoKey to
CRS builder could not recover the datum shift or the grid angle.

Add geog_towgs84 (3 or 7 doubles) and proj_rectified_grid_angle to the
Rust struct and the Python class, following the existing pattern.

Closes #367

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@kylebarron
kylebarron force-pushed the kyle/geokeys-towgs84-rectified-grid-angle branch from 9ac9c7b to 0080745 Compare October 26, 2026 16:18

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

lgtm!

@kylebarron
kylebarron merged commit a96db51 into main Oct 26, 2026
14 checks passed
@kylebarron
kylebarron deleted the kyle/geokeys-towgs84-rectified-grid-angle branch October 26, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GeoKeyDirectory does not expose GeogTOWGS84GeoKey (2062) or ProjRectifiedGridAngleGeoKey (3096)

1 participant