【问题标题】:Google Places API INVALID_REQUEST with no types attribute没有类型属性的 Google Places API INVALID_REQUEST
【发布时间】:2013-05-25 11:27:16
【问题描述】:

至少这个应该很容易让您验证。这个请求返回一个INVALID_REQUEST

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=51.509980,-0.133700&sensor=true&rankby=distance&key=[api_key]

但这一个有效(完全相同,但带有types 参数):

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=51.509980,-0.133700&sensor=true&rankby=distance&key=[api_key]&types=food

在文档中它说类型不是必需的参数,所以这是他们 API 中的错误吗?

【问题讨论】:

  • 我遇到了同样的错误,因为我的位置对象有时为空。所以位置没有添加到 URL。可能会帮助某人。

标签: google-maps google-places-api


【解决方案1】:

这不是错误,而是预期的行为(我相信不一致的行为,但无论如何)。有兴趣的朋友,我的答案在这里:https://code.google.com/p/gmaps-api-issues/issues/detail?id=5456

  • 距离。此选项按结果与指定位置的距离升序排序。按距离排序结果将 设定固定搜索半径50km。关键字、名称或 类型是必需的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-02-11
    • 2011-09-26
    • 2015-11-09
    • 2013-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多