API键入城市名称并获取可能的城市列表? [英] API to type city name and get a list of possible cities?
问题描述
我不能使用常规文本输入,因为有类似的指定城市,用户可以通过以下方式调用同一城市:
不同的名字,。
我想让用户键入他们的城市并显示一个类似结果的列表,我可以用世界城市数据库,jQuery和SQL来完成,但我我真的不想从头开始做。
是否有任何api(例如:google)拥有世界上每个城市的唯一ID,让你成为你搜索他们?您可以发布一个链接到类似的实现吗?
有Google Places自动完成API,
https://developers.google.com/places/documentation/autocomplete
'p>和在 HTTPS进行地图版本3库:/ /developers.google.com/maps/documentation/javascript/places#places_autocomplete
但我不知道如何处理不同的名称同一个城市—虽然,具有试过时,它确实存在<强>慕尼黑,德国为 munchen —看看你的用例有多好。
I need to know on which city my users are.
I cannot use a regular text input since there are similar named cities and users can call the same city by different names,.
I want to let users type their city and display a list of similar results, I could do it with a world cities database, jquery and sql but I'm really not dying to do it from a scratch.
Is there any api (e.g: google) that has an unique ID for each city in the world and let's you search them? Could you post a link to a similar implementation?
There is the Google Places Autocomplete API, https://developers.google.com/places/documentation/autocomplete
and a library for Maps Version 3 at https://developers.google.com/maps/documentation/javascript/places#places_autocomplete
but I don't know how well it will cope with different names for the same city — although, having tried it, it does present Munich, Germany for munchen — see how well your use case performs.
这篇关于API键入城市名称并获取可能的城市列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!