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

Tracking Changes in Postgresql using osm2pgsql as data loader

0

Hello,

I am maintaining my postgresql database using osm2pgsql to maintain my database. I want to track the changes made by the daily replication files.

I was thinking of creating triggers that fired after delete, update and insert. But I have concerns that is might slow down the daily update process. Has anyone done this?

Can you export the change files to polygons in another table? or to a shapefile?

Thank you

Andrew

asked 02 Nov '14, 20:53

ajc2014's gravatar image

ajc2014
46335
accept rate: 0%


One Answer:

0

I did something along such lines for a map I produced during the licence change (slightly over two years ago).

It is slightly tricky in particular, except if something has changed, osm2pgsql will not update any objects, it deletes and then inserts a new copy. This is relevant if you have added additional columns to the schema and want to retain the information (essentially you have to copy the extra information on delete and then re-add on insert). I would not have any concerns performance wise if you are running this on a reasonably fast machine.

answered 03 Nov '14, 17:08

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

Can you post how you made it work?

(06 Nov '14, 01:03) ajc2014

Source code available on GitHub .