1.2 KiB
Basic Architecture
Nominatim provides geocoding based on OpenStreetMap data. It uses a Postgresql database as a backend for storing the data.
There are three basic parts to Nominatim's architecture: the data import, the address computation and the search frontend.
The data import stage reads the raw OSM data and extracts all information
that is useful for geocoding. This part is done by osm2pgsql, the same tool
that can also be used to import a rendering database. It uses the special
gazetteer output plugin in osm2pgsql/output-gazetter.[ch]pp
. The result of
the import can be found in the database table place
.
The address computation or indexing stage takes the data from place
and adds additional information needed for geocoding. It ranks the places by
importance, links objects that belong together and computes addresses and
the search index. Most of this work is done in Pl/pqSQL via database triggers
and can be found in the file sql/functions.sql
.
The search frontend implements the actual API. It takes queries for
search and reverse geocoding queries from the user, looks up the data and
returns the results in the requested format. This part is written in PHP
and can be found in the lib/
and website/
directories.