Fix error if there are no points in the ACARS route
This commit is contained in:
@@ -174,7 +174,6 @@ class GeoService extends BaseService
|
||||
{
|
||||
$route_line = [];
|
||||
$route_points = [];
|
||||
#$route_line[] = [$pirep->dpt_airport->lon, $pirep->dpt_airport->lat];
|
||||
|
||||
/**
|
||||
* @var $point \App\Models\Acars
|
||||
@@ -191,12 +190,16 @@ class GeoService extends BaseService
|
||||
|
||||
++$counter;
|
||||
}
|
||||
# Arrival
|
||||
#$route_line[] = [$pirep->arr_airport->lon, $pirep->arr_airport->lat];
|
||||
$route_line = new Feature(new LineString($route_line));
|
||||
|
||||
if(\count($route_line) >= 2) {
|
||||
$route_line = new Feature(new LineString($route_line));
|
||||
$route_line = new FeatureCollection([$route_line]);
|
||||
} else {
|
||||
$route_line = new FeatureCollection([]);
|
||||
}
|
||||
|
||||
return [
|
||||
'line' => new FeatureCollection([$route_line]),
|
||||
'line' => $route_line,
|
||||
'points' => new FeatureCollection($route_points)
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user