是否有可能获得更精确的反向地理编码?

时间:2015-08-01 16:42:24

标签: ios swift geolocation geocoding

我发现一些反向地理编码方法比其他方法更好,我已经确定了当前的方法。

 func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {

    locationManager.stopUpdatingLocation()

    if(locations.count > 0){

        let location = locations[0] as! CLLocation

        println(location.coordinate)

        currLocation = location.coordinate


        CLGeocoder().reverseGeocodeLocation(location, completionHandler: {(placemarks, error) -> Void in
            println(location)

            if error != nil {
                println("Reverse geocoder failed with error" + error.localizedDescription)
                return
            }

            if placemarks.count > 0 {
                let pm = placemarks[0] as! CLPlacemark
                self.lbutton.text="\(pm.locality)"
            }
            else {
                println("Problem with the data received from geocoder")
            }
        })



    } else {

        alert("Cannot fetch your location")

    }


}

工作就像一个魅力而不失败(但有时需要几分钟才能更新地点,但这很公平),但是,我很好奇是有可能让它精确定位城镇,而不是只是整个州?例如,它会说Bushwick而不仅仅是纽约?

我知道最近(ish)改变了反向地理编码如何抓取它的数据,但我想我会问一些对这个主题更精通的人。

1 个答案:

答案 0 :(得分:0)

相关问题