NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi, I have a tile server and I populated the database using osm2pgsql. I have created an application which can change the map data in the planet_osm_line table.

I was wondering how I can update the planet_osm_nodes, planet_osm_ways, planet_osm_rels tables based on the changes in the planet_osm_lines table.

Thanks

asked 10 Mar '13, 21:37

srose's gravatar image

srose
161101016
accept rate: 0%


You can't. The "lines" table is derived from the nodes/ways/rels tables and not vice versa. To achieve what you want one would have to "reverse engineer" the content of the lines table: "So, this line is made from OSM way #123456, let's see, that way would normally yield a geometry like this but the line has a different geometry; how come - maybe one of the nodes has been moved, or deleted...?" - even if you were to implement such a complex algorithm it would still be very error prone because it is possible that a node move "detected" by your algorithm has unwanted side effects. (Several ways could be using the same nodes; this means that several line geometries in your line table would be invisibly joined, and that you cannot move one without also moving the other.)

You might get a more helpful response if you explained why you want to merge back your changes; maybe there's another process that achieves the same.

permanent link

answered 11 Mar '13, 00:27

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Hi, the reason is that I am using Osm2Po for route finding. When a user makes a change to the map I want to update the routing graph so it takes the users changes into account. This requires me to either create a custom parser in Osm2Po, which I have done except it uses these three tables and so it won't work. If there is another way to export my planet_osm_line table to an .osm file of .osm.pbf file that would be ok but I am not sure how to do that. I have tried using Osmosis but it doesn't seem compatible with my DB.

(11 Mar '13, 15:55) srose
1

Why are you updating the planet_osm_lines table in the first place? And with what tools? Who's users are making those changes? Are those valid changes you could make directly to the OSM db? In that case you could use the standard osm2pgsql diff imports which first updates the planet_osm_node/ways/rels tables and then from there updates the lines/points/polygon tables to reflect those changes.

(13 Mar '13, 05:38) apmon
1

Hi, I have created an app which downloads the map data from the line table in my database and allows the user to edit it. I use the lines table so that when the user has made a change, the map will re-render to show the change on the map. This app is aimed to be independent from changes made on the actual OSM website so I can't use diffs.

(14 Mar '13, 20:48) srose
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:

×710
×263
×25

question asked: 10 Mar '13, 21:37

question was seen: 4,831 times

last updated: 14 Mar '13, 20:48

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum