Documenting the database structure / schema of nominatim
This question: Where can I find description of the database structure "Nominatim"? is a good question I would like an answer to. Perhaps it's something we could try to answer on this "Development overview" page. Or maybe it belongs somewhere off osm2pgsql (documenting it's "gazetteer" mode) I'm not sure.
I had a quick dive into the database of our nominatim install. It's pretty confusing. Lots of tables. I found a few things though:
The tables planet_osm_nodes and planet_osm_ways seem to be pretty raw dumps of all the OSM data.
There's a tags column of type text array, which can be queried. The following finds all the ways representing stadiums for example:
- SELECT * FROM planet_osm_ways WHERE 'stadium' = ANY (tags) LIMIT 10;
The planet_osm_ways table also has an array column for the nodes which form part of the way. Meanwhile the nodes table has latitude and longitude as you'd expect. I would also expect that to have PostGIS geometry columns, but it doesn't.