Weird Data Coming From Search


#1

Hi,

When using the Search Operation to find flights in a Lat/Lon box, the flights that are returned are not inside that box. I am using the


-latlong "MINLAT MINLON MAXLAT MAXLON"

Here is the PHP/Soap code that I am using:


<?php

$options = array(
                 'trace' => true,
                 'exceptions' => 0,
                 'login' => 'XXX',
                 'password' => 'XXX',
                 );
$client = new SoapClient('http://flightxml.flightaware.com/soap/FlightXML2/wsdl', $options);

$query = "-latlon 36.897669 -79.03655 40.897669 -75.03655";
$result = $client->Search($query);
print_r($result);

?>

Here is one of the returned aircraft:


[faFlightID] => AAL1974-1343453138-airline-0306
                            [ident] => AAL1974
                            [prefix] => 
                            [type] => B738
                            [suffix] => Q
                            [origin] => KLAX
                            [destination] => KBNA
                            [timeout] => ok
                            [timestamp] => 1343680642
                            [departureTime] => 1343673540
                            [firstPositionTime] => 1343673600
                            [arrivalTime] => 0
                            [longitude] => -102.431999207
                            [latitude] => 38.188999176
                            [lowLongitude] => -118.599441528
                            [lowLatitude] => 33.8277778625
                            [highLongitude] => -102.431999207
                            [highLatitude] => 38.426109314
                            [groundspeed] => 473
                            [altitude] => 350
                            [heading] => 95
                            [altitudeStatus] => 
                            [updateType] => TA
                            [altitudeChange] => 

The Longitude is -102.431999207, which is not in my search box

When I switch it to find flights with an origin of KMIA/Miami, FL:


<?php

$options = array(
                 'trace' => true,
                 'exceptions' => 0,
                 'login' => 'XXX',
                 'password' => 'XXX',
                 );
$client = new SoapClient('http://flightxml.flightaware.com/soap/FlightXML2/wsdl', $options);

$query = "-origin KMIA";
$result = $client->Search($query);
print_r($result);


?>

I get:


[faFlightID] => DAL82-1343453196-airline-0268
                            [ident] => DAL82
                            [prefix] => 
                            [type] => B752
                            [suffix] => Q
                            [origin] => KLAX
                            [destination] => KJFK
                            [timeout] => ok
                            [timestamp] => 1343680942
                            [departureTime] => 1343664901
                            [firstPositionTime] => 1343664901
                            [arrivalTime] => 0
                            [longitude] => -74.1166000366
                            [latitude] => 40.904800415
                            [lowLongitude] => -118.57611084
                            [lowLatitude] => 33.8294448853
                            [highLongitude] => -74.1166000366
                            [highLatitude] => 42.6163902283
                            [groundspeed] => 356
                            [altitude] => 190
                            [heading] => 115
                            [altitudeStatus] => 
                            [updateType] => TA
                            [altitudeChange] => 

No other flights have KMIA as the origin.

Am I doing something wrong?

Thanks :smiley:


#2

I believe the coordinates to -latlon have to be quoted together like this:



$query = "-latlon \"36.897669 -79.03655 40.897669 -75.03655\"";




#3

Hi, Thanks for your response. When I ran the code with the extra quotes, I still get aircraft that were not in the Lat./Lon. box.

Here is one of the aircraft:


[faFlightID] => DLH573-1343453235-airline-0247
                            [ident] => DLH573
                            [prefix] => 
                            [type] => A388
                            [suffix] => 
                            [origin] => FAJS
                            [destination] => EDDF
                            [timeout] => ok
                            [timestamp] => 1343697030
                            [departureTime] => 1343668529
                            [firstPositionTime] => 1343668529
                            [arrivalTime] => 0
                            [longitude] => 14.406999588
                            [latitude] => 35.4469985962
                            [lowLongitude] => 14.406999588
                            [lowLatitude] => -26.1159992218
                            [highLongitude] => 28.2439994812
                            [highLatitude] => 35.4469985962
                            [groundspeed] => 455
                            [altitude] => 400
                            [heading] => 348
                            [altitudeStatus] => 
                            [updateType] => TA
                            [altitudeChange] => 
                            [waypoints] => 

Lon: 14.406999588
Lat: 35.4469985962

Is there another bug in my code?

Thanks :slight_smile:


#4

I think there is some error in how the PHP SOAP library is forming the request. I’ll continue to run some tests on it and maybe do some server-side workaround later… In theory, this should be correct, but it doesn’t work:



$query = array("query" => "-latlon \"36.897669 -79.03655 40.897669 -75.03655\"", "howMany" => 15, "offset" => 0);
$result = $client->Search($query);


However, as a workaround you can use SearchBirdseyeInFlight, which does seem to be working properly:



$query = array("query" => "{range lat 36.897669 40.897669} {range lon -79.03655 -75.03655}", "howMany" => 15, "offset" => 0);
$result = $client->SearchBirdseyeInFlight($query);


You might also be interested in trying the same query with SearchBirdseyePositions, which will let you detect if any position of a flight enters your lat/lon window and not just the most recent position:



$query = array("query" => "{range lat 36.897669 40.897669} {range lon -79.03655 -75.03655}", "howMany" => 15, "offset" => 0, "uniqueFlights" => 1);
$result = $client-> SearchBirdseyePositions($query);