I was planning to use geonames API but actually it seems far more sensible to use the geonames locally and not use their web API. So my question is, does anyone know how to interface with the geonames data locally?
Do I need to manually import it into a database and then reference it like a normal DB?
free : GeoNames data is free, the data is available without costs. cc-by licence (creative commons attributions license).
GeoNames is integrating geographical data such as names of places in various languages, elevation, population and others from various sources. All lat/long coordinates are in WGS84 (World Geodetic System 1984). Users may manually edit, correct and add new names using a user friendly wiki interface.
GeoNames is one of the largest and most often used gazetteer and it is generally assumed to be of sufficient quality.
Yes you will have to import the database manually if you want to query the database locally.
1 - If you plan to use MySQL you can follow the explanations from this post Importing data from geonames.org database into MySQL DB
2 - If the table structure is not up to date you can also refer to the GeoNames forum: http://forum.geonames.org/gforum/posts/list/732.page
3 - Once you have created your tables following the given structure you can use LOAD DATA INFILE
or LOAD DATA LOCAL INFILE
to bulk import the data from the CSV files.
4 - The importation of the allcountries table can take more than 10 minutes locally. It might be better to create your indexes before you import the data.
(A shell Script is also available if you are familiar with the command)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With