static function cprN($lat, $isodd) { $nl = SBS::cprNL($lat) - $isodd; if ($nl > 1) { return $nl; } else { return 1; } }
if ($latlon[$icao]['created'] > time()) { $ni = SBS::cprN($lat_even, 0); $m = floor($cprlon_even * (SBS::cprNL($lat_even) - 1) - $cprlon_odd * SBS::cprNL($lat_even) + 0.5); $lon = 360.0 / $ni * ($m % $ni + $cprlon_even); $lat = $lat_even; if ($lon > 180) { $lon = $lon - 360; } if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon; $data['latitude'] = $lat; $data['longitude'] = $lon; } } else { $ni = SBS::cprN($lat_odd, 1); $m = floor($cprlon_even * (SBS::cprNL($lat_odd) - 1) - $cprlon_odd * SBS::cprNL($lat_odd) + 0.5); $lon = 360.0 / $ni * ($m % $ni + $cprlon_odd); $lat = $lat_odd; if ($lon > 180) { $lon = $lon - 360; } if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n"; $data['latitude'] = $lat; $data['longitude'] = $lon; } } } unset($latlon[$icao]); } } elseif ($tc == 19) {