Opened 14 years ago

Closed 10 years ago

#54 closed enhancement (fixed)

Uploading complete "OSM" format files via the API

Reported by: nick@… Owned by: nick@…
Priority: major Milestone:
Component: api Version:
Keywords: Cc:

Description

Would be good to be able to upload (via the API) a complete 0.2 OSM format XML file, with both nodes and segments. e.g.

<osm version="0.2"> <node lat='xxx' lon='xxx' tags=/> <node....> <node...> <segment from="xxx" to="yyy" tags=""/> <segment....> </osm>

The only problem with this, of course, would be that the "from" and "to" values for the segments would be unknown if the nodes are new. 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'>

and

<segment from='-1' to='-2' tags=/>

then OSM would just allocate the next available ID to them?

Change History (4)

comment:1 Changed 14 years ago by nick@…

Owner: changed from steve@… to nick@…

comment:2 Changed 14 years ago by Immanuel Scholz

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.

As example:

<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 id's replaced.

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: action="delete"

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).

comment:3 Changed 13 years ago by Immanuel Scholz

Ok. I no longer have a problem with negative ids. ;-) My sugestion is flawed, please do not implement this!

In fact, JOSM already implemented this system for it save files. Negative ids are "new and thus unknown" :-)

Imi.

comment:4 Changed 10 years ago by Tom Hughes

Resolution: fixed
Status: newclosed

Implemented (effectively) in the 0.6 API via the changeset upload mechanism.

Note: See TracTickets for help on using tickets.