Kosmos/knowledge base

From OpenStreetMap Wiki
< Kosmos(Redirected from Kosmos knowledge base)
Jump to: navigation, search

This page should discribe some error reports of Kosmos and how to solve this.

An item with the same key has already been added

PC say:  System.ArgumentException: An item with the same key has already been added.
You say: What? What?

This mean some key has been added and later had been added again, where it is not allowed. For exmple a way where a node is followed by the same node. Or in this case a relation with a member and the same member again. Kosmos doesn't have a big support for relations. So I solved this problem by deleting all relation from the source osm-file. Search for the first "<relation" you can find in the file and delete all after that. Now a closing </osm> is missing. So write this at the end of file.

System.InvalidCharacterException: There is an error in XML document (xxxx, yy)

PC say:  Format exception: Input string was not in a correct format.. (yes, with two dots)
You say: €-[ †

After editing (deleting relations) the source file with Windows Notepad, the format (of the ASCII-code) was changed (to western european). The ü of "Brücke" and è of Cafè and ß of Straße causing errors in my Kosmos. First: The File must be in UTF-8-format to work correct. Try 'save as..' and select manually the format. xxxx is the line number and yy the position in this line where the invalid character is. There a two ways to solve this for the whole file:

  • UTF-8: Try 'save as..' and save in the correct format.
  • keep data: replacing these characters with another character. (edit -> replace -> ä by ae) This takes a loooong time.
  • quick and dirty: deleting all unwanted characters. (edit -> replace -> ä by none) Fast method.

Format exception: Input string was not in a correct format..

PC say:  Format exception: Input string was not in a correct format.. (yes, with two dots)
You say: These are ones and zeros. What is wrong with them?

This is very hard to find. I done that during the football game Germany-Austria. Again the data is dirty. You know there are no wrong keys and values in OSM. But there can be data, which confuse Kosmos. It can render elevation lines using the ele-tag and expecting a number. Now there is this wrong data ('footway' is not a valid number). This is the bad data:

<way id="4973133" timestamp="2007-11-11T14:57:13Z" user="c19">
  <nd ref="32950398"/>
  <nd ref="32950399"/>
  <tag k="created_by" v="Potlatch 0.5"/>
  <tag k="highway" v="footway"/>
  <tag k="foot" v="yes"/>
  <tag k="ele" v="footway"/>   <!-- There is the fault

How to locate the enemy?

  • Delete all relations. Try if the file is now working correctly.
  • Spare data in two files. This means scroll to the middle of the file, extract all content into a seperat file. Then try to load only the first, after that only the second file. One of them should produce an error. Repeat sparing the error-causing file into two (or more) files and load them seperatly. After some time (a football game for example) you found the bug in the file and can fix or delete it. Be kind and don't delete this just in the file you downloaded. Fix it in the OSM-Database.

Way '12345678' is missing

PC say:  System.Collections.Generic.KeyNotFoundException: Way '12345678' is missing.
You say: What? Who deleted my way???

This means a way referenced in a relation is missing in your file. JOSM does not download all members of a relation automatically (as of rev 669).

How can I solve this?

  • Delete all relations.
  • Edit all relations in JOSM and press the button Download members in the dialog.