marook / osm-read

an openstreetmap XML and PBF data parser for node.js and the browser
GNU Lesser General Public License v3.0
107 stars 25 forks source link

keep tag order (no reverse iteration) #27

Closed nrenner closed 10 years ago

nrenner commented 10 years ago

Iterate tags in regular instead of reverse order to keep tag ordering (where supported), e.g. pbf.html example: old:

way:      {... ,"tags":{"name":"üßé€","highway":"service","access":"private"}, ...
relation: {... ,"tags":{"type":"route","route":"bus","ref":"123","network":"VVW"}, ...

new (order as defined in test.xml/.pbf):

way:      {... ,"tags":{"access":"private","highway":"service","name":"üßé€"}, ...
relation: {... ,"tags":{"network":"VVW","ref":"123","route":"bus","type":"route"}, ...

@marook: Was there a reason to do a reverse iteration? It's not actually wrong as object keys are not guaranteed to be returned in the order added, but they usually are, so I don't see why not to keep that order.