【问题标题】:Google Places API: How to go from address to "good" place_id?Google Places API:如何从地址转到“好”place_id?
【发布时间】:2018-07-14 12:31:46
【问题描述】:

在 google places api 网站上,他们有一个示例查询返回大量详细信息:

网站: https://developers.google.com/places/web-service/details

查询: https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4&key=My-API-Key

Place_id 似乎是这里的关键。所以我试图对这个例子进行逆向工程,从人类实际拥有的信息开始,最终得到这个 place_id。

示例中的地址: 48 Pirrama Rd, Pyrmont NSW 2009, 澳大利亚

从地址进行 API 查询: https://maps.googleapis.com/maps/api/place/textsearch/json?query=48+Pirrama+Rd,+Pyrmont+NSW+2009,+Australia&key=My_API_Key

结果包含不同的 place_id: ChIJ8UadyjeuEmsRDt5QbiDg720

并且带有该 place_id 的地点详细信息比原始示例差得多: https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ8UadyjeuEmsRDt5QbiDg720&key=My-API-Key

那么我在这里错过了什么?我如何从human-place 信息开始,并获得包含大量地点详细信息的place_id?

编辑:为什么反对票?我是否试图做一些不允许的事情?

谢谢, sff

【问题讨论】:

    标签: google-maps-api-3 google-places-api


    【解决方案1】:

    我认为您的文本搜索返回 the office building,而您的第一次搜索返回 Google office within the office building。您可以通过adding the name of the company and removing some of the search terms 修复您的文本搜索。

    我不知道为什么只是在搜索词中添加“google”并不能返回您想要的结果。

    【讨论】:

    • 虽然此链接可能会回答问题,但 Stack Overflow 不鼓励仅链接的答案,您可以通过获取链接的重要部分并将其放入您的答案来改进此答案,这样可以确保您的答案是如果链接被更改或删除,仍然是一个答案:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多