How I Rebuilt OpenStreetMap’s Category Model During GSoC
Oh hey! I'm Agasta... I believe you don't know me, so here's my intro . This summer I was selected for GSoC to work on Nominatim with Sarah and Marc. For anyone unfamiliar: Nominatim is a geocoder that uses OpenStreetMap data to turn place names and addresses into coordinates. Every place in OSM gets tagged with a key/value pair like amenity=restaurant or tourism=hotel , which Nominatim stores…
Agasta, a new contributor, was selected for the Google Summer of Code (GSoC) to work on Nominatim, an open-source geocoder that utilizes OpenStreetMap data. Nominatim categorizes each place using key/value pairs like amenity=restaurant or tourism=hotel. The project aimed to replace the existing category model with a more robust one.
Initially, Nominatim only allowed one class/type pair per place, which created issues when a single object had multiple main tags. For example, a hotel containing a restaurant would require two database rows. The project tackled this by introducing a new category model in PostgreSQL, allowing multiple categories for each place.
The new model stored the categories as dot-separated paths, enabling PostgreSQL to understand hierarchical relationships without storing every prefix explicitly. It also maintained the original class and type columns for compatibility with existing consumers and API responses.
The implementation was spread across multiple pull requests (PRs), including PR #4106, which introduced the categories ltree[] column to place and placex tables, generated categories in the Lua import code, and updated SQL ranking and trigger functions. The migration process initially used lazy backfilling, but later optimizations reduced the time required to update a large planet database.
In summary, Agasta's work on the GSoC project successfully transformed Nominatim's category model, enabling it to handle multiple main tags for a single place more efficiently.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.