[Openstreetmap-dev] CSV transport encoding scheme
immanuel.scholz at gmx.de
Tue Jan 24 16:36:28 GMT 2006
>> no-properties, key1, value1, key2, value2, ...
> Why do you need the no-properties field?
First I will wipe out a possible misunderstanding of the meaning:
"no-properties" does not stand for a flag "no properties" vs. "some
properties" but for an integral number telling the number of properties.
> This will probably cause some trouble sometimes and just to have it so
> implementing parsing is simpler in a language like C does not seem to be a
> sufficient argument.
You are right in case of that this is redundant information, since the
properties are always the last data entries in a list. The properties
could be defined as "following a pair of every property one after
However, several arguments are for such a length indicator at start:
- It is consistent with the list of line segments in a street and the list
of nodes in an area. Maybe even code can be shared here (I am not so sure
about code sharing, since the property lists have double the entries than
the other lists.)
- Redundance helps to detect decoding problems. As example if the sending
library does not correct CSV encoding and forget to surround the key
"class,secondary,round" with "-signs, then this error gets detected at
client side and nothing is interpreted wrong. This may sound like a very
weak advantage, but IMHO the most danger with CSV comes to misinterpretion
of data because of coding errors (and CSV looks as simple that some could
try to write their own parsers..). I wanted a little layer of protection
against such things and I think using some redundancy in the scheme
achieve this best.
- Like the additional values to the first line, any client or server may
add arbitrary debug-data at the end of each line. This works only if the
property list is terminated. I think this debug information is a very good
thing in the beginning (at least until every coder found a good and stable
CSV implementation for its used language)
- Finally, as you mentioned, the implementation can be more performant if
the client knows the number of data entries before parsing them. I think
this is the least important advantage.
More information about the dev