When given a coordinate off the coast of a large town, the entire town may end up in the potential results during the reverse query. Postgres then needs to sort tens of thousands of results before it can determine the clostest one. Given that the results at such a large search radius are bound to be imprecise anyway, restrict the number of results postgres should consider to 1000.
Nominatim
Nominatim (from the Latin, 'by name') is a tool to search OpenStreetMap data by name and address (geocoding) and to generate synthetic addresses of OSM points (reverse geocoding). An instance with up-to-date data can be found at http://nominatim.openstreetmap.org. Nominatim is also used as one of the sources for the Search box on the OpenStreetMap home page and powers the search on the MapQuest Open Initiative websites.
Documentation
More information about Nominatim, including usage and installation instructions, can be found in the docs/ subdirectory and in the OSM wiki at:
http://wiki.openstreetmap.org/wiki/Nominatim
Installation
The latest stable release can be downloaded from http://nominatim.org. There you can also find installation instructions for the release.
Detailed installation instructions for the development version can be
found in the /docs directory, see docs/Installation.md.
A quick summary of the necessary steps:
-
Compile Nominatim:
mkdir build cd build cmake .. make -
Get OSM data and import:
./build/utils/setup.php --osm-file <your planet file> --all -
Point your webserver to the ./build/website directory.
License
The source code is available under a GPLv2 license.
Contact and Bug reports
For questions you can join the geocoding mailinglist, see http://lists.openstreetmap.org/listinfo/geocoding
Bugs may be reported on the github project site: https://github.com/openstreetmap/Nominatim