I would use the API Geonames, but my application won't have access to the internet. So it has to run stand-alone. I see there are many files from Geonames.org to download, but I don't see any software to aid in being able to do Reverse Geocoding. I want to provide the lat/lon and have it return the country code. I'm thinking of downloading the data and put it into a MySQL database.
What algorithm is used for Reverse Geocoding so I can make use of it with the geonames.org downloads. My project is being written in PHP. Thanks!
geonames downloads has mainly in .txt
files, these can be imported via SQLYog to the mysql database
Table Structure
CREATE DATABASE geonames;
USE geonames;
CREATE TABLE geoname (
geonameid int PRIMARY KEY,
name varchar(200),
asciiname varchar(200),
alternatenames varchar(4000),
latitude decimal(10,7),
longitude decimal(10,7),
fclass char(1),
fcode varchar(10),
country varchar(2),
cc2 varchar(60),
admin1 varchar(20),
admin2 varchar(80),
admin3 varchar(20),
admin4 varchar(20),
population int,
elevation int,
gtopo30 int,
timezone varchar(40),
moddate date
) CHARACTER SET utf8;
MYsql query to import data to this table
LOAD DATA INFILE '/path/to/your/file/geoname.txt' INTO TABLE `geoname`;
After all is set you can query this table against lat/long to get country name
Here is the link you can refer to
http://sgowtham.net/blog/2009/07/29/importing-geonames-org-data-into-mysql/
http://forum.geonames.org/gforum/posts/list/732.page
Hope this helps!