dpt_airport->lon, $model->dpt_airport->lat], [$model->arr_airport->lon, $model->arr_airport->lat], ]); // TODO: Add markers for the start/end airports // TODO: Read from the ACARS data table $feature = new Feature($line, [], 1); $features = new FeatureCollection([$feature]); return [ 'features' => $features, //'center' => $center, ]; } /** * Determine the center point between two sets of coordinates * @param $latA * @param $lonA * @param $latB * @param $lonB * @return array * @throws \League\Geotools\Exception\InvalidArgumentException */ public function getCenter($latA, $lonA, $latB, $lonB) { $geotools = new Geotools(); $coordA = new Coordinate([$latA, $lonA]); $coordB = new Coordinate([$latB, $lonB]); $vertex = $geotools->vertex()->setFrom($coordA)->setTo($coordB); $middlePoint = $vertex->middle(); $center = [ $middlePoint->getLatitude(), $middlePoint->getLongitude() ]; return $center; } }