Offline Reverse Geocoding at Country Level [closed]

北慕城南 提交于 2019-12-09 07:43:27

问题


There seems to be much about this, but everyone seems to want street level data.

I'm writing an iOS app that needs to get the international dial code (outgoing) for the country you are in - so all I need is the country. As this is mostly going to be used abroad, an online solution isn't really going to work!

Whist searching I discovered the fantastic openstreetmap.org, but their export feature seems only to provide street level - and won't do the whole world in one go!!

Once I have the data I might also need help with algorithms.... but thats for later!! :-)

Thanks

Ben.


回答1:


Have you tried using http://www.geonames.org/ ? You can download the db and use it offline.




回答2:


If you're looking for an approach based on a quadtree, try Yggdrasil. It generates a quadtree based on country polygon data. A Ruby example lookup script can be found here.




回答3:


Yggdrasil https://github.com/leonardvandriel/Yggdrasil does reverse geocoding from coordinate to country code. Included is a .ygg file that gives accuracy down to ca 10km.

A rougher (40 km accuracy) variation is in the ruby gist is here: https://gist.github.com/leonardvandriel/4579113




回答4:


The MapKit MKReverseGeocoder class returns MKPlaceMark object(s) that have the following attributes:

addressDictionary
thoroughfare
subThoroughfare
locality
subLocality
administrativeArea
subAdministrativeArea
postalCode
country
countryCode

You should be able to get what you need from that. You'll need to make your own list of countryCodes with associated dialing codes.




回答5:


This is what it says in the CLGeocoder Class Reference.

An iOS-based device must have access to the network in order for the geocoder object to return detailed placemark information. Although, the geocoder stores enough information locally to report the localized country name and ISO country code for many locations. If country information is not available for a specific location, the geocoder may still report an error to your completion block.

I also only need country location, but I have no idea what for "many locations" means. It seems like it does not work in Oslo, Norway.



来源:https://stackoverflow.com/questions/5103878/offline-reverse-geocoding-at-country-level

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!