Location (lat long) using facebook api

Is there any way to get user location in latitude and longitude format using facebook api ?? I can get the name of the location and other attributes, but not the length of the Latin place. Is there an API for the same in javascript.

+4
source share
1 answer

If you have basic user information, one of the fields is the location

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

You can make another request using the location identifier to return a JSON containing the lat / lon of the city, for example.

 { "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, only β€œclose” - you will need to request the user's address, I think, to get closer.

+3
source

Source: https://habr.com/ru/post/1385298/


All Articles