我正在尝试使用Foursquare和Google API接收我当前的位置,并从那里显示一系列场地,例如。特定半径的餐馆,并在地图上用自定义标记绘制每个餐馆。
我已经能够使用谷歌api显示我当前的位置,但我从未使用过Foursquare API,看起来有点棘手,任何帮助都会受到赞赏。
答案 0 :(得分:1)
您需要使用venues/search或venues/explore端点搜索该位置。
作为使用搜索的示例,此JQuery getJSON调用将调用搜索端点,在指定地点100米范围内的“夜间点”类别中查找场地:
var ll = latitude + "," + longitude;
$.getJSON("https://api.foursquare.com/v2/venues/search", {
ll: ll,
radius: 100,
limit: 50
intent: "browse",
categoryId: "4d4b7105d754a06376d81259",
client_id: foursq_client_id,
client_secret: foursq_client_secret,
v: 20130420
}).done(function(data) {
$.each(data.response.venues, function(i, item) {
console.log(item);
});
});