How to build an offline geocoder?

Hi all,

I am looking for detailed instructions how to set up a geocoder for offline use. I am a newbie with basic Python skills. My primary interest is a large database with addresses in the UK. I realize that I should download and use planet.osm but am lost after that. Any pointer to step-by-step guidelines would be fantastic.

Thanks in advance!
Bert

I’ve not used a Geocoder so far, but you could use the extracts from geofabrik instead of the whole planet.osm. It’s much smaller, as you can download a single region:
http://download.geofabrik.de/osm/europe/

Have a look at Nominatim ( http://wiki.openstreetmap.org/wiki/Nominatim ) It is the geocoder used by OpenStreetMap on the main map and the sourcecode for it is available in the OSM svn repository. The readme has somewhat of a step by step guide of how to set it up.

Thanks both! I will have to ponder how to implement the instructions for Nominatim on my local computer. I don’t have any of that infrastructure at hand yet.

If I understand correctly then, in principle, it should be possible to just use someone else’s compiled database and locally only modify the last two steps? That would save a lot of time and duplicate effort, even if the data could be slightly outdated. If that’s true are such pre-compiled databases available somewhere?

PS the install instructions for Nominatim are here:
http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/gazetteer/README.txt

Yes in theory it should be possible to use a database dump and yes it presumably would speed up the thing considerable, given that an import of the full planet can easily take a week or more even on moderately powerful hardware. Running it only on the UK extract should be much faster however. Most of the time is spent in indexing though do those get included in the database dump too?

However, I don’t think there is currently a dump available. There have been requests in the past and it may be provided at some point. One possible reason why not , the whole process of nominatim is fairly new and so it is good to have more people run through the process to check that all the documentation is comprehensible and accurate. So please help improve the install documentation if you find any problems

If you need any help with the setting up, you are probably best off on the mailinglist ( http://lists.openstreetmap.org/listinfo/geocoding )

There are some Python projects:

http://fetegeo.org/

and

http://github.com/brianw/osmgeocode

I am familiar with Geocoder but I have not yet used it. I would advise him to search on internet. You need to type “Geocoder installation” on Google and you will come across a number of sites which will provide information about the topic. I have the feeling that this site is going to be particularly informative – manifcold.net.