Geonames database query locally

If I import the Geonames database to a MySQL or SQLite database, how can query the database by latitude and longitude? I need to find the current country code based on a given geolocation (latitude and longitude). In other words, if I have a database with gps coordinates, how can I accurately get the closest one to a given latitude and longitude?

I'm looking for a standalone solution because of rate limits of most reverse geocoding services.

Thank you.


Ok I found a beautiful article by Seth McLean that describes this situation perfectly and provides a MySQL query that does exactly what I need: to search a geonames database by latitude and longitude. Maybe this helps someone else:

Need Your Help

Spring Security 3.1


Could someone help me on this. appreciate your help.

MySQL: Insert no duplicates for column1 and column2

mysql insert where jointable

Create Table as follows where column1 and column2 are both foreign key values.