What is a .osm file?
application/xml
An .osm file holds OpenStreetMap data in the project's XML schema. The document contains node, way, and relation elements, each with an id, version, and free-form tag children; ways reference their nodes in order, and relations reference members by type, id, and role. It is the format returned by the OSM API and by Overpass queries, and the input to most OSM-based routing and rendering toolchains.
How to use a .osm file
Use an example .osm file to test OSM parsers, tag filters, and routing-graph builders, checking that way node ordering is preserved, that relation roles are read, and that referenced ids missing from the extract are reported rather than skipped silently.
Download example .osm files
- Kestrel Bay Territory — OpenStreetMap XML TwinThe towns and roads in OSM XML: tagged nodes, three highway ways sharing the junction node at Kestrel Bay, and a route relation over them. All object IDs are negative — the convention for objects that have never been uploaded — so nothing here can be mistaken for real OSM data.
- OSM XML — Multipolygon Relation With Outer and Inner WaysWither Lake and its island as an OSM multipolygon relation: two closed ways tagged separately and joined by a relation whose members carry outer and inner roles. OSM has no polygon primitive at all, so reconstructing the hole means reading the relation rather than the ways.
- OSM XML — Intentionally Invalid: Way and Relation With Dangling ReferencesIntentionally invalid: a way referencing node -9 and a relation referencing way -999, neither of which is in the file. This is the normal state of a bounding-box extract, where objects are clipped at the boundary — so a reader has to decide between rejecting the file and building partial geometry, and must say which.