Navigation interchange
Grid 0.75.0 provides six native Rust readers in Standard (Lite), inherited by Pro. Core-only parser bindings do not expose these readers. They import existing navigation data into native…
Navigation interchange
Grid 0.75.0 provides six native Rust readers in Standard (Lite), inherited by Pro. Core-only parser bindings do not expose these readers. They import existing navigation data into native objects; they do not calculate a route, contact a routing service, or invent human instructions. A native Grid directions language is separate future work.
| Dialect | Entry point | Native projection |
|---|---|---|
| GPX 1.0 / 1.1 | gpx / PARSE_GPX(text) |
Ordered points, routes, tracks, segments; nodes and edges |
| OSRM Route API JSON | osrm / PARSE_OSRM(text) |
Routes, legs, ordered maneuver steps, waypoints, original document |
| Valhalla directions JSON | valhalla / PARSE_VALHALLA(text) |
Legs, ordered written/spoken maneuvers, original document |
| IndoorGML 1.0 core XML | indoorgml / PARSE_INDOORGML(text) |
States as nodes, transitions as edges, cell descriptors, source elements |
| ASAM OpenDRIVE 1.x XML | opendrive / PARSE_OPENDRIVE(text) |
Roads, lanes, geometry parameters, junction connections, topology graph |
| GTFS Schedule ZIP | PARSE_GTFS(bytes) |
All CSV tables, stops as nodes, consecutive trip stops as edges |
The five text tags support ordinary quotes, triple quotes and angle blocks
through the existing native parser binding. Names use existing case rules.
Ordinary quotes process Grid escapes; triple quotes and angle blocks preserve
payload text. XML containing its own closing tag—for example </gpx>—must use
quotes or triple quotes, because an angle literal closes at its first matching
terminator. No XML-aware delimiter changes are introduced.
journey = gpx"""<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="Grid">
<rte><name>Library walk</name>
<rtept lat="40" lon="-74"><desc>Start at the station.</desc></rtept>
<rtept lat="40.001" lon="-74"><desc>Enter the library.</desc></rtept>
</rte>
</gpx>"""
A parsed constant with nodes and edges can initialize a native graph:
graph walk = GRAPH(gpx"""<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="Grid">
<wpt lat="40" lon="-75"><name>Separate viewpoint</name></wpt>
<rte><rtept lat="40" lon="-74"/><rtept lat="40.001" lon="-74"/></rte>
</gpx>""")
places = walk.NODE_COUNT()
segments = walk.EDGE_COUNT()
This graph has three nodes and one edge, including the isolated viewpoint.
Text literals expand once at compilation and persist as native constants in
LIR. The parser binding is required for recompilation, not loading those
constants. Ordinary PARSE_* function calls execute when requested, like other
native functions. No parser discovery or edition selection is added per cell
or resolve. No additional engine, worker, file access or network service starts.
GTFS is binary: pass a flat array of integer bytes, each 0–255, to
PARSE_GTFS(zip_bytes). Rust callers use
grid_format_standard::binary::parse("PARSE_GTFS", bytes, context).
There is no gtfs"..." tag and no implicit filename, download or base64 decoding.
Exact profile boundaries
These are versioned structural import profiles (grid-<tag>-navigation-v1),
not complete validators for every feature of each external standard.
- GPX: requires a matching 1.0/1.1 namespace, version and creator. Validates waypoint coordinates, finite elevations and route/track/point placement. Points retain names, descriptions, raw timestamps and source-element IDs. Coordinate order is explicit latitude/longitude in EPSG:4326. Graph edges follow consecutive route points or consecutive points within one track segment; they never bridge track-segment gaps. Standalone waypoints and single-point segments remain nodes. Vendor extensions and metadata survive in the ordered XML element projection; vendor turn cues and timestamps are not interpreted. No speed, distance or road permissions are inferred.
- OSRM: accepts successful
code: "Ok"Route API responses, including alternative routes and empty step arrays. Checks nonnegative finite distances and durations, maneuver locations and bearings, and optional GeoJSON LineString coordinates. Distances are meters, durations seconds, coordinate arrays longitude/latitude. Encoded polyline strings remain encoded;encodedPolylinePrecisionis null because the response alone need not distinguish precision 5 from 6. The completedocumentpreserves fields not projected intoroutes,legs,stepsandwaypoints. OSRM maneuver type/modifier data does not itself supply a prose instruction: none is generated. Match/Table/Trip services and error responses are outside this reader's profile. - Valhalla: requires a successful
trip.status: 0, explicitmilesorkilometers, and legs with summaries and maneuver arrays. Converts length to finitedistanceMeters, preserving source units and original values.steps[].instructionretains authored text; the fullmaneuverobject keeps verbal instructions, signs and other fields. Checks nonnegative metrics and ordered begin/end shape indices. Encoded shapes are retained, not decoded; indices are not checked against decoded shape length. Locations, alternative responses and other unprojected fields remain indocument. The projection covers the top-level trip, not a flattened set of alternatives. - IndoorGML: matches namespace URIs, so author-chosen XML prefixes work.
Rejects duplicate
gml:idvalues. Each State remains a node, including isolates. Each Transition requires twoconnectsreferences; local#idreferences to States form an undirected edge. Unresolved/external references remain intransitionswithresolved: false, and produce no edge or fetch. Inline State endpoints, IndoorGML 2.x and navigation-extension semantics are outside the profile. Cell geometry, CRS, layers and source relationships are retained as XML records; geometry is not converted or assigned assumed axes. - OpenDRIVE: accepts an unnamespaced root and one 1.x version header;
rejects duplicate road/junction IDs, duplicate lane IDs within a lane
section, duplicate connection IDs within a junction, unknown road/junction
references and nonfinite geometry scalars. Lane IDs remain scoped to their
section.
documentElementsretains line/arc/spiral/polynomial parameters, lane links, signals, georeferencing and other source declarations. Road links and junction connections form undirected topology, withtopologyOnly: true; they are not a lane-level legal driving graph. Curve evaluation, coordinate conversion, simulation and full ASAM schema validation are separate. Newer direct-junction forms lackingconnectingRoadare rejected by this profile. - GTFS Schedule: reads a flat ZIP of UTF-8
.txtCSV files, with optional UTF-8 BOMs. CSV fields stay strings intables, preserving leading-zero IDs, quoted text and service-day hours beyond 24. Requires agency/stops/routes/ trips/stop_times plus calendar or calendar_dates. Validates primary IDs, core foreign keys, calendar dates/weekdays, stop coordinates, unique trip stop sequences and nondecreasing supplied times. Node coordinates are numeric; original strings remain in tables. Edges are ordered trip adjacency, withdurationSecondsonly where endpoint times are supplied. Unknown/additional tables and columns are retained; their schemas and references are not comprehensively validated. This profile requiresstop_idstop-time rows, so location-group/flex-only rows are rejected. Transfer/pathway/frequency data remains in source tables, not synthetic graph edges or expanded trips.scheduleEvaluated: falseexplicitly means calendars, time zones and frequencies have not been evaluated. This is not a timetable router or GTFS Realtime decoder.
All XML readers retain ordered elements and mixed content, plus attribute maps, not original XML bytes, comments or a round-trip exporter. Native literal provenance keeps authored source separately. XML DTDs are rejected. JSON readers retain the parsed document, with existing duplicate-key semantics. Input, expansion, record-count and depth limits use the shared parser context. GTFS additionally bounds aggregate decompressed bytes and rejects duplicate ZIP members and non-flat paths without extracting files. Cancellation is checked during construction; individual codec calls are not preemptible. Structural errors currently point to the payload start when no precise source offset is available.
Editor and verification
Tag/function completion and hover come from the same Rust declarations as native dispatch. Monaco embeds XML for GPX/IndoorGML/OpenDRIVE and JSON for OSRM/Valhalla, including unfinished raw literal payloads. Existing compiler validation supplies payload diagnostics when a Standard parser binding is available.
In a syntactically complete OSRM or Valhalla JSON object, completion uses the
enclosing response structure. For example, in an OSRM maneuver, replace
"bea" with "bearing_before". In an empty Valhalla trip object, select
units to insert an empty string, then choose miles or kilometers.
Completion omits keys already used by a sibling. Field hover explains coordinate
order, distance units, and maneuver indices. Unknown subtrees and duplicate
keys receive no route-specific choices. Incomplete JSON retains lexical
highlighting.
GPX offers the version matching the root namespace and hover for point latitude and longitude. In IndoorGML, follow a transition’s local fragment to its state, or replace the fragment with a state ID from the same literal. A base URI with a path, query, or authority leaves its endpoint unresolved. Grid retains the reference and omits that edge. An empty or fragment-only base keeps the inherited resource. The reader rejects duplicate namespace-equivalent identity or endpoint attributes. XML Base
OpenDRIVE offers road and junction IDs according to the referring attribute.
For example, elementType="junction" limits elementId choices to junctions.
An element inside vendor data stays in documentElements; it cannot introduce
a road, lane, geometry, junction connection, or graph edge. Both XML identity
profiles support go-to-definition and find-references. They preserve an
authored # and refuse rename. Endpoint choices use document-local IDs of up
to 256 bytes containing letters, digits, underscores, periods, colons or
hyphens. A target group larger than 256 retains navigation without a completion
list.
- Runnable text examples
- Parser tests and rejection cases
- Cross-layer persistence, function and graph tests
- Fixture inputs
- GTFS ZIP fixture
Tests are explicit local Testing operations. Per-format execution evidence is tracked separately from catalog registration.
Reference specifications: GPX, OSRM Route API, Valhalla directions, IndoorGML, ASAM OpenDRIVE, and GTFS Schedule.
On October 30, local verification passed eight parser tests, six language-service
checks, 13 editor wiring checks, and 1,020 real Monarch embedded cases. Six
runtime checks also passed, covering the corpus, GTFS dispatch and graph
persistence. The example test found two // comments; they were corrected to
#. Its retry was interrupted by concurrent cleanup of the shared Cargo target,
so the corrected example rerun remains unverified. See the
retained execution summary.