osm2pgsql icon indicating copy to clipboard operation
osm2pgsql copied to clipboard

Add callbacks for delete actions

Open lonvia opened this issue 4 months ago • 0 comments

This adds callbacks delete_node \ delete_way \ delete_relation. They are called for every object that is explicitly marked as deleted in a change file. The callbacks are not called for objects that are implicitly deleted to make room for a new version of the object.

The callbacks receive an OSM object as a single parameter -- just like the other callbacks --, only the tags, nodes and member attributes as well as all geometry creation functions are disabled. This kind of information is usually not available for deleted objects. You can still access meta information like version, user etc. and use the object to insert something into a table.

This change required some cleanup to the code that handles untagged nodes. The pgsql output has some special handling in that it ignores untagged objects unless attribute handling is requested. We've long since removed the special handling for flex but the code for filtering was still in osmdata. This PR moves the handling into the pgsql output, which is a bit cleaner. This changes some of the outcome in the tests. See first commit for details.

lonvia avatar Jun 09 '25 21:06 lonvia