osm
osm copied to clipboard
How to create the OSM standard (XML) format?
The OSM standard (XML) format is described here: https://wiki.openstreetmap.org/wiki/OSM_XML
Example (OSM standard):
<way id="750000000000">
<nd ref="750000000000"/>
<nd ref="750000000001"/>
<nd ref="750000000002"/>
<nd ref="750000000003"/>
<nd ref="750000000000"/>
<tag k="ele" v="20"/>
<tag k="contour" v="elevation"/>
<tag k="contour_ext" v="elevation_minor"/>
<tag k="ed20" v="20"/>
<tag k="ed10" v="10"/>
</way>
The Golang standard XML encoder (xml.MarshalIndent(osmWay, " ", " ") leads to this:
<way id="750000000000" user="" uid="0" visible="true" version="0" changeset="0" timestamp="1970-01-01T00:00:00Z">
<nd ref="750000000000"></nd>
<nd ref="750000000001"></nd>
<nd ref="750000000002"></nd>
<nd ref="750000000003"></nd>
<nd ref="750000000000"></nd>
<tag k="ele" v="20"></tag>
<tag k="contour" v="elevation"></tag>
<tag k="contour_ext" v="elevation_minor"></tag>
<tag k="ed20" v="20"></tag>
<tag k="ed10" v="10"></tag>
</way>
Some tools (e.g. osmconvert) are not working with the Golang generated XML format.
Question: How can the 'problem' with addition closing XML tags be solved?