【问题标题】:Google Directions Service API 3 Return Wrong Result to MapGoogle Directions Service API 3 向地图返回错误结果
【发布时间】:2016-05-04 00:29:23
【问题描述】:

我正在使用 google Direction Service 查找以下两个地址的地图

var start = "2115 First Avenue SE Unit 1306, Cottage Grove Place, Cedar Rapids, IA, 52402";     //Set the source/ origin
var end = "6126 Rockwell Dr. Apt 128, Keystone Place, Cedar Rapids, IA, 52402";

通过谷歌地图直接选择它可以正常工作

链接:https://www.google.co.in/maps/dir/Keystone+Place-Blair's+Ferry,+6126+Rockwell+Drive+Northeast,+Cedar+Rapids,+IA+52402,+United+States/Cottage+Grove+Place,+2115+1st+Avenue+Southeast,+Cedar+Rapids,+IA+52402,+United+States/@42.0179234,-91.6739759,13z/data=!3m1!4b1!4m13!4m12!1m5!1m1!1s0x87e4f0459aacb105:0x63c416fc0edc61d6!2m2!1d-91.6475339!2d42.039779!1m5!1m1!1s0x87e4f0d795c1b96b:0xa1ccbbf6400b01aa!2m2!1d-91.6362972!2d41.9959428?hl=en

使用方向服务时,它的工作方式不同。 找到下面的例子

http://jsfiddle.net/MRHQ4/291/(致谢作者:Shreerang Patwardhan)

当我从源和目标中删除 Address2 时它工作正常

【问题讨论】:

    标签: google-maps google-maps-api-3 map-directions


    【解决方案1】:

    'Cottage Grove Place' 和 'Keystone Place' 不是地址2,这些是地名(或者你可以说地名),只需将它们移动到地址的开头(没有其他变化),如下所示,它是工作正常:

    var start = "Cottage Grove Place, 2115 First Avenue SE Unit 1306, Cedar Rapids, IA, 52402";     //Set the source/ origin
    
    var end = "Keystone Place, 6126 Rockwell Dr. Apt 128, Cedar Rapids, IA, 52402";  //Set the destination
    

    我测试过,它工作正常,请检查,谢谢。

    【讨论】:

    • 感谢您的信息。但是如果我们在使用google.co.in/maps时以相同的顺序使用相同的地址,它会如何工作
    • @KrishKvR :抱歉没有明白你的意思,你能解释一下吗?谢谢。
    【解决方案2】:

    单元和公寓信息可能会导致地理编码器出现解析问题。如果可以,请尽量删除它们。将地址更改为

    var start = "2115 First Avenue SE, Cedar Rapids, IA, 52402";     //Set the source/ origin
    var end = "6126 Rockwell Dr, Cedar Rapids, IA, 52402";
    

    您会发现它工作得更好。

    Reduced Address Information

    With Neighborhood Information

    With Apt/Unit Information

    【讨论】:

    • 是的。这很好用。任何其他机会使其正常工作而无需删除到 Address2
    • 您说的是(Apt/Unit)信息还是邻里(Cottage Grove / Keystone Place)信息?
    • 感谢您的信息。但是如果我们在使用google.co.in/maps时以相同的顺序使用相同的地址,它会如何工作
    • 查看您发布的Google Maps链接,地址不是您发布的地址。谷歌根据他们的地址格式算法纠正了这个问题。但是,地址解析和地理编码的成本非常高,因此它们的 API 受限于暴露的数量。
    • 我们从谷歌购买了企业 API 密钥。那么是否有可能通过完美的地址解析使其工作?
    猜你喜欢
    • 2016-12-22
    • 2015-08-07
    • 2018-11-30
    • 2014-11-29
    • 2016-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多