【问题标题】:Google Maps Api Geocode get city by a few lettersGoogle Maps Api Geocode 通过几个字母获取城市
【发布时间】:2023-04-02 13:40:02
【问题描述】:

我找到了用于搜索城市的 Google Maps Api。当我使用链接时 http://maps.googleapis.com/maps/api/geocode/json?address=London&sensor=false我得到了世界上所有伦敦城市的信息。

我的问题是如何使用该 API 通过几个首字母找到城市名称,
例如,我使用?address=Lon,我想获得伦敦(全部)、朗斯代尔、朗维尔等......

有一些解决方案吗?

【问题讨论】:

    标签: google-maps google-maps-api-3 geolocation


    【解决方案1】:

    您可以请求places-autocomplete-service(使用值为(cities) 的类型参数)

    示例:https://maps.googleapis.com/maps/api/place/autocomplete/json?input=lon&sensor=false&types=(cities)&key=yourGoogleMapsKey

    【讨论】:

    • 我以后如何获取城市?我只需要获取城市和国家,这有什么可能?
    猜你喜欢
    • 2012-11-18
    • 2011-06-12
    • 2018-07-25
    • 1970-01-01
    • 1970-01-01
    • 2014-02-12
    • 2013-04-14
    • 2011-10-31
    • 1970-01-01
    相关资源
    最近更新 更多