Order in JOSM files
Dirk Stöcker
openstreetmap at dstoecker.de
Tue Aug 8 08:43:22 UTC 2017
On Tue, 8 Aug 2017, Jochen Topf wrote:
> When JOSM saves OSM files it uses a particular order: First nodes, then
> ways, then relations as usual. For each object type it first writes out
> objects with negative IDs (ie objects that are not uploaded yet), then
> objects with positive IDs, both are ordered by absolute value.
>
> Is this something I can rely on or is this just something that happened
> accidentally with my version of JOSM when I tried this?
>
> The reason I am asking: I sometimes get requests for Osmium features
> from people who want to do something with files saved from JOSM, like
> renumber them to have only small positive IDs, or convert them into
> other formats. Osmium can read JOSM files and handle negative IDs, so
> these things mostly work, but in some cases having a known order helps
> (or is even necessary for correct functioning). I am currently working
> on some things there but if JOSM would not keep to this order in the
> future they would break again.
I would not rely on the order of the individual elements. There are ideas
to rework the data storage to prevent changing IDs for the new objects
(allows better diffs). That may have other side effects as well. I would
expect the only thing you can rely on is the nodes, ways, relation order.
Ciao
--
http://www.dstoecker.eu/ (PGP key available)
More information about the josm-dev
mailing list