大佬教程收集整理的这篇文章主要介绍了ios – CLGeocoder reverseGeocodeLocation返回不同纬度/长度的地标? (附有游乐场示例),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
背景:对于用户在地图上“长按”以放置引脚,但我的代码反向对此进行地理编码以便能够在引脚上放置区域名称,但随后丢弃的PIn位于不同的位置(即不良好的用户体验).所以我正在寻找一种方法来利用用户实际选择的纬度/经度,但随后只需查找位置名称.
>输入:-28.7780218895614,152.978574011267
>输出:-28.864405,153.0001191
码:
import UIKit import CoreLOCATIOn import PlaygroundSupport // Initial Test Co-ordinate let Locinput = CLLOCATIOn(latitude: -28.778021889561444,longitude: 152.97857401126666) print("Input: \(Locinput.coordinate.latitudE),\(Locinput.coordinate.longitudE)") // Initiate Reverse Geocoding let geocoder: CLGeocoder = CLGeocoder() print("About to call reverse geocoding function") geocoder.reverseGeocodeLOCATIOn(Locinput) { placemarks,error in guard let placemarks = placemarks else {fatalError("No Placemarks Provided \(error?.localizedDescription)")} for p in placemarks { print("OUTPUT: \(p.LOCATIOn!.coordinate.latitudE),\(p.LOCATIOn!.coordinate.longitudE)") } } // Enable Asynch PlaygroundPage.current.needsIndefiniteExecution = true
假设这个:
a: Associated LOCATIOn with the empire state building. b: LOCATIOn you provided from an long press for instance. ------- | | | a | --> CLPlacemark: Empire state building,LOCATIOn: a | b| -------
你的假设是正确的.
以上是大佬教程为你收集整理的ios – CLGeocoder reverseGeocodeLocation返回不同纬度/长度的地标? (附有游乐场示例)全部内容,希望文章能够帮你解决ios – CLGeocoder reverseGeocodeLocation返回不同纬度/长度的地标? (附有游乐场示例)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。