[Openstreetmap-dev] Uploading complete "OSM" format files via the API (ticket 54)
Immanuel Scholz
immanuel.scholz at gmx.de
Tue Dec 20 20:05:35 GMT 2005
Hello again,
I have a problem implementing my own suggestion, which lead me to a) post my
new suggestion here and b) wait for your better ideas ;-)
If nobody disagree (or everybody agree ;) I'll summary in wiki.
> I added a comment to #54 in trac. Additional to this, I post it here to
> discuss my suggestion. I will put the result into the wiki-schema page.
...
> Summary: My suggestion is to add an attribute "action" to each object sent
> by this (and only this) summary request.
>
> action defaults to "change", so if it is ommited, the object is changed to
> the given value.
> If action is "new", the object is created as new in the database (if not
> any merging rule like "equal lon/lat" applies, in which case the action is
> interpreted as "changing the merged object").
> If action is "delete", the object is deleted (if it was in database. If
> not, nothing happens).
This has a serious problem when deciding whether an uid in a "change" action
is a new one from the current file or an old one in the database:
<osm>
<node uid="1" action="new" ... />
<segment uid="23" action="change" from="1" ... />
</osm>
Does here the segment change to the new created node or does it change to the
object in the database with the id of 1 (if it exists)?
So I suggest a new schema, using the original idea (since it is more
pragmatic):
<osm>
<node uid="-1" ... />
<segment uid="34" from="1" ... />
<segment uid="45" from="-1" ... />
</osm>
Here, it is clear that segment 34 is changed to hold now the object with id 1
as from-node whereas segment 45 points to the newly to-be-created node.
To mark objects as deleted, put them into a <deleted> tag:
<osm>
<deleted>
<node uid="23" /> <!-- lat/lon can be ommited -->
<segment uid="34" />
</deleted>
</osm>
Why this? It is easy to code, you (as a programmer) don't have to change the
routines that generate the tags for the objects and it is easy to read.
Ciao, Imi.
PS: The lat/lon in node and the from/to in segment can be ommited when
deleting.
It can be included however and the server may reject the deletion of these
segments, if they do not match with the data in the database (as a first and
basic merge-conflict-detection).
More information about the dev
mailing list