diff --git a/app/Support/Metar.php b/app/Support/Metar.php index 1e9ffaac..6fdb9087 100644 --- a/app/Support/Metar.php +++ b/app/Support/Metar.php @@ -8,6 +8,7 @@ use App\Support\Units\Pressure; use App\Support\Units\Temperature; use App\Support\Units\Velocity; use function count; +use Illuminate\Support\Facades\Log; use PhpUnitsOfMeasure\Exception\NonNumericValue; use PhpUnitsOfMeasure\Exception\NonStringUnitName; @@ -341,6 +342,7 @@ class Metar implements \ArrayAccess public function __construct($raw, $taf = false, $debug = false, $icao = true) { $this->debug_enabled = $debug; + // Log::info('Parsing metar="'.$raw.'"'); $raw_lines = explode("\n", $raw, 2); if (isset($raw_lines[1])) { @@ -408,7 +410,7 @@ class Metar implements \ArrayAccess */ protected function createAltitude($value, $unit) { - return new Altitude($value, $unit); + return new Altitude((float) $value, $unit); } /** @@ -424,7 +426,7 @@ class Metar implements \ArrayAccess */ protected function createDistance($value, $unit) { - return new Distance($value, $unit); + return new Distance((float) $value, $unit); } /** @@ -440,7 +442,7 @@ class Metar implements \ArrayAccess */ protected function createPressure($value, $unit) { - return new Pressure($value, $unit); + return new Pressure((float) $value, $unit); } /** @@ -456,7 +458,7 @@ class Metar implements \ArrayAccess */ protected function createTemperature($value, $unit) { - return new Temperature($value, $unit); + return new Temperature((float) $value, $unit); } /** @@ -472,7 +474,7 @@ class Metar implements \ArrayAccess */ protected function createVelocity($value, $unit) { - return new Velocity($value, $unit); + return new Velocity((float) $value, $unit); } /** @@ -1118,6 +1120,7 @@ class Metar implements \ArrayAccess $report = implode(' ', $report); $report_ft = implode(' ', $report_ft); + $observed['report'] = $this->createAltitude($report_ft, 'ft'); $observed['report'] = ucfirst($report); $observed['report_ft'] = ucfirst($report_ft); diff --git a/resources/views/layouts/default/widgets/weather.blade.php b/resources/views/layouts/default/widgets/weather.blade.php index 3da30262..5ef12fa9 100644 --- a/resources/views/layouts/default/widgets/weather.blade.php +++ b/resources/views/layouts/default/widgets/weather.blade.php @@ -30,8 +30,8 @@ https://api.checkwx.com/#metar-decoded