Skip to content

Commit

Permalink
fix: handle coordinates with · as separator
Browse files Browse the repository at this point in the history
  • Loading branch information
kumy committed Aug 27, 2024
1 parent ca7b8f8 commit 4e4882a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function testCheckActualConverter() {
['test' => '46° 44′ 0″ N, 12° 11′ 0″ E', 'result' => ['lat' => 46.733333, 'lon' => 12.183333, 'format' => 'fromDegreeMinuteSecondHemisphere']],
['test' => '55° 3′ 23.96″ N, 9° 44′ 32.71″ E', 'result' => ['lat' => 55.056656, 'lon' => 9.742419, 'format' => 'fromDegreeMinuteSecondHemisphere']],
['test' => 'N55° 3′ 23.96″ E9° 44′ 32.71″', 'result' => ['lat' => 55.056656, 'lon' => 9.742419, 'format' => 'fromHemisphereDegreeMinuteSecond']],
['test' => 'N 53° 28,704\' · E 014° 47,064\'', 'result' => ['lat' => 53.478400, 'lon' => 14.784400, 'format' => 'fromHemisphereDegreeMinute']],

// Examples from the help page
['test' => '52.205205 21.190891', 'result' => ['lat' => 52.205205, 'lon' => 21.190891, 'format' => 'fromDecimalDegree']],
Expand Down
1 change: 1 addition & 0 deletions website/app/GeoKrety/Service/CoordinatesConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function ($m) {
$input = str_replace(' ', '', $coords);
$input = str_replace('O', 'W', $input);
$input = str_replace('+', '', $input);
$input = str_replace('·', '', $input);
$input = preg_replace('/[″"],/', '"', $input);
$input = str_replace(',', '.', $input);
$input = preg_replace('/([°º])[,\.]/', '${1}', $input);
Expand Down

0 comments on commit 4e4882a

Please sign in to comment.