如何使用Google Places API获取城市图片?

时间:2016-05-04 20:46:03

标签: android google-places-api

在Android和Swift中通过Google Places API获取着名景点和景点的图像非常容易。 但是不可能从整个城市获得图像。

例如:
当使用Google Place ID(例如Brandenburger Gate,地点ID为“ChIJiQnyVcZRqEcRY0xnhE77uyY”)时,Google Places API会返回一张图片。 但是,当使用某个城市的Google Place ID(例如纽约,地点ID为“ChIJOwg_06VPwokRYv534QaPC8g”)时,Google Places Api不会返回任何图片。

有人知道从城市获取图像是否可行吗?什么时候,如何使用Java(Android)实现这一目标?

更新:此问题不再存在,看起来谷歌在这里做了一些更改。现在Place API也会返回城市的图像。

1 个答案:

答案 0 :(得分:0)

首先使用此网址https://developers.google.com/places/place-id

查找特定地点的ID

然后在获取id之后使用Place details url查找该地点的详细信息。 https://developers.google.com/places/web-service/details