2018-02-12 21:51:02 +03:00
|
|
|
# Basic Architecture
|
|
|
|
|
2019-05-21 14:55:16 +03:00
|
|
|
Nominatim provides geocoding based on OpenStreetMap data. It uses a PostgreSQL
|
2018-02-12 21:51:02 +03:00
|
|
|
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
|
2020-12-06 19:28:33 +03:00
|
|
|
gazetteer output plugin in `osm2pgsql/src/output-gazetter.[ch]pp`. The result of
|
2018-02-12 21:51:02 +03:00
|
|
|
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
|
2019-05-21 14:55:16 +03:00
|
|
|
the search index. Most of this work is done in PL/pgSQL via database triggers
|
2020-12-06 19:28:33 +03:00
|
|
|
and can be found in the files in the `sql/functions/` directory.
|
2018-02-12 21:51:02 +03:00
|
|
|
|
2019-05-21 14:55:16 +03:00
|
|
|
The __search frontend__ implements the actual API. It takes search
|
|
|
|
and reverse geocoding queries from the user, looks up the data and
|
2018-02-12 21:51:02 +03:00
|
|
|
returns the results in the requested format. This part is written in PHP
|
|
|
|
and can be found in the `lib/` and `website/` directories.
|