iOS上的离线反向地理编码 [英] Offline reverse geocoding on iOS

查看:115
本文介绍了iOS上的离线反向地理编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与该问题相关的现有问题很多,但是我已经找到了尽可能多的问题,却没有得到答案.

There are lots of existing questions relating to this issue, but I have looked at as many of them as I could find and did not get an answer.

我正在尝试基于纬度和经度在iOS上执行离线反向地理编码查询.我希望能够提供纬度和经度,并能提供该点所在的国家/地区.我可以使用地名(例如: http://api.geonames.org/countryCode?lat=45.03&lng=8.2&username=demo ),但我需要脱机的类似功能,但设备上没有Internet功能.

I'm trying to perform an offline reverse geocoding lookup on iOS based on a latitude and longitude. I'd like to be able to provide a latitude and longitude, and be provided with the country in which that point lies. I can do this with Geonames (such as: http://api.geonames.org/countryCode?lat=45.03&lng=8.2&username=demo), but I need a similar ability offline, without Internet functionality on the device.

CLLocation不能提供对我正在做的事情足够可靠的脱机服务,它依赖于您以前在线时创建的缓存,等等.

CLLocation does not provide offline services that work reliably enough for what I'm doing, it relies on caches made while you were previously online, etc. Messy.

我已经尝试过: https://github.com/drodriguez/reversegeocoding 但还没有运气不好,它需要使用我从未听说过的称为Thor的东西进行一些稍微复杂/令人困惑的终端安装,并且抛出了各种错误,所以我保住了它.

I've tried this: https://github.com/drodriguez/reversegeocoding but haven't had any luck, it requires some slightly complex / confusing Terminal installations using something called Thor which I've never heard of, and was throwing up a variety of errors, so I bailed on it.

我发现了一些可下载的地图,但它们似乎更加复杂,令人担忧的是,它们的大小高达数百兆甚至十亿兆字节,远远超出了iOS应用程序的范围.我只需要一个国家,没有什么比这更小的了(城市,街道,位置等),所以我认为我应该可以得到一个更小的文件.

I've found a few downloadable maps, but these seem to be even more complicated, and worryingly, hundreds of megabytes or even gigabytes in size – much beyond the scope of an iOS app. I only need countries, nothing smaller than that (cities, streets, locations, etc.) so I think I should be able to get a much smaller file.

所以我的关键问题是:是否存在一些预先存在的数据库或工具(最好是在iOS支持下),我可以输入纬度/经度并获得一个国家/地区?而且,如果没有,我应该采取什么步骤来独自使用这种功能?

So my key question is: is there some pre-existing database or tool, preferably with iOS support, that I can feed a latitude/longitude, and get a country? And, if not, what steps should I take to get such functionality working on my own?

谢谢.

推荐答案

ReverseGeocodeCountry是适用于iOS的简单轻量级离线国家/地区反向地理编码器,它具有包含国家/地区多边形数据的静态JSON文件,可用于对任何经纬度/经纬度进行地理编码lng:

ReverseGeocodeCountry is a simple lightweight offline country reverse geocoder for iOS, it has a static JSON file with country polygon data that is used to reverse geocode any lat/lng:

https://github.com/krisrak/ios-offline-reverse-地理编码国家/地区

这篇关于iOS上的离线反向地理编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆