|
@@ -72,11 +72,11 @@ discard block |
|
|
block discarded – undo |
|
72
|
72
|
{ |
|
73
|
73
|
|
|
74
|
74
|
//first (major) letter is the 500km grid sq, origin at -1000000, -500000 |
|
75
|
|
- $majorEasting = strpos(self::GRID_LETTERS, $ref[0]) % 5 * 500000 - 1000000; |
|
|
75
|
+ $majorEasting = strpos(self::GRID_LETTERS, $ref[0]) % 5 * 500000 - 1000000; |
|
76
|
76
|
$majorNorthing = (floor(strpos(self::GRID_LETTERS, $ref[0]) / 5)) * 500000 - 500000; |
|
77
|
77
|
|
|
78
|
78
|
//second (minor) letter is 100km grid sq, origin at 0,0 of this square |
|
79
|
|
- $minorEasting = strpos(self::GRID_LETTERS, $ref[1]) % 5 * 100000; |
|
|
79
|
+ $minorEasting = strpos(self::GRID_LETTERS, $ref[1]) % 5 * 100000; |
|
80
|
80
|
$minorNorthing = (floor(strpos(self::GRID_LETTERS, $ref[1]) / 5)) * 100000; |
|
81
|
81
|
|
|
82
|
82
|
$easting = $majorEasting + $minorEasting + (substr($ref, 2, 3) * 100); |
|
@@ -102,13 +102,13 @@ discard block |
|
|
block discarded – undo |
|
102
|
102
|
$adjustedY = $this->y + 500000; |
|
103
|
103
|
$majorSquaresEast = floor($adjustedX / 500000); |
|
104
|
104
|
$majorSquaresNorth = floor($adjustedY / 500000); |
|
105
|
|
- $majorLetterIndex = (int)(5 * $majorSquaresNorth + $majorSquaresEast); |
|
|
105
|
+ $majorLetterIndex = (int) (5 * $majorSquaresNorth + $majorSquaresEast); |
|
106
|
106
|
$majorLetter = self::GRID_LETTERS[$majorLetterIndex]; |
|
107
|
107
|
|
|
108
|
108
|
//second (minor) letter is 100km grid sq, origin at 0,0 of this square |
|
109
|
109
|
$minorSquaresEast = $easting[0] % 5; |
|
110
|
110
|
$minorSquaresNorth = $northing[0] % 5; |
|
111
|
|
- $minorLetterIndex = (int)(5 * $minorSquaresNorth + $minorSquaresEast); |
|
|
111
|
+ $minorLetterIndex = (int) (5 * $minorSquaresNorth + $minorSquaresEast); |
|
112
|
112
|
$minorLetter = self::GRID_LETTERS[$minorLetterIndex]; |
|
113
|
113
|
|
|
114
|
114
|
return $majorLetter . $minorLetter . substr($easting, 1, 3) . substr($northing, 1, 3); |