Index: branches/Maps0.7.x/RELEASE-NOTES |
— | — | @@ -14,6 +14,8 @@ |
15 | 15 | |
16 | 16 | * Fixed bug in OpenLayers layer dependency loading code. |
17 | 17 | |
| 18 | +* Fixed DMS coordinate parsing issue (bug 29419). |
| 19 | + |
18 | 20 | * Removed dead code (initial code to support the RL, now used in SM 1.0 and later). |
19 | 21 | |
20 | 22 | * Use of Google Maps geocoding service v3 instead of v2. |
Index: branches/Maps0.7.x/includes/Maps_CoordinateParser.php |
— | — | @@ -524,17 +524,28 @@ |
525 | 525 | if ( $isNegative ) $coordinate = substr( $coordinate, 1 ); |
526 | 526 | |
527 | 527 | $degreePosition = strpos( $coordinate, self::SYMBOL_DEG ); |
| 528 | + $degrees = substr ( $coordinate, 0, $degreePosition ); |
| 529 | + |
528 | 530 | $minutePosition = strpos( $coordinate, self::SYMBOL_MIN ); |
529 | | - $secondPosition = strpos( $coordinate, self::SYMBOL_SEC ); |
530 | 531 | |
531 | | - $degSignLength = strlen( self::SYMBOL_DEG ); |
| 532 | + if ( $minutePosition === false ) { |
| 533 | + $minutes = 0; |
| 534 | + } |
| 535 | + else { |
| 536 | + $degSignLength = strlen( self::SYMBOL_DEG ); |
| 537 | + $minuteLength = $minutePosition - $degreePosition - $degSignLength; |
| 538 | + $minutes = substr ( $coordinate, $degreePosition + $degSignLength, $minuteLength ); |
| 539 | + } |
532 | 540 | |
533 | | - $minuteLength = $minutePosition - $degreePosition - $degSignLength; |
534 | | - $secondLength = $secondPosition - $minutePosition - 1; |
| 541 | + $secondPosition = strpos( $coordinate, self::SYMBOL_SEC ); |
535 | 542 | |
536 | | - $degrees = substr ( $coordinate, 0, $degreePosition ); |
537 | | - $minutes = substr ( $coordinate, $degreePosition + $degSignLength, $minuteLength ); |
538 | | - $seconds = substr ( $coordinate, $minutePosition + 1, $secondLength ); |
| 543 | + if ( $minutePosition === false ) { |
| 544 | + $seconds = 0; |
| 545 | + } |
| 546 | + else { |
| 547 | + $secondLength = $secondPosition - $minutePosition - 1; |
| 548 | + $seconds = substr ( $coordinate, $minutePosition + 1, $secondLength ); |
| 549 | + } |
539 | 550 | |
540 | 551 | $coordinate = $degrees + ( $minutes + $seconds / 60 ) / 60; |
541 | 552 | if ( $isNegative ) $coordinate *= -1; |