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 end 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:

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

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

asked 29 Sep '18, 02:45

mykol404's gravatar image

mykol404
36336
accept rate: 0%

edited 29 Sep '18, 02:46

What command line did you use to import the initial data with osm2pgsql?

(29 Sep '18, 21:12) lonvia

d:\osm2pgsql-bin>osm2pgsql -c -d planet -U postgres -W -H localhost -S default.style c:\osm\planet.pbf -E 4326 -C 8000 -s --flat-nodes D:\nodes.cache --number-processes 6

(01 Oct '18, 15:30) mykol404

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.

permanent link

answered 01 Oct '18, 15:48

lonvia's gravatar image

lonvia
5.1k14976
accept rate: 38%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×213
×198
×142
×120
×7

question asked: 29 Sep '18, 02:45

question was seen: 720 times

last updated: 05 Oct '18, 19:47

powered by OSQA