|
@@ 86-88 (lines=3) @@
|
| 83 |
|
// "N52° 12.345′ E13° 23.456′" |
| 84 |
|
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)) { |
| 85 |
|
$latitude = $match[2] + $match[3] / 60; |
| 86 |
|
if (trim(strtoupper($match[1])) === 'S' || trim(strtoupper($match[4])) === 'S') { |
| 87 |
|
$latitude = - $latitude; |
| 88 |
|
} |
| 89 |
|
$longitude = $match[6] + $match[7] / 60; |
| 90 |
|
if (trim(strtoupper($match[5])) === 'W' || trim(strtoupper($match[8])) === 'W') { |
| 91 |
|
$longitude = - $longitude; |
|
@@ 117-119 (lines=3) @@
|
| 114 |
|
// "40.2S, 135.3485W", or "56.234°N, 157.245°W" |
| 115 |
|
if (preg_match('/([NS]?\s*)(\d{1,2}\.?\d*)°?(\s*[NS]?)[, ]\s*([EW]?\s*)(\d{1,3}\.?\d*)°?(\s*[EW]?)/ui', $string, $match)) { |
| 116 |
|
$latitude = $match[2]; |
| 117 |
|
if (trim(strtoupper($match[1])) === 'S' || trim(strtoupper($match[3])) === 'S') { |
| 118 |
|
$latitude = - $latitude; |
| 119 |
|
} |
| 120 |
|
$longitude = $match[5]; |
| 121 |
|
if (trim(strtoupper($match[4])) === 'W' || trim(strtoupper($match[6])) === 'W') { |
| 122 |
|
$longitude = - $longitude; |