7

I need to find out in what country given GPS coordinates are, on a device that has no Internet access (e.g. this, but without the easy on-line solution). Having no experience with GIS, I guess I'd need some kind of module that would statically store shapes of countries and match current location against them.

I'd therefore like to ask what kind of tools would be best for this, and what is the best way to obtain the country data. I'm using Python on an embedded Linux box.

Community
  • 1
  • 1
che
  • 12,097
  • 7
  • 42
  • 71

4 Answers4

7

There's a shape file here with all of the country borders. You can then use OGR or something like this to access the data.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Seth
  • 45,033
  • 10
  • 85
  • 120
  • 1
    Thanks, borders+OGR work nicely! The only problem is that OGR is unusable on the embedded box, so I'm going to have to work with retarded rectangular approximations :/ If anyone luckier has this problem, the code is available here: http://github.com/che0/countries – che Sep 05 '10 at 16:54
2

You might have a look at the GeoDjango documentation even if you aren't making a web application. The tutorial covers importing the world boundaries shapefile.

jpwatts
  • 8,297
  • 1
  • 22
  • 8
1

Have you seen https://github.com/krisrak/ios-offline-reverse-geocode-country/? all offline ... no need for any APIs super fast . accuracy not guaranteed !!

abd_ashi
  • 13
  • 2
  • Objective C module for iOS is not very useful in Python, but thank you nevertheless. – che Mar 25 '14 at 08:44
  • there is a json file that is used as a datasource. check how the class works and try to implement it in python, don't think its that big deal ;). good luck :) – abd_ashi Mar 25 '14 at 12:57
0

You would need a map with the boundaries of each country. Then, given a coordinate, you would need to calculate in which boundary the point fell. Of course, the two challenges there are collecting the data and representing it, and doing the math to find where a point falls.

Does anyone know how Yahoo does it? Could you possibly port their approach locally?

Chris Laplante
  • 29,338
  • 17
  • 103
  • 134