Hello, I`ve got a head ache because I do not know the purpose of bolded numbers in (for example) this line: way id="90669109" user="woodpeck" uid="5164" visible="true" version="1" changeset="6718705" timestamp="2010-12-20T18:52:24Z" nd ref="1052251551"/. There is no reference of it in the whole file. My job is to make xml code shorter so can anyone explain me the meaning of bolded numbers above?! Thanks a lot! asked 22 May '13, 08:52 iBus |
Take a look at your way here. A way in OSM consists of several nodes. The number 1052251551 is just the ID of one of the nodes belonging to your way, that's all. Your XML file probably only includes information about your way. In order to get information about each node of your way you have to download a similar XML file for each of the referenced nodes. This can be done for example by calling our API or by using an extract of the DB. The latter will be faster if you need more than a few calls and it will put less stress on the OSM servers. answered 22 May '13, 09:05 scai ♦ 1
It's not a good idea to encourage scraping of the API like this - better to use an extract that contains all the data. Resolving each referenced node could lead to tens of thousands of API requests.
(22 May '13, 10:06)
Andy Allan
1
Indeed. For most use cases using an extract is a better idea. I updated my answer.
(22 May '13, 10:19)
scai ♦
1
If there is only the example way and the XML was obtained from a http://www.openstreetmap.org/api/0.6/way/90669109 call then adding /full for http://www.openstreetmap.org/api/0.6/way/90669109/full will include the nodes for the way. But as above, if there are many ways/nodes, starting with an extract of the appropriate area would be better. (And no, I don't understand why the way is older than all the member nodes)
(22 May '13, 10:44)
EdLoach ♦
|
For what purpose do you want to make this XML file shorter?
(not a direct answer to the question but) if you're interested in making OSM XML files smaller you might want to consider PBF format. It stores exactly the same data, but the files take up less space. There are links at the bottom of that page to various language implementations.
Scai I'm working on "public transport solution" - the simpler the better. some part of code might be deleted - I'm trying to determine what is relevant and what is not.
@iBus Then maybe you should have asked a different question. If you are only interested in the actual data you can leave out most of the other attributes.