位置(纬度长)使用Facebook的API [英] location (lat long) using facebook api

查看:139
本文介绍了位置(纬度长)使用Facebook的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以使用facebook api获取用户的位置(经度和纬度格式)?
我可以得到位置名称和其他属性,但不是该地点的经纬度。如果您有用户的基本信息,其中一个字段是位置

/ p>

 location:{
id:104146386288393,
name:Newton ,马萨诸塞州

您可以使用位置ID来进行另一个查询返回包含城市纬度/经度的JSON,例如

  {
id:104146386288393,
name:Newton,Massachusetts ,
picture:http://external.ak.fbcdn.net/safe_image.php?d=AQDygUYzFOcjhDoD&w=100&h=300&url=http\\\%3A\\\%2F\\\%2Fupload .wikimedia.org\\\%2Fwikipedia\\\%2Fen\\\%2Fe\\\%2Fe6\\\%2FNewton_City_Hall\\\%252C_Massachusetts.jpg& fallback = hub_city& prefix = s,
link:http://www.facebook .com / pages / Newton-Massachusetts / 104146386288393,
likes:3741,
category:City,
is_published:true,
is_community_page :true,
description:<剪切数据>,
location:{
latitude:42.3369,
longitude:-71.2097
},
checkins:310,
talking_about_count:8912
}

但当然这只是接近 - 您需要请求用户的地址,我想更接近。


Is there a way to get the location of a user in (latitude and longitude format) using facebook api?? I am able to get the location name and other attributes but not the lat long of the place. Is there any API for the same in javascript.

解决方案

If you have the user's basic info, one of the fields is location

   "location": {
     "id": "104146386288393", 
     "name": "Newton, Massachusetts"
   }, 

You can make another query using the id of the location to return JSON containing lat/lon of the city, e.g.

{
  "id": "104146386288393", 
  "name": "Newton, Massachusetts", 
  "picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQDygUYzFOcjhDoD&w=100&h=300&url=http\u00253A\u00252F\u00252Fupload.wikimedia.org\u00252Fwikipedia\u00252Fen\u00252Fe\u00252Fe6\u00252FNewton_City_Hall\u0025252C_Massachusetts.jpg&fallback=hub_city&prefix=s", 
  "link": "http://www.facebook.com/pages/Newton-Massachusetts/104146386288393", 
  "likes": 3741, 
  "category": "City", 
  "is_published": true, 
  "is_community_page": true, 
  "description": "<snipped data>", 
  "location": {
    "latitude": 42.3369, 
    "longitude": -71.2097
  }, 
  "checkins": 310, 
  "talking_about_count": 8912
}

But of course that's only "close" -- you would need to request the user's address, I guess to get closer.

这篇关于位置(纬度长)使用Facebook的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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