2

Need to post status update and attach user location by passing latitude and longitude. In FB docs they say, we need to pass "place" FB entity that is:

"an object containing id and name of Page associated with this location, and a location field containing geographic information such as latitude, longitude, country, and other fields (fields will vary based on geography and availability of information)"

How to create/get such place name from latitude and longitude? I'v read related post1 and post2 but was not able to find a working solution.

Community
  • 1
  • 1
Centurion
  • 14,106
  • 31
  • 105
  • 197

2 Answers2

4

How to create/get such place name from latitude and longitude?

There is currently no API available for developers to create Facebook pages or places. However, you can get place name by doing a FQL query like this...

'SELECT page_id,name,latitude,longitude FROM place WHERE distance(latitude, longitude, "LAT_HERE", "LON_HERE") < 250`

250 refers to the radius(m) that it will search within, it can go up to 50000.

Doing this FQL query will return you the Facebook Place Page's id, place name, latitude and longitude.

(Actually there is no need to get the place name as the page_id is what you really need. With page_id, you will be able to get all the information of that Facebook Place Page.)

Need to post status update and attach user location by passing latitude and longitude.

Assuming you are actually trying to publish a checkin, you can refer to the references below to proceed further with the data you have obtained from the FQL query...

A normal status update(feed dialog) is different from a status update with location tagged to it(checkins), they are using different APIs.

References:

How to get place_id before checkin?

Facebook - Publish Checkins using PHP SDK/JavaScript SDK

Facebook Documentations

Page FQL - http://developers.facebook.com/docs/reference/fql/page/

Checkins API - http://developers.facebook.com/docs/reference/api/user/#checkins

Community
  • 1
  • 1
Mysophobe
  • 622
  • 2
  • 10
  • 33
1


If you have the lat/long data, you can search for the place and get the place-id which can be included in the POST message.
Please check these related posts -
https://developers.facebook.com/docs/opengraph/actions/#taggingplaces
https://developers.facebook.com/blog/post/2012/03/07/building-better-stories-with-location-and-friends/

deesarus
  • 1,202
  • 8
  • 10