使用Graph FQL获取朋友当前位置的纬度/经度 [英] Get latitude/longitude of friend's current_location using Graph FQL

查看:149
本文介绍了使用Graph FQL获取朋友当前位置的纬度/经度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用单一的API调用获得所有用户的朋友的纬度/经度。我相信我需要写一个多查询FQL语句,但是我无法得到正确的语法。

I'm trying to get the latitude/longitude of all of a user's friends using a single API call. I believe I need to write a multi-query FQL statement, but I can't get the syntax correct.

我相信这两个查询需要像下面这样:

I believe the two queries need to be something like the following:

'"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)"';

我的问题是,我需要在第一个查询中获取current_location的ID,以便我可以在第二个查询中引用它,但我只知道如何获取一个包含id的数组。

My problem is that somehow I need to get the ID of the current_location in the first query so that I can reference it in the second query, but I only know how to get an array that contains the id.

感谢任何帮助!

澄清:

我不想得到朋友的签到。相反,我想在Geo地图上绘制所有用户的朋友的current_location(即他们住在哪里)。我可以使用以下FQL查询获取用户的current_location:

I'm not trying to get check-ins of friends. Instead I want to graph the "current_location" (i.e. where they live) of all of a user's friends on a Geo map. I can get a user's "current_location" with the following FQL query:

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

此查询返回以下数组: / p>

This query returns the following array:

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

其中不包含current_location的经度和纬度(上例中的纽约)

Which does not contain the longitude and latitude of the of the current_location (New York in the above example)

所以我现在需要使用current_location的ID(例如108424279189115)并运行第二个FQL查询,例如:

Therefore I now need to take the ID of the current_location (e.g. 108424279189115) and run a second FQL query such as:

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

获取current_location的纬度和经度。目前,我有一个运行第一个FQL查询的工作代码,然后在php中提取page_id,然后运行第二个FQL查询以获取current_location纬度/经度。但是,出于性能原因,如果可能,我想运行一个多查询。

To get the latitude and longitude of the current_location. Currently, I have a working code that runs the first FQL query, then extracts page_id in php, and then runs a second FQL query to get the current_location latitude/longitude. However, for performance reasons I would like to run only one multi-query if this is possible.

推荐答案

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()))

这将为您的魔法

这篇关于使用Graph FQL获取朋友当前位置的纬度/经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆