7.8 Converting Longitude and Latitude to a Meaningful Address

2024-03-01 10:18

本文主要是介绍7.8 Converting Longitude and Latitude to a Meaningful Address,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!



通过经纬度获取地址信息

- (void)viewDidLoad

{

    [superviewDidLoad];

CLLocation *location = [[CLLocationalloc] initWithLatitude:39.904989

                                                     longitude:116.405285];

   self.myGeocoder = [[CLGeocoderalloc] init];

    [self.myGeocoder

    reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks,NSError *error) {

        if (error == nil && [placemarkscount] > 0){

            CLPlacemark *placemark = [placemarks objectAtIndex:0]; /* We received the results */

            NSLog(@"Country = %@", placemark.country);

            NSLog(@"name = %@", placemark.name);

            NSLog(@"thoroughfare = %@", placemark.thoroughfare);

            NSLog(@"subThoroughfare = %@", placemark.subThoroughfare);

            NSLog(@"locality = %@", placemark.locality);

            NSLog(@"subLocality = %@", placemark.subLocality);

            NSLog(@"administrativeArea = %@", placemark.administrativeArea);

             NSLog(@"subAdministrativeArea = %@", placemark.subAdministrativeArea);

            NSLog(@"postalCode = %@", placemark.postalCode);

            NSLog(@"ISOcountryCode = %@", placemark.ISOcountryCode);

            NSLog(@"inlandWater = %@", placemark.inlandWater);

            NSLog(@"ocean = %@", placemark.ocean);

            NSLog(@"areasOfInterest = %@", placemark.areasOfInterest);

         }

        else if (error ==nil &&

                  [placemarkscount] == 0){

             NSLog(@"No results were returned.");

         }

        else if (error !=nil){

            NSLog(@"An error occurred = %@", error); }

     }];

}



输出:

2014-04-08 14:12:59.756 cookbook[592:c07] Country = China

2014-04-08 14:12:59.758 cookbook[592:c07] name = Danta Coffee

2014-04-08 14:12:59.758 cookbook[592:c07] thoroughfare = Danta Coffee

2014-04-08 14:12:59.758 cookbook[592:c07] subThoroughfare = (null)

2014-04-08 14:12:59.759 cookbook[592:c07] locality = (null)

2014-04-08 14:12:59.759 cookbook[592:c07] subLocality = Dongcheng

2014-04-08 14:12:59.760 cookbook[592:c07] administrativeArea = Beijing

2014-04-08 14:12:59.760 cookbook[592:c07] subAdministrativeArea = (null)

2014-04-08 14:12:59.760 cookbook[592:c07] postalCode = (null)

2014-04-08 14:12:59.760 cookbook[592:c07] ISOcountryCode = CN

2014-04-08 14:12:59.761 cookbook[592:c07] inlandWater = (null)

2014-04-08 14:12:59.761 cookbook[592:c07] ocean = (null)

2014-04-08 14:12:59.761 cookbook[592:c07] areasOfInterest = (null)





如果输入的经纬度是:

CLLocation *location = [[CLLocation alloc] initWithLatitude:24.5

                                                      longitude:118.13];


则输出是:

2014-04-08 14:16:19.442 cookbook[613:c07] Country = China

2014-04-08 14:16:19.443 cookbook[613:c07] name = No. 1389 Xianyue Road

2014-04-08 14:16:19.443 cookbook[613:c07] thoroughfare = Xianyue Road

2014-04-08 14:16:19.444 cookbook[613:c07] subThoroughfare = No. 1389

2014-04-08 14:16:19.444 cookbook[613:c07] locality = Xiamen

2014-04-08 14:16:19.444 cookbook[613:c07] subLocality = Huli

2014-04-08 14:16:19.444 cookbook[613:c07] administrativeArea = Fujian

2014-04-08 14:16:19.445 cookbook[613:c07] subAdministrativeArea = (null)

2014-04-08 14:16:19.445 cookbook[613:c07] postalCode = (null)

2014-04-08 14:16:19.445 cookbook[613:c07] ISOcountryCode = CN

2014-04-08 14:16:19.445 cookbook[613:c07] inlandWater = (null)

2014-04-08 14:16:19.446 cookbook[613:c07] ocean = (null)

2014-04-08 14:16:19.446 cookbook[613:c07] areasOfInterest = (null)



这篇关于7.8 Converting Longitude and Latitude to a Meaningful Address的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/762097

相关文章

Tomcat启动报错:transport error 202: bind failed: Address already in use

Tomcat启动报错:transport error 202: bind failed: Address already in use 了,上网查找了下面这篇文章。也是一种解决办法。 下文来自:http://blog.csdn.net/sam031503/article/details/7037033 tomcat 启动日志报出以下错误:  ERROR: transport err

Address localhost:1099 is already in use:tomcat频繁重启端口占用问题

错误提示 Unable to open debugger port (127.0.0.1:58198): java.net.SocketException "Socket closed" Address localhost:1099 is already in use 端口被占用 报错原因 由于短时间内频繁运行tomcat服务器。 为了避免出现这一错误。可以点击刷新uodate

Unique Email Address

思路1:面试的时候可以自己写process method class Solution {public int numUniqueEmails(String[] emails) {if(emails == null || emails.length == 0) {return 0;}HashSet<String> set = new HashSet<String>();for(String

c/c++:CMakeLists.txt中添加编译/连接选项使用内存错误检测工具Address Sanitizer(ASan)

Address Sanitizer(ASan)是一个快速的内存错误检测工具。从gcc 4.8开始,AddressSanitizer成为gcc的一部分。 既然是gcc内置的内存检查工具,用起来比第三方的库更方便些。只要指定相应的编译链接参数就可以实现内存泄露检查了,如下是是cmake脚本中增加Address Sanitizer选项的示例: # 使用sanitize进行内存泄露检查# 编译选项t

【精讲】PCIe基础篇——BAR(Base Address Register)详解

一、为什么需要BAR         系统中的每个设备中,对地址空间的大小和访问方式可能有不同的需求,例如,一个设备可能有256字节的内部寄存器/存储,应该可以通过IO地址空间访问,而另一个设备可能有16KB的内部寄存器/存储,应该可以通过基于MMIO的设备访问。哪些地址应该使用哪种方式(IO或Memory)来访问它们的内部位置,这是系统软件(即BIOS和OS内核)的工作。因此设备必须为系统软件

【C++ Primer Plus习题】7.8

问题: 解答: #include <iostream>using namespace std;#define SEASONS 4typedef struct _Spend{double money[SEASONS];}Spend;const char* Snames[SEASONS] = { "Spring","Summer","Fall","Winter" };void

namenode启动失败 。 : Cannot assign requested address

Cannot assign requested address 我部署hadoop 格式化后 , start-all.sh . 通过 jps 命令发现 datanode 可以启动 。 然而那么namenode启动失败。 网上找了好多博客贴吧 。 1  有的是 ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: Faile

C++:Github开源7.8Kstar的线程池介绍

目录 源码展示 1. 头文件和依赖 1. 2. 3. 4. 5. 和 6. 7. 8. 2. ThreadPool 类的定义 1. std::vector workers; 2. std::queue> tasks; 3. std::mutex queue_mutex; 4. std::condition_variable cond

【实践经验】端口被占用问题:listen tcp:bind:only one usage of each socket address

文章目录 一. 问题描述二. 分析1. 适用错误 三. 解决方法1. 打开控制台2. 查看端口的使用情况2.1 不知道端口号——查看所有运行的端口2.2 知道端口号 3. 查看使用进程的程序4. 杀死进程5. 验证端口是否释放 一. 问题描述 goland启动项目后报错:“listen tcp:bind:only one usage of each socket addr

jupyter开启远程访问以及遇到No address associated with hostname问题

jupyter安装好之后默认只能本地访问,要想开启远程访问,有两种方法 1、第一种,生成配置文件,修改内容。 参考链接: https://www.cnblogs.com/yangxiaolan/p/5778305.html 2、第二种,手动创建一个配置文件。 # vim config.json {"NotebookApp": {"ip": "0.0.0.0","port": 8080,