Get latitude / longitude of friend current_location using Graph FQL

I am trying to get the latitude / longitude of all user friends using a single API call. I believe that I need to write a FQL statement with several queries, but I cannot get the syntax correctly.

I believe the two queries should be something like this:

'"friends":"SELECT uid,current_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())"'

'"location":"SELECT location FROM page WHERE id IN (SELECT current_location_id FROM #friends)"';

My problem is that I somehow need to get the current_location identifier in the first request so that I can refer to it in the second request, but I only know how to get the array containing the identifier.

Thanks for any help!

Clarification:

I am not trying to get friends to register. Instead, I want to draw "current_location" (ie, Where they live) of all the user's friends on the Geo map. I can get the "current_location" of the user with the following FQL query:

"SELECT uid,sex,current_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())"

:

[current_location] => Array
            (
                [city] => New York
                [state] => New York
                [country] => United States
                [zip] => 
                [id] => 108424279189115
                [name] => New York, New York
            )

_ (- )

_ (, 108424279189115) FQL, :

"SELECT location,name FROM page WHERE page_id = 108424279189115)"

_. , FQL, page_id php, FQL, / current_location. , , , .

+5
3

Edit:

, :

'"location":"SELECT location FROM page WHERE id IN (SELECT current_location.id FROM #friends)"';

FB API , array.value

, , , , , , , current_location.id


fql.multiquery, , : Facebook Graph API

FQL : http://developers.facebook.com/docs/reference/fql/

lat/long checkin? , : http://developers.facebook.com/docs/reference/fql/checkin/

Edit:

, , , . api , , lat/long , , , , ... , current_location_id , , . , , .

, PHP FQL ( , , ):

try{
    $multiQuery = "{
        'query1':'SELECT coords, tagged_uids, page_id FROM checkin WHERE author_uid IN (SELECT uid2 FROM friend WHERE uid1 = me())',
        'query2':'SELECT name, description FROM page WHERE page_id IN (SELECT page_id FROM #query1)'
    }";

    $param = array(       
         'method' => 'fql.multiquery',       
         'queries' => $multiQuery,       
         'callback' => ''
    );       
    $queryresults = $facebook->api($param);
        print_r($queryresults);
    }
catch(Exception $o){
    print_r($o);
}
+2
fql?q=SELECT location,name FROM page WHERE page_id in (SELECT current_location.id from user where uid in(select uid2 from friend where uid1=me()))

+2
facebook.batch_fql({
    'query1': "SELECT uid, name, current_location.id FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())",
    'query2': "SELECT page_id, name, description, location FROM page WHERE page_id IN (SELECT current_location.id FROM #query1)"
})

will return two answers

there will be a list of friends UID, names and their current location identifiers

the other will be a list of unique location identifiers with their name, description and geolocation information

EDIT : if you request current_location using FQL, you will get the full latlong in the first answer, and you won't even need the second

+1
source

All Articles