javascript - 谷歌地图API : can I get the best auto suggest and geocode it?

标签 javascript google-maps google-maps-api-3

我有一堆地址(字符串)。 我尝试用 GoogleMaps 搜索它们,但很多都没有直接找到。 然而,“您的意思是……”中的第一个结果在大多数情况下都是准确的。

如果 Google API 无法对我的原始地址进行地理编码,有没有办法通过 JS 或 C# 代码获取第一个“您是说”并对其进行地理编码吗?

我有一个相应的固定电话列表。我可以对它们或每个的第一个“您是说”结果进行地理编码吗?

干杯

最佳答案

In case of Google API cannot geocode my original address, is there any way to fetch the first "did you mean" via JS or C# code and geoCode it?

要回答您问题的这一部分,是的,您可以。当您调用 Google 的地理编码 API 时,它会返回一个 JSON 数组结果。该数组中的结果按准确性顺序排列。

此元素的属性之一是 partial_match

partial_match indicates that the geocoder did not return an exact match for the original request, though it did match part of the requested address. You may wish to examine the original request for misspellings and/or an incomplete address. Partial matches most often occur for street addresses that do not exist within the locality you pass in the request.

此时,您知道可能需要仔细检查您传入的字符串,但除此之外,Google 可能会很好地找到与您提供的内容相关的地址,您可以选择以最佳方式解析 JSON 响应(选择非常准确或非常广泛)。

关于javascript - 谷歌地图API : can I get the best auto suggest and geocode it?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7654071/

相关文章:

javascript - 从 Github 文件夹下载最新文件

javascript - 解析 kml 文件以在谷歌地球中显示多个地标

javascript - 图钉上的信息窗口未在谷歌地图上关闭

Android:在 map 上显示和移动当前位置

google-maps - Google map -街景静态图像

javascript - 单击菜单栏中的链接后检查上一个事件链接,jQuery

javascript - 推迟 JavaScript 执行,直到内容添加到文档中

javascript - 如何获取图像的clientHeight?

javascript - 从 Google map 绘图管理器多边形获取 GeoJSON

javascript - google.maps.places.Autocomplete 语言输出