Skip to main content

Release 2.2.0

17 September 2025

We are excited to publish version 2.2.0 of osm2pgsql. This release adds two powerful building blocks that can be used to implement all sorts of new features. The new “Locators” and the “deleted callbacks” features seem simple by themselves, but they can be used as basis for many features that have been requested for years.

New Locator feature

This release introduces a new feature: Locators. They help with a common problem, namely how to quickly find out in which region an OSM object is. The region can be a country or any other area. A locator is initialized with one or more regions, each region has a name and a polygon or bounding box. A geometry of an OSM object can then be checked against this region list to figure out in which region(s) it is located. This check is much faster than it would be to do this inside the database after import.

Locators can be used for all sorts of interesting features, for instance:

For details see the manual and look at the example config files provided in the flex-config/locator directory.

Callbacks for deleted objects

The Lua callback functions process_node(), process_way(), and process_relation() (and their untagged companions) only get called for new or changed OSM objects. Deleted objects are usually handled behind the scenes and for most use cases this is enough.

But sometimes it is useful to also know when an object was deleted. That’s why we have new process_deleted_node/way/relation() callbacks now. These open up a lot of new processing options for working with changes. Some users do advanced processing of OSM data inside the database after the data is imported with osm2pgsql. This is much easier now because you don’t need database triggers anymore to detect and process deleted objects.

New osm2pgsql-expire command

We have added a osm2pgsql-expire command. It is currently marked as experimental so it might change without notice. You can use it to turn entries in expire files (that look like ZOOM/X/Y) into a GeoJSON file visualizing the tiles. When given an OSM data file it can generate the tile output (in expire file format or as GeoJSON). This tool is intended as a debugging aid.

Other features and fixes