简体   繁体   English

在iOS中从经纬度获取地址

[英]Get address from latitude and longitude in ios

I have been programming for ios and I need to get address. 我一直在为ios编程,我需要获取地址。 How can I get full address from latitude and longitude in json or other format? 如何从json或其他格式的经度和纬度中获取完整地址? Can I get it without internet connection? 没有互联网就可以得到它吗? Thank you for your attention. 感谢您的关注。

What you need is the CLGeocoder (on iOS 5) and MKReverseGeocoder (on older iOS versions). 您需要的是CLGeocoder (在iOS 5上)和MKReverseGeocoder (在较旧的iOS版本上)。

Both use Google Maps to get address data so you need an internet connection to get data. 两者都使用Google Maps获取地址数据,因此您需要互联网连接才能获取数据。

You'll get address as NSDictionary , but you can easily convert it to a JSON string with JSONKit or many other tools. 您将获得地址为NSDictionary ,但是您可以使用JSONKit或许多其他工具将其轻松转换为JSON字符串。

Take a look in the Apple documentation for CLGeocoder -- specifically the reverseGeocodeLocation:completionHandler: method. 查看Apple文档中的CLGeocoder-特别是reverseGeocodeLocation:completionHandler:方法。 It takes a CLLocation and returns reverse Geocode information you're looking for. 它需要一个CLLocation并返回您要查找的反向地理编码信息。 And since this uses Google Maps, you will need an Internet connection. 并且由于它使用Google Maps,因此您将需要Internet连接。

您应该查看反向地理编码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM