如何使用API​​获取Google地图查询结果?

我不能为我的生活弄清楚如何得到一个简单的谷歌地图查询与API的工作。 我想要做的就是获得丹佛附近食品库的JSON。 到目前为止我有:

var gm_api_key = "apikeyhere"; // return locations for foodbanks in denver var denver_lat_long = '39.7392,-104.9903'; var loc = denver_lat_long; var query_str_foodbank = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?query=food+bank&location=' + loc + '&radius=500&key=' + gm_api_key; // return locations for thrift shops (eg goodwill) in denver // nodejs implementation var resp = ""; var request = require('request'); var req = request(query_str_foodbank, function (error, response, body) { if (!error && response.statusCode == 200) { resp = body; //console.log(body); // Show the HTML for the Google homepage. } }); var food_bank_json = JSON.parse(resp); 

它只是返回一堆不相干的东西,如“邮局”等。它似乎并没有实际使用query

好吧,所以问题是双重的:一, keywordname arg是在这里使用的正确的,而不是我期望使用的query 。 二, radius参数以米为单位,所以在100英里左右需要150000.正确的页面调用应该是:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?&keyword=food+bank&location=39.7392,-104.9903&radius=150000&key=apikeyhere