[Openstreetmap-dev] Streets in GPX

immanuel.scholz at gmx.de immanuel.scholz at gmx.de
Fri Sep 23 13:36:35 BST 2005


Hi,

> Street segments connect two nodes, and have an implicit direction in
> which node is first and which is last.
>
> By making streets a list of segments you can do cool things like have
> non-connected streets. I'm desperately trying to think of an example
> where this is useful, but I'm sure that there must be one.

GPX see track segments as a more general idea of your street segments. It
is a (ordered) vector of nodes connected. A track = street is a list of
track segments.

This means, neither GPX nor your scheme is more powerful. You can convert
one into the other.

BUT!

You can convert GPX easily to your (where a street segment is only
connecting 2 nodes):

foreach node in track segment
  street segment = (previous node -> node)

But given an unordered list of node pairs (street segments), it is hard to
construct a GPX - track segment. At least as hard as sorting the list is.
(I can proove it, if someone don't believe me ;)

Of course, since a 2-node-segment (street segment) is only a special case
of an n-node-segment (track segment), you can just transfer your
2-node-line-segments layered in GPX. But this would not look like a really
clever GPX...

So my remark is: If you get the list of street segments out of the
database already ordered, there is no need to discuss the way of
transfering here. You'll be able to convert the list of street segments to
one GPX-track segment easily.
If you aren't able (which I think applies), then we either transfer
strange looking GPX-data or your server will die by calculating track
segments from your list of street segments...


PS: By "ordered street segments" I mean that the second node of the first
street segment is always the first node of the successor street segment.



> The other thing is that segments can belong to multiple streets. So
> multiple segments can belong to 'baker street' but they can also belong
> to 'Bus number 13's route'.

They can't in GPX. You have to repeat the data of a track segment, if
listed in two different tracks. You may give it the same id, but to get
legal gpx data, you have still to repeat the data :-(


> If it's XML, I don't care how it's represented. It's easy enough to
> tranform it or modify all the code to use some other schema.

If it's only syntactic sugar, of course.
But as you can see in my example above, conversion of data can be
restricted by time consuming algorithms.

And you don't want a server which has to do a O(n^2) or even O(n*log(n)) -
Operation of all nodes on every request!



>> in my opinion the current representation for nodes in data transfers
>> might give some problems with floating point comparisons
>> (the old XMLRPC interface gives every node a unique nodeid,
>> while the GPX interface represents nodes as float LAT/LON)
>
> No it doesn't, the nodeid is in there.

Nope. Not in the track segments. Numbers only possible for tracks (without
extensions).

And it would not help much, since it is only an additional data tag. You
can't skip the actual data by only providing the track segment id. (At
least if you claim to still use GPX).


Ciao, Imi.






More information about the dev mailing list