OSM XML — Intentionally Invalid: Way and Relation With Dangling References
Intentionally 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.
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Novus Examples geospatial fixtures">
<node id="-1" lat="47.064" lon="-12.482"/>
<node id="-2" lat="47.0812" lon="-12.451"/>
<way id="-101">
<nd ref="-1"/>
<nd ref="-2"/>
<nd ref="-9"/>
<tag k="highway" v="primary"/>
<tag k="name" v="Coast Road"/>
</way>
<relation id="-201">
<member type="way" ref="-101" role=""/>
<member type="way" ref="-999" role=""/>
<tag k="type" v="route"/>
</relation>
</osm>
Specifications
- Format
- OSM XML 0.6
- Nodes
- 2
- Ways
- 1
- Relations
- 1
- Dangling Node Refs
- 1
- Dangling Way Refs
- 1
- Valid
- false
- Defect
- intentionally invalid — references point at objects not present in the file
- Encoding
- UTF-8
- Line Endings
- LF
Testing contract
Expected to fail- Scenario
- Load the extract and build geometry from the way and the relation.
- Expected result
- Both dangling references are reported; the way either yields a two-node partial line or is skipped, and neither case fails silently with a geometry that looks complete.
What is a .osm file?
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 this 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.
How to use this file for testing
“OSM XML — Intentionally Invalid: Way and Relation With Dangling References” is a deterministic Novus Examples fixture for Geospatial, Error handling, Data import. GeoJSON, GPX, and KML files with points, lines, polygons, and tracks — for testing map tools, route parsers, and geo importers.
Documented properties for this file: 2 nodes · UTF-8 · LF · intentionally invalid. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.
Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.
Geospatial fixtures publish one invented territory across formats, with the coordinate reference system and feature counts documented in specs. Convert or reproject and diff against the twin in the same group; edge-case geometries state exactly which assumption they are built to break.
Related files
- mbtilesMBTiles — Structurally Valid Tileset With No TilesEvery required MBTiles table and metadata key, and not one tile row. This is what a failed or interrupted tile build actually produces, and it is the fixture that finds code which reports success because the file opened and the schema validated.

- nmeaNMEA 0183 — Bad Checksum and Truncated SentenceA log with one sentence whose checksum has been altered and a final sentence truncated mid-transmission with no checksum at all — the two ways a serial GPS feed actually degrades. A correct parser drops both and keeps everything else.

- nmeaNMEA 0183 — Receiver With No FixSix cycles of a receiver that has power but no satellite lock: GGA fix quality 0, RMC status V, and empty coordinate fields throughout. Parsers that split on commas and index positionally read these empty fields as zeros and plot the track at Null Island.

- gmlGML 2.1 — Legacy gml:coordinates With Custom SeparatorsGML 2.1 packed coordinates into a single `gml:coordinates` string whose decimal, coordinate and tuple separators are all declared as attributes and can be anything. GML 3 replaced it with `gml:posList`, but WFS 1.0 servers still emit this, and a parser that assumes the default separators mis-reads any file that changes them.

- gmlGML 3.2 — CRS84 srsName (longitude first)The same five towns as the territory GML twin, but declared with the CRS84 URN instead of the EPSG one — which flips the axis order to longitude first. The two files are otherwise identical in structure, so together they isolate axis-order handling from everything else.

- geojsonGeoJSON — Antimeridian Line Split per RFC 7946The same transect cut at the 180th meridian into a two-part MultiLineString, which is what RFC 7946 section 3.1.9 recommends. The split latitude is the linear interpolation of the unsplit twin, so the two files describe the same ground path.

Generated by generation/geospatial.py. Free for any use, no attribution required — license.