Offline Reverse Geocoding at Country Level [closed]

吃可爱长大的小学妹 提交于 2019-12-03 08:57:20

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

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.

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

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.

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.

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