Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create the OSM standard (XML) format? #60

Open
Klaus-Tockloth opened this issue Aug 14, 2024 · 2 comments
Open

How to create the OSM standard (XML) format? #60

Klaus-Tockloth opened this issue Aug 14, 2024 · 2 comments

Comments

@Klaus-Tockloth
Copy link

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?

@simonpoole
Copy link

While @paulmach might want to accommodate this in any case, the tool in question (osmconvert) is broken, and any standard compliant XML parser should be parsing both variants.

@tomhughes
Copy link

But really, stop using osmconvert... It's ancient, unmaintained and is there anything it can do that osmium can't?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants