Skip to content
Novus Examples
osm513 B

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.

Preview — first 18 linesosm
<?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.

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