我正在尝试通过google-maps-places API查找特定的列表,但没有得到任何结果。这对我来说很奇怪,因为这里有一个Google+页面和一个谷歌地图条目。
让我们来看看这些链接:
Google+:https://plus.google.com/115673722468988785755/about
如果我在附近的搜索中使用maps条目中的完全相同的坐标,并使用条目中的名称作为关键字(或者说位置),则结果为空。
Places-API (坐标完全相同):https://maps.googleapis.com/maps/api/place/nearbysearch/json?sensor=false&radius=2000&name=amway&location=53.171976,9.465828&language=de-DE&key=YOURKEY
当然,我可以想象Google+ POI的数据库是一个不同的数据库。但话又说回来,我不明白为什么地图api找不到我可以在地图web应用程序上找到的东西。
非常感谢您的帮助!
发布于 2015-05-14 02:29:43
尝试如下所示:
map.places.nearbySearch({
location: latLng,
rankBy: google.maps.places.RankBy.DISTANCE,
types: ['shop'], // optional
name: "AMWAY Beratung & Vertrieb Haegebarth" // optional
},function(results, status){
if (status == google.maps.places.PlacesServiceStatus.OK) {
// The thing you need should be result[0]
// console.log(results[0]);
if (results[0].name == "AMWAY Beratung & Vertrieb Haegebarth") { // optionally check the type
// You have your place :)
}
}
}这是一个多么好的变通办法!有传言称,Google Maps JS API v3.20或更高版本将允许我们在POI上触发点击事件,从而直接获取Place对象。
https://stackoverflow.com/questions/24784850
复制相似问题