【发布时间】:2016-07-13 17:18:44
【问题描述】:
我正在做一个双语项目,并开始使用 Google Places API Webservices。我开始使用Place Autocomplete API,效果很好。
我可以在fr 和en 中进行此查询,并会得到不同的描述结果:
https://maps.googleapis.com/maps/api/place/autocomplete/json?key=
<insert_key_here>&types=geocode&language=<insert_language_here>&input=144
英文结果:
"description": "14458 Gouin Boulevard West, QC, Canada",
"id": "33dcffeeb88b48fa5c1d0ec4e6e54469d05f5d1e",
"place_id": "ChIJk0pAHBM7yUwRt0WIxWRe1ic",
法文结果:
"description": "14458 Boulevard Gouin Ouest, QC, Canada",
"id": "33dcffeeb88b48fa5c1d0ec4e6e54469d05f5d1e",
"place_id": "ChIJk0pAHBM7yUwRt0WIxWRe1ic",
ID 完全相同,但文本已本地化,这是预期的结果。现在,当我尝试使用Place Details API 获得相同的结果时,语言参数似乎没有任何影响。我知道文档中提到了results should be returned, if possible.,但鉴于我知道这是可能的,这种行为是设计使然还是某种错误?
这是一个使用前面示例 place_id 的英文详细信息查询示例,它以法语返回结果:
https://maps.googleapis.com/maps/api/place/details/json?key=
<insert_key_here>&placeid=ChIJk0pAHBM7yUwRt0WIxWRe1ic&language=en
"long_name": "Boulevard Gouin Ouest",
【问题讨论】:
-
请参阅stackoverflow.com/questions/33520686/… ─ 虽然可能并不完全重复,但 Places Details 在地址格式和语言选择方面非常类似于 Geocoding API。
标签: google-maps google-places-api