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 |
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 ( 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 answered 01 Oct '18, 15:48 lonvia |
What command line did you use to import the initial data with osm2pgsql?
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