首页 \ 问答 \ 没有从纬度和经度获得正确的地址(Not getting a correct address from Latitude & Longitude)

没有从纬度和经度获得正确的地址(Not getting a correct address from Latitude & Longitude)

我想从纬度和经度中获得真正的邮政地址,但效果不佳。 也许我注意到使用正确的API等。

例如,我有以下代码

           var location = CLLocation(latitude:currentLocation.coordinate.latitude, longitude: currentLocation.coordinate.longitude)

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

            if error != nil {
                print("Reverse geocoder failed with error" + error!.localizedDescription)
                return
            }
            if placemarks!.count > 0 {
                let pm = placemarks![0] as! CLPlacemark
                street = String(pm.thoroughfare!)
                city = String(pm.locality!)
                state = String(pm.administrativeArea!)
                print(pm.locality)
                print(pm.administrativeArea)
                print(pm.thoroughfare)
                self.utility.setMyLocation(dName, longitude: long, latitude: lat, street: street, city: city, state: state)
                locManager.stopUpdatingLocation()

            }
            else {
                print("Problem with the data received from geocoder")
            }
        })

但是我没有得到真正的地址。 例如,假设该long和lat地址是

东街123号

我得到的东西只有东街(没有号码)或靠近公路。

为了获得真实地址,我需要做什么?


I want to get the true postal address from the Latitude & Longitude, however is not working well. Maybe I am note using the right APIs or etc.

For example I have the following code

           var location = CLLocation(latitude:currentLocation.coordinate.latitude, longitude: currentLocation.coordinate.longitude)

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

            if error != nil {
                print("Reverse geocoder failed with error" + error!.localizedDescription)
                return
            }
            if placemarks!.count > 0 {
                let pm = placemarks![0] as! CLPlacemark
                street = String(pm.thoroughfare!)
                city = String(pm.locality!)
                state = String(pm.administrativeArea!)
                print(pm.locality)
                print(pm.administrativeArea)
                print(pm.thoroughfare)
                self.utility.setMyLocation(dName, longitude: long, latitude: lat, street: street, city: city, state: state)
                locManager.stopUpdatingLocation()

            }
            else {
                print("Problem with the data received from geocoder")
            }
        })

However I am not getting the true address. For example let say if that long and lat address is

123 East Street

I get something like only East Street (with no number) or near by road.

What do I need to do inorder to get the real address?


原文:https://stackoverflow.com/questions/35243120
更新时间:2024-04-20 07:04

最满意答案

可能的答案

刚刚找到这个链接,看起来它可能是一个可能的答案。 设置连接的ClientId。 看起来很简单。


possible Answer

Just found this Link and it looks like it could be a possible answer. Set the ClientId of the connection. Seems simple enough.

相关问答

更多
  • 解决了 - 这是sqlalchemy的一个悬而未决的问题,将在下一个版本中得到解决 Solved - this is an open issue with sqlalchemy, will be solved in the next release
  • 可能的答案 刚刚找到这个链接,看起来它可能是一个可能的答案。 设置连接的ClientId。 看起来很简单。 possible Answer Just found this Link and it looks like it could be a possible answer. Set the ClientId of the connection. Seems simple enough.
  • 在()中,您的代码应该是Oracle SQL代码。 你写的是一个显式的传递查询。 括号中的SQL代码将传递给Oracle并在那里执行。 然后,查询结果将被发送回SAS并成为PT表。 如果您要提交包含SAS特定语言的代码(例如数据步骤代码甚至使用SAS特定功能的SQL),您将收到错误,因为Oracle不理解它。 Within the () your code should be Oracle SQL code. What you have written is an explicit pass-through ...
  • 尝试将环境变量TNS_ADMIN设置为指向tnsnames.ora文件所在的目录。 这会告诉你,如果你的客户找到适当的Ora Networking文件有问题。 编辑:什么是视觉工作室的路径名称? 它里面是否有parens,例如“C:\ Program Files(x86)\ Microsoft Visual Studio \”? 如果是这样,这个场景中就有一个已知的bug。 修复方法是安装修补程序,或者将Visual Studio重新安装到路径中没有保留位置的位置。 Try setting the envi ...
  • 尝试将驱动程序类型设置为thin 。 properties.put("driverType", "thin"); try to set the driver type to thin. properties.put("driverType", "thin");
  • 为了使用oci8模块,除了启用php_oci8.dll之外,您还需要安装Oracle客户端。 您可以尝试使用Oracle 10gR2 Instant Client或Oracle 11gR2 Instant Client 从这里下载: http : //www.oracle.com/technetwork/topics/winsoft-085727.html 我建议使用10.2.0.5版本的Instant Client Package - Basic Lite In order to use oci8 mod ...
  • 这是你需要做的纠正它。 安装32位客户端与64位一端.. 64位版本在使用标准连接字符串方面不起作用..不确定Oracle如何在不修复它的情况下让这个bug持续这么长时间..并排安装是什么我们做了..它将安装到它自己的文件夹中所以你应该没有问题..当你使用.dll时只需将副本设置为local = true并删除旧的并重新添加新的.dll ..确保你使用导航到4.x文件夹而不是2.x文件夹。 this is what you will need to do to correct it . Install th ...
  • ORA-12705错误表明这可能是区域设置问题。 您可以尝试在转换为NLS时使用Oracle XE支持的语言环境启动JBoss。 例如,尝试将此添加到JBoss启动配置( jboss-as/bin/run.conf JAVA_OPTS变量): -Duser.language=en -Duser.country=US The ORA-12705 error suggests that this might be a locale issue. You could try starting up JBoss ...
  • 该错误(无法获取Oracle环境句柄)是Oracle告诉您配置有问题的方法。 在您的情况下,您有不同的路径,可能是问题的根源。 一个说“/ oracle / oracle-client”,另一个说“/ oracle / client”。 你应该找出哪一个是正确的,并相应地调整事情。 您可以使用SQL * Plus连接到数据库。 如果有效,那么cx_Oracle也应该有效。 您也可以使用ldd命令来确定系统是否找到了正确的库。 喜欢这个: ldd /path/to/cx_Oracle.so 如果您有针对12 ...
  • 微软在2月9日发布了一个补丁,导致了这个问题。 它现在被列为已知问题。 https://support.microsoft.com/en-us/kb/3126587 Microsoft released a patch on the 9th of Feb, which has been causing this issue. Its now listed as a known issue. https://support.microsoft.com/en-us/kb/3126587

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)