@@ 105-107 (lines=3) @@ | ||
102 | // "N52° 12.345′ E13° 23.456′" |
|
103 | if (preg_match('/([NS]?\s*)(\d{1,2})°?\s+(\d{1,2}\.?\d*)[\'′]?(\s*[NS]?)[, ]\s*([EW]?\s*)(\d{1,3})°?\s+(\d{1,2}\.?\d*)[\'′]?(\s*[EW]?)/ui', $string, $match)) { |
|
104 | $latitude = $match[2] + $match[3] / 60; |
|
105 | if (strtoupper(trim($match[1])) === 'S' || strtoupper(trim($match[4])) === 'S') { |
|
106 | $latitude = - $latitude; |
|
107 | } |
|
108 | $longitude = $match[6] + $match[7] / 60; |
|
109 | if (strtoupper(trim($match[5])) === 'W' || strtoupper(trim($match[8])) === 'W') { |
|
110 | $longitude = - $longitude; |
|
@@ 150-152 (lines=3) @@ | ||
147 | // "40.2S, 135.3485W", or "56.234°N, 157.245°W" |
|
148 | if (preg_match('/([NS]?\s*)(\d{1,2}\.?\d*)°?(\s*[NS]?)[, ]\s*([EW]?\s*)(\d{1,3}\.?\d*)°?(\s*[EW]?)/ui', $string, $match)) { |
|
149 | $latitude = $match[2]; |
|
150 | if (strtoupper(trim($match[1])) === 'S' || strtoupper(trim($match[3])) === 'S') { |
|
151 | $latitude = - $latitude; |
|
152 | } |
|
153 | $longitude = $match[5]; |
|
154 | if (strtoupper(trim($match[4])) === 'W' || strtoupper(trim($match[6])) === 'W') { |
|
155 | $longitude = - $longitude; |