On Tue, Aug 08, 2017 at 11:32:45AM +0200, Dirk Stöcker wrote:
> On Tue, 8 Aug 2017, Jochen Topf wrote:
> > I would urge you to keep the order because that makes many things much
> > more efficient. For instance checking whether a file contains an object
> > twice is trivial when there is a known order but very expensive without.
> > My code for assembling multipolygons for instance needs to make sure
> > that IDs aren't in a file twice and it uses this very efficient way
> > instead of creating much more complex data structures which would need
> > more RAM and make everything slower.
> In general we will not make any changes only to do changes. So the chance
> that element order stays fixed as it is now is high. I'm not aware that it
> changed in the past.
> BUT: You asked if you can rely on this. And the answer to this is that this
> cannot be guaranteed. :-)
> But you simply can ignore this and hope that JOSM continues to produce nice
> files and chances are high your hope will be fulfilled.

Okay, good enough. :-) At least now that you are aware of this issue, it
will not change just by accident.

I thought some more about this and what it comes down to is this: An OSM
file can either be totally unordered, so the generator doesn't provide
any "guarantees" to its ordering. Or it can be ordered in some way. How
exactly it is ordered doesn't matter that much probably, what matters is
that there is some kind of consistency others can rely on. Although
nobody ever guaranteed it, OSM files are almost always sorted nodes,
ways, relations and each object type by ID, so this is what people rely
on and this is the order that "sort" commands (like the one from osmium
or osmosis) will create. I want to extend this to: If you are using negative
IDs in your OSM file you should order them negative IDs first, then
positive IDs, both ordered by absolute values of those IDs. That's the
format I will optimize my software for and that's the format "osmium
sort" will create in the future. Then everything fits together with the
most important generator of files with negative IDs, JOSM.

Jochen Topf  joc...@remote.org  https://www.jochentopf.com/  +49-351-31778688

Reply via email to