distance

Generic Description

Computes point, distance, or containment helpers for location-aware values. It is documented separately because coordinate shape, distance units, and containment assumptions need to be visible in the query text.

Simple example:

RETURN distance(point({x: 0.0, y: 0.0}), point({x: 3.0, y: 4.0})) AS d

Consumer-Level Explanation

Use it when location math should stay visible next to graph filters and document payloads. Prefer this function when the location calculation is part of filtering, ranking, or audit evidence rather than display-only formatting.

More Detailed Explanation

distance should be understood by the value shape it expects and the row shape it returns. It composes with MATCH, WHERE, WITH, RETURN, and procedure output, so planner-facing documentation should describe both the immediate value transformation and why it belongs in the database query.

Advanced Example

This example uses distance inside a named row pipeline so the value shape is clear to both the planner and reviewers.

MATCH (r:Runner)
CALL nexyron.temporal_history(id(r), 'position', 0, 10000)
YIELD ts, value
WITH ts,
     point({latitude: value.lat, longitude: value.lon}) AS p
RETURN ts,
       distance(p, point({latitude: 48.8566, longitude: 2.3522})) AS meters_from_center
ORDER BY ts

Real Use Cases

Real Limitations And Tradeoffs