3

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.

Ben Robinson
  • 1,602
  • 3
  • 16
  • 30

5 Answers5

2

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

Noam
  • 3,341
  • 4
  • 35
  • 64
  • Thanks for that link, I'd looked, but not hard enough! The link wasn't enough - but I've started a thread over there: http://forum.geonames.org/gforum/posts/list/0/2492.page#9334 – Ben Robinson Mar 07 '11 at 21:02
1

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.

leo
  • 7,518
  • 1
  • 24
  • 25
0

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

Simon B.
  • 2,530
  • 24
  • 30
-2

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.

mpemburn
  • 2,776
  • 1
  • 35
  • 41
-2

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.

Benedicte Raae
  • 144
  • 1
  • 7