Skip to content

XML DTD check and documentation

Peter edited this page Aug 7, 2018 · 2 revisions

The main entry OSM's XML definition is Wiki/OSM_XML.

As showed by example.md there are a simple non-generalized DTD:

  osm  = bounds, (node|way|relation)+
  node = tag*
  way  = nd+, tag*
  relation =  member+ , tag*

PS: it is a simplified DTD notation based on formal RELAX_NG Compact_syntax... Used to fast expression in textual discussions, or to help UML building with yUML


Or including basic attributes:

[osm]<>--1[bounds]
[osm]<>--*[node|id]
[osm]<>--*[way|id]
[osm]<>--*[relation|id]
[relation]<>--1..*[member|idref]
[way]<>--2..*[nd|idref]
[node]<>--*[tag|k;v]
[way]<>--*[tag]
[relation]<>--*[tag]

See also GoJS as free (but ugly to build) alternative for yUML.

Example: https://www.openstreetmap.org/api/0.6/relation/1589323

<tag k="route" v="tram"/>
<tag k="type" v="route"/>

PS: something as the used of bigint (8 bytes integer) in the OSM ID representation is not documented.

<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.6' generator='JOSM'>
  < minlat='51.5076478723889' minlon='-0.127989783553507' maxlat='51.5077445145483' maxlon='-0.127774884645096' origin='OpenStreetMap server' />
  <node id='26821100' timestamp='2009-02-16T21:34:57+00:00' user='dankarran' visible='true' lat='51.5077286' lon='-0.1279688'>
    <tag k='created_by' v='Potlatch 0.10f' />
    <tag k='name' v='Nelson&apos;s Column' />
    <tag k='tourism' v='attraction' />
    <tag k='monument' v='statue' />
    <tag k='historic' v='monument' />
  </node>
  <node id='-1' visible='true' lat='51.507661490456606' lon='-0.1278000843634869' />
  <node id='346364767' action='delete' timestamp='2009-02-16T21:34:44+00:00' user='dankarran' visible='true' lat='51.5076698' lon='-0.1278143' />
</osm>

As explainded by API_v0.6/DTD the .osm format is an simple XML with elements .... But no bounds see JOSM_file_format

Validation

See answers about Wikidata question, and something more at JOSM/Validator.

Representation and dumps

The XML OSM represents Map Features...

When dumping ... As explained by Geofabrik Downloads, boundaries can "include a litte more of a neighbouring country", so there are some duplications to be checked.