Skip to content

Commit 2887482

Browse files
Document linear referencing concept for transportation (#424)
1 parent a921cb5 commit 2887482

2 files changed

Lines changed: 64 additions & 2 deletions

File tree

docs/schema/concepts/by-theme/transportation/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ properties:
6060
### Destinations
6161
The destination property in the `segment` feature type supports routing use cases. It describes the transitions from one segment to another on the way to a specified location. In turn-by-turn routing applications, this is what is known as “follow signs for” — the human-readable directions and signposts along a road, highway, or interstate that get us from point A to point Z, by way of any number of paths in between. We designed the `destinations` property with a flexible schema that will allow us to capture and model navigation data from many different sources.
6262

63-
### Linear referencing
64-
The `segment` feature type uses linear referencing to describe the properties of specific sections of a road along a road segment. To avoid splitting road segments at any and every property change, we added linear referencing, which defines how some properties apply to portions of a segment can change along a segment that is generally understood to be the same 'road'. Segment splits are then reserved for more significant intersections so that we don't have to version the entire road any time any piece of the road changes. Other than some expected challenges learning how Linear Referencing worked, we noticed that the main difficulty really arises is when people want to convert the transportation data into a routing graph. Many routing engines want the data to be split at every 'decision point' where each decision is what amounts to a connector between segments the routing engine would consider routing on (e.g. vehicle routing would eliminate sidewalks). However that decision of what segments would be considered for routing someone varies significantly by application, even within similar 'types' of routing, so we could not identify a common subset of splitting rules that would meet all or even most of the various use cases of the members, much less the community at large.
63+
### [Linear referencing](/schema/concepts/by-theme/transportation/linear-referencing)
64+
The `segment` feature type uses linear referencing to describe the properties of specific sections of a road along a road segment. To avoid splitting road segments at any and every property change, we added linear referencing, which defines how properties that apply to portions of a segment can vary along that segment while it is generally understood to be the same 'road'. Segment splits are then reserved for more significant intersections so that we don't have to version the entire road any time any piece of the road changes. Other than some expected challenges learning how linear referencing worked, we noticed that the main difficulty really arises when people want to convert the transportation data into a routing graph. Many routing engines want the data to be split at every 'decision point' where each decision is what amounts to a connector between segments the routing engine would consider routing on (e.g. vehicle routing would eliminate sidewalks). However that decision of what segments would be considered for routing varies significantly by application, even within similar 'types' of routing, so we could not identify a common subset of splitting rules that would meet all or even most of the various use cases of the members, much less the community at large.
6565

6666
### [Scoped and rule-based properties](/schema/concepts/scoping-rules)
6767
The schema allows the values of properties to be specified at the sub-feature level. For example:
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Linear referencing
3+
---
4+
5+
Linear referencing allows properties to apply to portions of a segment without splitting the geometry. This promotes shape stability and reduces versioning when only part of a road changes.
6+
7+
## Linear reference values
8+
9+
A linear reference is a **normalized position** from `0.0` (start of segment) to `1.0` (end of segment).
10+
11+
## `at` vs `between`
12+
13+
| Property | Purpose | Example |
14+
|----------|---------|---------|
15+
| `at` | Single point location | `at: 0.3` — 30% along segment |
16+
| `between` | Range along segment | `between: [0.2, 0.7]` — 20% to 70% |
17+
18+
When `between` is not provided (or is null), the attribute applies to the full segment.
19+
20+
## Calculation method
21+
22+
Overture computes linear references using **WGS84 geodetic distance** in meters:
23+
24+
```
25+
linear_ref = geodetic_distance_along_segment_from_start / total_geodetic_length
26+
```
27+
28+
Both distances must be computed on the WGS84 ellipsoid—not planar distance on raw lon/lat coordinates. Other approaches exist (e.g., projected coordinates), but geodetic distance provides consistent accuracy globally.
29+
30+
### Examples
31+
32+
**Apache Sedona (SQL):**
33+
34+
```sql
35+
SELECT ST_LENGTHSPHEROID(ST_GEOMFROMWKB(geometry)) AS segment_length_m
36+
FROM segments;
37+
```
38+
39+
**pyproj (Python):**
40+
41+
```python
42+
from pyproj import Geod
43+
from shapely import wkb
44+
45+
geod = Geod(ellps="WGS84")
46+
line_geometry = wkb.loads(geometry) # geometry is WKB bytes
47+
segment_length = geod.geometry_length(line_geometry) # meters
48+
```
49+
50+
See the [transportation-splitter](https://github.com/OvertureMaps/transportation-splitter) for a complete implementation.
51+
52+
**Warning:** Functions like `ST_LINELOCATEPOINT` can produce incorrect results on geometries that cross over or near themselves in 2D (curved on-ramps, mountain switchbacks, cul-de-sacs). These functions may pick the wrong location when the line passes over or close to itself—even though the geometry is valid because crossings occur at different elevations or positions along the segment. Note that Overture [disallows self-intersecting segments](/schema/concepts/by-theme/transportation/shape-connectivity#loops) in its own data.
53+
54+
## Why geodetic distance matters
55+
56+
Using planar distance (treating lon/lat as Cartesian x/y) can produce incorrect linear references, especially at high latitudes or for long segments. For a 10 km east-west segment at 60°N latitude, planar calculations can underestimate length by ~50%. Some map projections (e.g., EPSG:3857) yield reasonable results for short, straight segments, but accuracy degrades with segment length and curvature.
57+
58+
If a consumer calculates linear references differently than Overture, attribution or connector positions may be misaligned—potentially causing visual discrepancies on rendered maps or routing failures.
59+
60+
## Edge cases
61+
62+
For very short segments (< 1m), floating-point precision may be limited. Treat `at ≈ 0.0` or `at ≈ 1.0` as equivalent to endpoints. When a connector doesn't fall exactly on the geometry, the linear reference corresponds to the closest point on the segment.

0 commit comments

Comments
 (0)