2

For my project, I have successfully created a PostgreSQL database of the entire planet file using osm2pgsql. My next task was to sucessfuly update the database using daily change files through the well renowned osmosis -> osm2pgsql (append) process chain.

To test updates, I added some hiking trails to the OpenStreetMap. The nodes were auto snapped to the edges of existing roads in the forest in the OSM editing session (website). I pulled the change file with osmosis using the sequence id, per standard, and used the osm2pgsql --append command, as outline by numerous help sites and forums. My new trail came through, and was visually proven using a Geoserver platform to serve the postgres data.

Here is the problem...any existing road that was modified was absent in the osm_line data after the update. The two roads to which either end of the newly digitized trail were gone. They are still in the map, as confirmed by a Geofabrik download of the local area, as well as by simply going to the OSM website. Additionally, an existing trail that was incorrect and I moved a few nodes within is also gone. It seems my command (either Osmosis or Osm2pgsql append) is wrong, and is only applying new features and knocking out anything that changed.

Hoping we have some OSM gurus that can help.

My two commands are as follows:

osmosis --read-replication-interval workingDirectory=D:\osm_updates --simplify-change --write-xml-change D:\osm_updates\changes.osc.gz

osm2pgsql --append -d planet -U postgres -S default.style -E 4326 -C 8000 --slim --number-processes 6 d:\osm_updates\changes.osc.gz

1 Answer 1

1

I received an answer at help.openstreetmap.org that I will share here, to hopefully help out future individuals attempting the same process:

"You need to be careful to use the same options for update that you used for the import. In your case, you used a flat node file (--flat-nodes option) for the import. You need to keep this file around and use the option for updates as well.

The file contains all the coordinates of all points in your planets. OSC update files only contain the coordinates of points that have actually been changed. If a way is modified then its coordinates are not in the OSC file. They need to be looked up from the import.

If you still have the flatnode file, nothing is lost yet. Simply apply your change files again in chronological order, this time with the --flat-nodes option and the lost ways will reappear in your database." - user: lonvia, Oct 1, 2018

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.