Google Maps Find Place API位置偏差导致零结果



我正在尝试使用Find Place API的locationbias特性来为我的搜索提供更多相关的结果。我已经尝试了一个点和一个矩形,在这两种情况下,我的查询返回零结果。然而,如果我完全消除偏见,我确实得到了一个结果。为什么我知道在矩形边界内的位置没有被返回?另外,这个字段叫做locationbias暗示它会更喜欢这个位置附近的地方,但不会强制设置严格的边界,所以为什么我没有得到任何结果?

下面是一个示例GET: https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Ariel%20Dunes%201%20Unit%20308%20Seascape%20Resort&inputtype=textquery&locationbias=rectangle%3A30.119056%2C-86.527098%7C30.444872%2C-85.705723&fields=geometry%2Flocation%2Cname%2Cplace_id

反应:

{ "candidates" : [], "status" : "ZERO_RESULTS"}

Without locationbias: https://maps.googleapis.com/maps/api/place/findplacefromtext/json?inputtype=textquery&fields=geometry%2Flocation%2Cname%2Cplace_id&input=Ariel%20Dunes%201%20Unit%20308%20Seascape%20Resort

反应:{ "candidates" : [ { "geometry" : { "location" : { "lat" : 30.377608, "lng" : -86.366795 } }, "name" : "Ariel Dunes I (ADI) at Seascape Resort", "place_id" : "ChIJF5B7IoRbkYgRQWjAZv0-wUI" } ], "status" : "OK" }

为了清楚起见,这里是上面使用的解码位置偏差:rectangle:30.119056,-86.527098|30.444872,-85.705723

根据文档,这应该是矩形的西南角,然后是矩形的东北角。

这个问题是由于我使用了Postman。Postman隐式地编码查询字符串。禁用此功能允许我在形状和坐标之间使用文字冒号,从而纠正了这种行为。

最新更新