[OSM-dev] Edit question with respect to a changeset representation
Teemu Koskinen
teemu.koskinen at mbnet.fi
Fri Mar 19 06:23:44 GMT 2010
On Fri, 19 Mar 2010 02:16:16 +0200, Thomas Emge <temge at esri.com> wrote:
> Thanks for the clarification, Frederik.
>
> Yes, I am writing my "own" editor. Based on the description at
> http://wiki.openstreetmap.org/wiki/OsmChange I had assumed that those
> formats can be used interchangeably.
> I am not insisting on using the JOSM format - if there is another, more
> suitable, format then I will change the approach for my editor.
>
> That said, would the approach be different when using the osmChange
> style as compared to your answer for the JOSM format below? In other
> words it is the responsibility of the editing client to maintain
> integrity, correct?
>
Yes, it's the responsibility of the editor, but the server enforces it,
ie. the server doesn't allow to make changes that would break referential
integrity.
> You've also mentioned that the order of sending the updates is
> important. Can all three "actions" be included in the same file and the
> order in the file is important
>
> <osmChange>
> <delete>
> <create>
> <modify>
> </osmChange>
>
> or do they need to be issued different requests for each action type.
>
They can be included in the same file, and yes, the ordering is important.
> I am thinking of the following scenario. I am starting out with a closed
> way
>
> N1----------N2
> | |
> | |
> | |
> N3----------N4
>
> And the after the modifications the new way looks like
>
> N1------N-1------N2
> | /
> | /
> | /
> N3-----------N4
>
> In such a way that N2 was modified and N-1 was created.
>
> The first update against the server would be
>
> <osmChange>
> <modify>
> <node id=2>
> </modify>
> <create>
> <node id=-1>
> </create>
> </osmChange>
>
> All the changes are accepted and now with (node, old_id=-1, new_id=5)
> the next update would be
>
> <osmChange>
> <modify>
> <way id=1>
> <nd id=1 />
> <nd id=5 />
> <nd id=2 />
> <nd id=4 />
> <nd id=3 />
> <nd id=1 />
> </way>
> </modify>
> </osmChange>
>
You can do all that in one request by using the placeholder id of the new
node in the way modification:
<osmChange>
<create>
<node id="-1"></node>
</create>
<modify>
<node id="2"></node>
<way id="1">
<nd ref="1" />
<nd ref="-1" />
<nd ref="2" />
<nd ref="4" />
<nd ref="3" />
<nd ref="1" />
</way>
</modify>
</osmChange>
The server recognizes it, and uses the new nodes actual id in the way
modification.
You can also create new way with new nodes using the same method, etc.
Teemu Koskinen
>
> Thanks,
>
> - Thomas
>
> -----Original Message-----
> From: Frederik Ramm [mailto:frederik at remote.org]
> Sent: Thursday, March 18, 2010 3:58 PM
> To: Thomas Emge
> Cc: 'dev at openstreetmap.org'
> Subject: Re: [OSM-dev] Edit question with respect to JOSM changeset
> representation
>
> Hi,
>
> note that your example is slightly unusual in that you have
> concatenated two ways to form a scenic route but they do not share a
> common node. This is possible but a more realistic example would be
>
> <way id=1>
> <nd ref=1>
> <nd ref=2>
> </way>
> <way id=2>
> <nd ref=2>
> <nd ref=3>
> </way>
>
>> Then the user goes ahead and deletes the sidewalk feature meaning
>> deleting way1. What happens to the relation1 and how is the modification
>> expressed in the changeset of the JOSM file format?
>
> JOSM actually lets you do different things, but it never lets you break
> referential integrity. You can delete the way and automatically remove
> it from the relation (leading to a way delete and relation modify), or
> you can delete the relation together with the way (leading to two
> deletes).
>
> Deleting only the way is not possible.
>
> When uploading changes to the API, JOSM must make sure to send the
> relation modification or deletion before the way deletion, because
> otherwise the way deletion will be rejected by the API as breaking
> referential integrity.
>
>> <node id=1 action=delete>
>>
>> <node id=2 action=delete> (which would make way1 being deleted but what
>> about relation1?)
>
> JOSM can delete nodes 1 and 2 for you if you delete the way (unless they
> are still used by something else). In that case the node deletion will
> be added to the list of changes (and sent to the API *after* the way
> deletion has been sent).
>
> But if you are writing an editor then it might not be the grandest idea
> to use JOSM's file format (unless you want JOSM users to be able to
> process the files generated); I would instead store data directly in
> osmChange (.osc) style.
>
> If you really want to interact with JOSM then you could join the
> josm-dev list.
>
> Bye
> Frederik
>
More information about the dev
mailing list