This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Process diffs with extra table

0

I have splitted off the places from the osm_point table and I'm wondering how the processing of diff files is going to work.

In my testsetup I have this for the points: function osm2pgsql.process_node(object) if clean_tags(object.tags) then return end

local place = object.tags.place
if place == 'city' or place == 'town' or place == 'village' or place == 'hamlet' or place == 'borough' or place == 'suburb' or place == 'quarter' or place == 'neighbourhood' then
  tables.place:add_row({ tags = object.tags })
else
  tables.point:add_row({ tags = object.tags })
end

end

so places end up in the place table and not in the points. If diffs are processed, will that work correctly? So f.e. if the place-tag is deleted from a point, will it be deleted from my place table and inserted into the point table? (I mean: the add_row() implies that only additions will be done through the process_node function...)

asked 06 Sep '21, 13:05

Paulosm2016's gravatar image

Paulosm2016
25335
accept rate: 0%


One Answer:

0

Yes, this will all work magically. You don't have to think about this, osm2pgsql will just handle it for you correctly. Just write your config file like there were no updated at all.

Internally what happens is that all entries in all tables derived from changed objects will be deleted and, possibly, re-added based on whats in your config file. (This is certainly not the most efficient way to do this, but the easiest. It might be handled differently in the future, so you should not rely on the details of this mechanism.)

answered 07 Sep '21, 08:01

Jochen%20Topf's gravatar image

Jochen Topf
5.2k55074
accept rate: 31%

Source code available on GitHub .