Google 地图 api returns 未找到用于计算距离的有效邮政编码的结果
Google map api returns Notfound result for valid postal-cod for distance calculation
我们正在使用 Google 地图 api 来查找两个邮政编码之间的距离。我们可以通过使用 google map api Working Map API example 来获取任意两个邮政编码之间的距离。某些邮政编码在没有任何 space 的情况下发送邮政编码时出现此 api returns NotFound 错误,但对于相同的邮政编码,如果我们给出 space在 3 个字母后效果很好并且 return 距离正确。
API URL
http://maps.googleapis.com/maps/api/distancematrix/json?origins=H3W3C4&destinations=H1C0A6&mode=driving&language=en-EN&sensor=false
示例 1:
url:http://maps.googleapis.com/maps/api/distancematrix/json?origins=H3W3C4&destinations=H1A0C2&mode=driving&language=en-EN&sensor=false
邮政编码: H1A0C2,
api 结果 : 未找到
示例 2:
url:http://maps.googleapis.com/maps/api/distancematrix/json?origins=H3W3C4&destinations=H1A 0C2&mode=driving&language=en-EN&sensor=false
邮政编码: H1A 0C2,api
结果:return秒正确距离
下面是 api return 未找到的邮政编码列表,如果我们提供不带 space 的邮政编码(但如果我们提供 space,例如 'H1A 0C2' 它将 return 结果)
H1A0C2
H1A0C3
H1A0C4
H1B0B7
H1C0E3
H1C0E4
H1C0E5
H1C0E6
H1C0E7
H1C0E8
H1C0E9
H1C0G1
H1C0G2
下面列出了 api return 正确距离的邮政编码,如果我们给出 with/without space( 如果我们给出 'H1C 0A7' 和'H1C0A7'.
H1C0A7
H1C0A8
H1C0A9
虽然对于大多数邮政编码无论是否使用 space 都可以使用,但对于少数人来说,如果没有 space 则它不会 return 值。可能是什么原因?
我建议检查 Google 数据库中是否存在邮政编码。
例如邮政编码 H1A0C2
似乎丢失了
如您所见,地理编码器工具 returns 仅邮政编码前缀 HA1
,而不是邮政编码本身。
对于邮政编码 H1C0A9
地理编码 returns 完整的邮政编码:
我认为距离矩阵无法找到缺少邮政编码的距离。但是,当您添加一个空 space 时,它可以找到邮政编码前缀并根据邮政编码前缀的坐标计算距离。所以在这种情况下结果可能不够精确。
您可以按照以下支持文档中的说明向 Google 报告缺少的邮政编码:
https://support.google.com/maps/answer/3094088
希望对您有所帮助!
我们正在使用 Google 地图 api 来查找两个邮政编码之间的距离。我们可以通过使用 google map api Working Map API example 来获取任意两个邮政编码之间的距离。某些邮政编码在没有任何 space 的情况下发送邮政编码时出现此 api returns NotFound 错误,但对于相同的邮政编码,如果我们给出 space在 3 个字母后效果很好并且 return 距离正确。
API URL
http://maps.googleapis.com/maps/api/distancematrix/json?origins=H3W3C4&destinations=H1C0A6&mode=driving&language=en-EN&sensor=false
示例 1:
url:http://maps.googleapis.com/maps/api/distancematrix/json?origins=H3W3C4&destinations=H1A0C2&mode=driving&language=en-EN&sensor=false 邮政编码: H1A0C2, api 结果 : 未找到
示例 2:
url:http://maps.googleapis.com/maps/api/distancematrix/json?origins=H3W3C4&destinations=H1A 0C2&mode=driving&language=en-EN&sensor=false 邮政编码: H1A 0C2,api 结果:return秒正确距离
下面是 api return 未找到的邮政编码列表,如果我们提供不带 space 的邮政编码(但如果我们提供 space,例如 'H1A 0C2' 它将 return 结果)
H1A0C2
H1A0C3
H1A0C4
H1B0B7
H1C0E3
H1C0E4
H1C0E5
H1C0E6
H1C0E7
H1C0E8
H1C0E9
H1C0G1
H1C0G2
下面列出了 api return 正确距离的邮政编码,如果我们给出 with/without space( 如果我们给出 'H1C 0A7' 和'H1C0A7'.
H1C0A7
H1C0A8
H1C0A9
虽然对于大多数邮政编码无论是否使用 space 都可以使用,但对于少数人来说,如果没有 space 则它不会 return 值。可能是什么原因?
我建议检查 Google 数据库中是否存在邮政编码。
例如邮政编码 H1A0C2
似乎丢失了
如您所见,地理编码器工具 returns 仅邮政编码前缀 HA1
,而不是邮政编码本身。
对于邮政编码 H1C0A9
地理编码 returns 完整的邮政编码:
我认为距离矩阵无法找到缺少邮政编码的距离。但是,当您添加一个空 space 时,它可以找到邮政编码前缀并根据邮政编码前缀的坐标计算距离。所以在这种情况下结果可能不够精确。
您可以按照以下支持文档中的说明向 Google 报告缺少的邮政编码:
https://support.google.com/maps/answer/3094088
希望对您有所帮助!