如何进行类似 Google 地图地址的查找
您可能都看过maps.google.com.au 地址查找。开始在文本框中输入内容,您的地址会在完成之前自动完成在列表中。它还会以粗体显示链接到您所输入内容的文本匹配部分。
我使用了地图的 javascript api 和 http api。地理编码似乎对匹配做了一些不错的事情,但我不完全确定如何让它发挥作用。
无论如何,他们会建议我遵循一个教程或一个快速的五步流程来实现此功能吗?
You've probably all seen the maps.google.com.au address lookup. Start typing into the text box and your address auto completes in the list before you've finished. It also bolds the matching sections of the text that link to what you are typing.
I've used both the javascript api of maps and the http api. The geocoding seems to do something decent with the matches but i'm not entirely sure how one would go about getting this to work.
Anyway have a tutorial or a quick five step process that they would recommend I follow to get this feature going?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要查找的功能是“键入时查找”或“键入时建议”或 AJAX 实时搜索。
与任何其他“键入时查找”解决方案一样,可以通过 Maps API 获取该功能。对于输入到搜索框中的每个键,您已经将请求发送到服务器并查看到目前为止与输入的文本相匹配的内容。问题是,在收到 620(请求过多)错误之前,您只能向 google 发送这么多请求。当您拥有自己可以查询的小型数据库时,拥有“按类型查找”机制通常会更容易,速度更快,并且不会遇到太多请求的问题。
一些教程链接:
The feature you are looking for is "find as you type" or "suggest as you type" or AJAX live search.
To get the functionality via the Maps API is possible as any other find as you type solution. For each key entered into your search box you already send the request to the server and see what matches the entered text so far. The problem is that you can only send so many requests to google before you get a 620 (too many requests) error. Having a find-as-you-type mechanism is usually easier when you have your own small DB which you can query, that is faster and you won't have problems with too many requests.
Some links with tutorials: