[Openstreetmap-dev] Uploading complete "OSM" format files via the API (ticket 54)
immanuel.scholz at gmx.de
Tue Dec 6 09:58:18 GMT 2005
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.
The trac is at http://www.openstreetmap.org/trac/ticket/54
The problem I have with the ticket's suggestion is:
> Could we maybe implement a system where if node and segment IDs were
> negative numbers, e.g.
> <node lat='xxx' lon='yyy' tags= uid='-1'>
> <segment from='-1' to='-2' tags=/>
> then OSM would just allocate the next available ID to them?
I dislike the idea of reinterpreting the meaning of "id" as "id, but if it
is negative, it is an id with the boolean flag that the object is new".
I think this is hacky. Better express it as it should be expressed: one
attribute for the id another for the fact that the object is new.
<node uid="1" action="new" lat=... lon=... />
Here, the id is self generated from the application. The application must
not assume that this id is still valid after sending the data, since it
will be changed by the server as soon as the data arrived. The server
response to the request by transferring back all sent objects with correct
The id specified together with action="new" must be unique among the file
transfered but may be doubled to any object not transfered in this
session. If action="new" is ommited, the uid attribute must be unique
among the whole database (this means: must be obtained from the server in
an earlier request).
This way, we can also sent deleting requests in the same scheme:
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).
More information about the dev