Skip to content

[Map] Add new helpers: DistanceUnit, DistanceCalculator, CoordinateUtils#2551

Merged
smnandre merged 1 commit into
symfony:2.xfrom
smnandre:map/distance-unit-calculator
Feb 7, 2025
Merged

[Map] Add new helpers: DistanceUnit, DistanceCalculator, CoordinateUtils#2551
smnandre merged 1 commit into
symfony:2.xfrom
smnandre:map/distance-unit-calculator

Conversation

@smnandre
Copy link
Copy Markdown
Member

@smnandre smnandre commented Feb 6, 2025

Q A
Bug fix? no
New feature? yes
Issues Fix #
License MIT

To ease the work on distances while managing maps, this PR introduce some new tools

  • DistanceUnit enum, that contains the most common distance units and their conversion ratios
  • A DistanceCalculatorInterface, and 3 implementations (most commonly used formulas)
  • A DistanceCalculator final service, that defaults to Vincenty formula and Meter unit
  • A CoordinateUtils helper to convert DMS coordinates (48° 7′ 3″ N) in decimal ones (48.1175 N)

Also, added getLatitude() and getLongitude() on Point, avoiding the use of toArray()

@smnandre smnandre requested a review from Kocal as a code owner February 6, 2025 00:15
@carsonbot carsonbot added Feature New Feature Map Status: Needs Review Needs to be reviewed labels Feb 6, 2025
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Feb 6, 2025
@smnandre smnandre force-pushed the map/distance-unit-calculator branch from 48a2c88 to 381bc6e Compare February 7, 2025 23:56
@smnandre smnandre merged commit 33a4141 into symfony:2.x Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New Feature Map Status: Reviewed Has been reviewed by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants