|
@@ 98-100 (lines=3) @@
|
| 95 |
|
// "N52° 12.345′ E13° 23.456′" |
| 96 |
|
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)) { |
| 97 |
|
$latitude = $match[2] + $match[3] / 60; |
| 98 |
|
if (trim(strtoupper($match[1])) === 'S' || trim(strtoupper($match[4])) === 'S') { |
| 99 |
|
$latitude = - $latitude; |
| 100 |
|
} |
| 101 |
|
$longitude = $match[6] + $match[7] / 60; |
| 102 |
|
if (trim(strtoupper($match[5])) === 'W' || trim(strtoupper($match[8])) === 'W') { |
| 103 |
|
$longitude = - $longitude; |
|
@@ 141-143 (lines=3) @@
|
| 138 |
|
// "40.2S, 135.3485W", or "56.234°N, 157.245°W" |
| 139 |
|
if (preg_match('/([NS]?\s*)(\d{1,2}\.?\d*)°?(\s*[NS]?)[, ]\s*([EW]?\s*)(\d{1,3}\.?\d*)°?(\s*[EW]?)/ui', $string, $match)) { |
| 140 |
|
$latitude = $match[2]; |
| 141 |
|
if (trim(strtoupper($match[1])) === 'S' || trim(strtoupper($match[3])) === 'S') { |
| 142 |
|
$latitude = - $latitude; |
| 143 |
|
} |
| 144 |
|
$longitude = $match[5]; |
| 145 |
|
if (trim(strtoupper($match[4])) === 'W' || trim(strtoupper($match[6])) === 'W') { |
| 146 |
|
$longitude = - $longitude; |