Skip to content

Reuse the metres-to-degrees helper in simplify - #286

Merged
trasch merged 1 commit into
mainfrom
fix/simplify-followup
Oct 20, 2026
Merged

trasch merged 1 commit into
mainfrom
fix/simplify-followup

Conversation

@trasch

@trasch trasch commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the two review suggestions from #253.

Changes

  • Simplify.swift now reuses Coordinate3D.degrees(fromMeters:) instead of duplicating the cos(latitude) × 111 km conversion. This also replaces the hardcoded 111.0 km/degree with GISTool.earthCircumference / 360.0 (~111.32 km/degree), matching GISTool.degrees(fromMeters:atLatitude:) and the rest of the library.
  • Added a planar projection assertion to the tolerance regression test: the degree conversion only runs on the geographic branch, and EPSG:3857 passes meters through directly. The test uses the now-required projection: argument.

Tests

Full suite: 2,620 tests / 194 suites pass, clean build, no warnings.

Follow-up to #253.

Address the review suggestions on #253:

- Replace the duplicated cos(latitude) * 111 km conversion with Coordinate3D.degrees(fromMeters:). This also uses earthCircumference/360 (~111.32 km/degree) instead of the hardcoded 111.0, matching the rest of the library.
- Add a planar projection assertion to the tolerance regression test, adapted to the required projection argument.
@trasch trasch added the bug Something isn't working label Oct 20, 2026
@trasch
trasch merged commit c09d5e4 into main Oct 20, 2026
1 check passed
@trasch trasch self-assigned this Oct 20, 2026
@trasch
trasch deleted the fix/simplify-followup branch October 20, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant