这是一个我认为应该产生与参考点非常接近的同名酒店的查询。
如您所见,该位置是 56.1995,-4.746。这是英国的一个地方。查询是否为名为 Arrochar 的酒店。酒店确实存在。结果如下所示:
{
"html_attributions" : [],
"results" : [
{
"formatted_address" : "Arrochar, Staten Island, NY, USA",
"geometry" : {
"location" : {
"lat" : 40.59234250,
"lng" : -74.07407289999999
},
"viewport" : {
"northeast" : {
"lat" : 40.60012790,
"lng" : -74.05918419999999
},
"southwest" : {
"lat" : 40.5779020,
"lng" : -74.08570610
}
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "c7d9f74dca8676759bfe7ea168b8547cd6de3c5e",
"name" : "Arrochar",
"reference" : "CpQBiAAAAKYklx4_uV5ovlJP-x-fGr2VAqzhUCRQ2icNBXj2b5TkGZMqix3tL4xyTizwa0_UdZ5VDbI3psEagu0tTiFc2N6Awn2OJE4Oc3NXtXyaUlADLhJKwnZSuMFLFv85ia3AKiR9fFVWH96u6lEcC16foKMyFREY_KR6Z97QdShfiJCPYNlYZye49gsdU0UsIx3YbxIQa5LUZiMGZvW8sQHn_Cog-hoUr4bMXlYdo9Xae82ZRL-BEDSKRAw",
"types" : [ "neighborhood", "political" ]
}
],
"status" : "OK"
}
正如人们所看到的,这个地方在美国,距离 5000 多公里。现在,如果有人去修改查询,看起来也像这样:
然后出现正确的结果:
{
"formatted_address" : "Main Street, Arrochar, United Kingdom",
"geometry" : {
"location" : {
"lat" : 56.199560,
"lng" : -4.7459760
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
"id" : "78d53766dfb2c3bb6008301b079423fffb78b801",
"name" : "Arrochar Hotel",
"reference" : "CnRtAAAAJPg2ABkegIT9Q12hABjfGezwGgHCc3ur1W761rhtkQq0n6Id-cgaLREU-g8Uo5Bnw4ovaAnqCrYm_fHEKjBHOrHK5dvcGpAndQVsl-zi_qZSZR6Sa5HvYZI4pA3ne3rNTl0m4TwuwmMM0nx2gSkxEBIQFqgW85GrUZI8SQFvohgMiBoU51C716M4m-ySUVECgT4BFZUYB50",
"types" : [ "lodging", "establishment" ]
}
那么为什么 Places API 文本搜索会这样呢?请注意,位置参数指向酒店所在的确切位置。然而,我得到的东西是 5000 公里外的东西,除非我加上“酒店”这个词。
谢谢