Repository navigation
feat: return candidate coordinates with their linear unit - #9
Merged
Merged
Conversation
…onLatToCandidate)
- Add transformLonLatToCandidate and the LinearUnit type. A CRS gives the unit from the
axis information of PROJ (metre, US survey foot, ...); a custom or user pipeline row is
run in the inverse direction and gives the unit declared by the row.
- transformLonLatArrayToProjected keeps its contract (metres only, otherwise null) and is
now a thin wrapper around the new function.
- createCandidateTransformer returns a plain point list for a candidate in metres and
{ points, unit } for any other unit; rows are copied with their unit.
- The three historical Japan city plan zones declare their grid unit (yard).
- README (English and Japanese): Units section and API entries. dist rebuilt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bring in the preset contrasts of the candidate CRS demo before the unit fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A geographic CRS (OGC:CRS84, +proj=longlat) has east/north axes in degrees whose factor is radians per degree, not metres per unit. Check the coordinate system type and give null unless it is Cartesian, as before this API existed. - A pipeline row whose unit has an empty name or a metresPerUnit that is not a positive finite number cannot be transformed (null), so one bad user row does not stop the other candidates. - README (English and Japanese): both conditions in the Units section. dist rebuilt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
transformLonLatToCandidate(target, points, options?)returns{ points, unit }with aLinearUnit({ name, metresPerUnit }).EPSG:2227givesUS survey foot(1200 / 3937 m).unitgivesnull.transformLonLatArrayToProjectedkeeps its contract (metres only, otherwisenull). It is now a thin wrapper around the new function, so there is one implementation.createCandidateTransformerreturns a plain point list for a candidate in metres (unchanged) and{ points, unit }for any other unit.AtlasCandidateTransformerwidens its return type accordingly.UTJCP:ZONE-A/B/C) declareunit: { name: "yard (Japan City Plans)", metresPerUnit: 0.9143985307444408 }, matching their+to_meter.dist/rebuilt.Tests
tests/proj-wasm-output-basis.test.ts: UTJCP zone B in yards (checked against the same pipeline without+to_meter, within 1e-6 m),EPSG:2227in US survey feet,EPSG:6674in metres (identical totransformLonLatArrayToProjected), pipeline rows without a unit givenull, the adapter's return shapes and copies, and repeated calls after inverse pipeline transforms.tests/custom-projection-units.test.ts: every pipeline row of the bundled definitions has aunitthat matches its+to_meter.tests/proj-wasm-transform.test.tsandtests/candidate-transformer.test.tsare unchanged.The Teiresias side uses the same branch name so that its CI runs on this change.
🤖 Generated with Claude Code