My Google Summer of Code 2026 project was Category Support in Nominatim.

The goal was to replace Nominatim’s single class/type representation with a proper categories field so that one OSM object can carry multiple categories. For eg, an object tagged as both a hotel and a restaurant can now be represented in one row with categories such as:

osm.tourism.hotel
osm.amenity.restaurant

What was completed

  • Added the PostgreSQL ltree[] categories column to the main Nominatim tables.
  • Generated multiple categories from OSM tags during import while keeping the existing class and type fields for compatibility.
  • Updated ranking, triggers, migrations, and related database logic to use categories.
  • Replaced the old place_classtype_* search tables with category-based search using indexed queries.
  • Removed the old place_classtype_* table creation and maintenance code.
  • Added category filters to the search API.
  • Updated the SQLite adaptor and tests for category data.
  • Updated the documentation for the category system and its API behaviour.

Pull requests

Querying by category

The search API can now accept category filters. For example:

/search?q=restaurant+Berlin&include=osm.amenity.restaurant
/search?q=Berlin&include=osm.amenity
/search?q=hotel+Berlin&include=osm.tourism.hotel&include=osm.amenity.restaurant
/search?q=restaurant+Berlin&exclude=osm.amenity.fast_food

A parent category such as osm.amenity can match categories below it, so a query can include restaurants, cafes, bars, and other amenities without listing every child category separately.

Acknowledgements

I would like to thank my mentors, Sarah Hoffmann (@lonvia) and Marc Tobias (@mtmail), for their guidance, reviews, and support throughout the project. I am also grateful to everyone who contributed feedback and discussions during the implementation.

Thank you to OpenCage for sponsoring the development server used for the planet-scale database setup, migrations, benchmarking, and testing. I would also like to thank Google Summer of Code and the OpenStreetMap Foundation for making this project possible.

More details

Discussion

Leave a comment

Log in to leave a comment