【问题标题】:Get Place ID by Lat Long in Google Map in Swift在 Swift 的谷歌地图中通过 Lat Long 获取地点 ID
【发布时间】:2019-12-16 03:06:58
【问题描述】:

有没有办法从 lat long 或地址获取Google Place ID?我已经通过 lat long 获取了位置地址,但 Place ID 没有运气。谁能帮帮我吗? 我的要求很简单。我有很长。使用 lat long 获取地址。现在我只需要那个地址的地点 ID。

这是我的代码:

let geocoder = GMSGeocoder()
        geocoder.reverseGeocodeCoordinate(coordinate) { (response, error) in

        if error != nil{
            print("reverse geodcode fail: \(error!.localizedDescription)")
        }else{
            if let places = response?.results(){
                if let place = places.first{
                    print("GMS Address Place-->", place)
                    if let lines = place.lines{
                        print("GEOCODE: Formatted Address: \(lines[0])")
                        }
                }else{
                    print("GEOCODE: nil first in places")
                }
            }else{
                print("GEOCODE: nil in places")
            }
        }

【问题讨论】:

  • 你能弄清楚这个吗?我也遇到了同样的问题。

标签: ios swift google-maps google-maps-api-3


【解决方案1】:

要获取地点 ID 等地点信息,请使用google Places SDK

【讨论】:

  • 问题是我没有任何地点 ID。我想从lat long得到placeid。而且我认为这在 ios 的地方 api 中不可用。
【解决方案2】:

【讨论】:

  • 我不需要多个位置。我需要给定纬度的确切位置。但是您给定的 api 提供了多个具有不同 lat long 的地方,这与我给定的 lat long 不匹配。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多