From coordinates find country using Python

This achieves finding country given coordinates. https://github.com/che0/countries

It uses a shapefile containing world borders loaded using python bindings for gdal.

Example:

 import countries
 cc = countries.CountryChecker('TM_WORLD_BORDERS-0.3.shp')
 print cc.getCountry(countries.Point(49.7821, 3.5708)).iso

The world borders shapefile can be obtained from http://thematicmapping.org/downloads/world_borders.php.


Given that you only need to find what country the tweets are in I guess the VMAP0 data is sufficient.

As for Python libraries I would recommend looking at Shapely, which supports the Shapely library, a turorial on point-in-polygon can be found here. As for reading in the country polygons from the vmap0-data (which i presume are polygons in shapefiles), you should look at ogr.