Repository navigation
Conversation
Phase 3 of making the projection system generic: prove the registry
architecture by adding two new WGS84 projections.
- EPSG:3395 (WGS 84 / World Mercator): ellipsoidal Mercator with
Snyder forward formulas and an iterative inverse (the conformal
latitude iteration). Wraps at ±originShift like EPSG:3857, but y
values differ away from the equator. Valid y extent is the
EPSG-registered bound of ±20_048_966.104014604.
- EPSG:32662 (WGS 84 / Plate Carree): identity x/y in degrees,
wraps at ±180°.
Both are registered with SRID lookup, description, WKT patterns
("Pseudo-Mercator" vs. "Mercator" now disambiguated between 3857
and 3395), planar ProjectionKind and wraparound extents. All
algorithms, BoundingBox, MapTile and the pixel conversions pick
them up automatically through the ProjectionKind/registry
abstractions - no per-algorithm changes needed.
The WKB/WKT/TWKB coordinate constructors collapsed their per-
projection nested switches into one generic expression (behavior-
identical for all existing cases); new projections now decode and
encode correctly with embedded SRIDs.
Tests: conversion values computed independently with the Snyder
formulas, round trips across all five projections, antimeridian
cutting, distance/boundingBox/contains, normalize/clamp,
destination/bearing via the EPSG:4326 pivot, and WKB round trips
in the new projections.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 3 of making the projection system generic. Stacks on #238 (phase 2:
ProjectionDefinitionregistry) — review/merge that one first.Adds two new WGS84 projections to prove the registry architecture makes new projections cheap to add.
New projections
EPSG:3395 — WGS 84 / World Mercator (ellipsoidal)
originShiftlike EPSG:3857; valid y extent is the EPSG-registered bound of ±20_048_966.104014604EPSG:32662 — WGS 84 / Plate Carree
Registration
Projectionenum cases with raw SRID values,init?(srid:)entries,description"Pseudo-Mercator"→ 3857 vs."Mercator"→ 3395 now disambiguated;"Plate Carree"→ 32662ProjectionKind.planar, wraparound extents via the existing capability APIWhat this proved
Adding two projections touched only: the enum, two definition structs, the registry, and tests. All algorithms,
BoundingBox,MapTileand pixel conversions picked them up automatically through the Phase 1/2 abstractions.Coder simplification (early phase 4 work)
The WKB/WKT/TWKB coordinate constructors had per-projection nested switches; collapsed into one generic expression (
Coordinate3D(x:y:)+projected(to:)). Behavior-identical for all existing cases; new projections now decode/encode correctly with embedded SRIDs.Testing