William Sham
William Sham

Reputation: 13239

Querying Facebook's location_post table for specific region

I'm making a query to the "location_post" table through FB's FQL.

"https://developers.facebook.com/docs/reference/fql/location_post/"

I'm interesting in my friend's location post.

With the following, it throws me an error and loading for a while(possibly because there're too many results)

        SELECT id, page_id FROM location_post
        WHERE author_uid IN
        (SELECT uid2 FROM friend WHERE uid1=me())

I'm really only interested in a particular region at a time, it's not like I can read all my friends' activities around the world at a time. So, how can I use the "coords" to limit the query within a region. coords is an

         Array ( [latitude] => 37.86564 [longitude] => -122.25061 ) 

Upvotes: 0

Views: 617

Answers (1)

Karan Mangla
Karan Mangla

Reputation: 239

SELECT id, page_id FROM location_post WHERE distance(latitude, longitude, '37.86564', '-122.25061') < 10000

This will give you all posts within 10,000 meters of the location.

Upvotes: 3

Related Questions