位置情報ツイートは2タイプ。

  • 緯度・経度 (lat, long パラメータ)
  • Twitterが管理する場所データベースのエントリ (place_id パラメータ)

緯度・経度

lat パラメータに緯度、long パラメータに経度を指定する。


http://api.twitter.com/1/statuses/update.json?status=hello&lat=37.76893497&long=-122.42284884

のようにすれば緯度経度による位置情報付きのツイートができる (実際には HTTP GET ではなく HTTP POST で)。

Twitterが管理する場所データベースのエントリ


https://api.twitter.com/1/geo/reverse_geocode.json?lat=37.76893497&long=-122.42284884

にて result/places/id を取得して


http://api.twitter.com/1/statuses/update.json?status=hello&place_id=2b6ff8c22edd9576

のようにしてツイートするときに place_id にセットする (実際には HTTP GET ではなく HTTP POST で)。

参考資料

tags: twitter

Posted by NI-Lab. (@nilab)