How Linje builds a route
You give it a start and a distance. A few seconds later there are several rides to choose from, each one checked before you see it.
Linje draws rough shapes around your start, routes them on OpenStreetMap, measures what comes back and reshapes them until the length is right. Every ride is checked for its distance, for doubling back, for ferries and for hiking trails, and only the ones that pass are shown.
Watch a search
- 01You askA 40 km loop from Røa, on a gravel bike
- 02It sketches shapesTriangles, squares and pentagons, each turned a different way
- 03Routes them on real roadsEvery sketch goes to the routing engine at once
- 04Drops the bad onesFerries, doubling back, the wrong distance
- 05Reads the weatherWind, rain and the terrain, stretch by stretch
- 06Gives you the bestRanked, in a few seconds
Five real loops from Røa, routed through Linje's own server. The two failed sketches and the wind are examples.
1. Shapes around the start
For a loop, Linje draws a guide shape with three to five corners around where you start. Three corners make a sprawling loop and five a rounder one. Each candidate turns the shape to a different angle, so the rides head off in different directions rather than five versions of the same one.
Roads are not straight lines, so a shape whose straight edges add up to your distance would come back too long. The first guess is drawn smaller to allow for it: about 1.28 times smaller, which is how much longer than the straight line a ride on real roads tends to be.
An out and back heads one way and turns round at half the distance. An A to B goes to the place you pick, and a loop can be bent through a place on the way.
2. Routed on OpenStreetMap
The shape's corners go to BRouter, an open-source router, which finds a way through them on OpenStreetMap. Linje uses its own routing profile, which prefers gravel roads and graded tracks and steers away from paths graded for walkers. You can also ask for sealed roads only.
3. Measured and reshaped
What comes back is measured. If it is too long or too short, the shape is resized and routed again, until the ride is within 15% of the distance you asked for.
Dead ends are cut off. When a corner lands on a lane that goes nowhere, a router has to ride in and back out again, which leaves a whisker on the loop. A whisker is free distance, so without a check it would be the cheapest way to make a loop the right length. Linje removes it and accepts a ride that is honestly a little short instead.
4. The checks every ride has to pass
| Check | The rule |
|---|---|
| Distance | Within 25% of what you asked for, and never more than 10 km out. A 40 km request comes back between 30 and 50 km, and usually much closer |
| Doubling back | A loop or A to B that rides back over itself for more than 45% of its length is thrown away. Less than that still counts against it, so it sinks down the list |
| Ferries | A ride that crosses by ferry is thrown away. A ferry is a timetable and a ticket, not a stretch of road |
| Hiking trails | Paths graded for walkers are left out where there is another way. Where there is not, the ride is shown below every clean one and says so |
A path counts as graded for walkers when OpenStreetMap marks it as mountain hiking or harder on the SAC scale, as level 2 or more on the mountain bike scale, as very rough or worse, or as hard to see on the ground. If nothing in an area passes without one, Linje says so rather than quietly showing rides you would be pushing.
5. Several to choose from
Linje shows five rides by default. It tries a few more than that, because some are always thrown away by the checks above, and more again when you ask for sealed roads only. Rides appear as they pass, so the first is on the screen before the last is finished.
Loops are ranked on how close they are to the distance, how little they double back and how round they are. An A to B is ranked on the same first two and on how directly it gets there.
Questions
How does Linje make a cycling loop?
It draws shapes with three to five corners around your start, routes them on OpenStreetMap with the open-source BRouter engine, and reshapes them until the length is right. Each ride is then checked before it is shown.
Will Linje send me down hiking trails?
Not where there is another way. Paths graded for walkers are left out. If nothing in an area passes without one, Linje says so and shows those rides below every clean one.
How close is the distance to what I asked for?
Linje aims for within 15% and never shows a ride more than 25% or 10 km out. A 40 km request comes back between 30 and 50 km, and usually much closer.
Does Linje avoid ferries?
Yes. A ride that crosses by ferry is thrown away.
Sources
- OpenStreetMap, the map data every route is built on: openstreetmap.org
- BRouter, the open-source routing engine: brouter.de
- The SAC hiking scale and the mountain bike scale, as OpenStreetMap uses them: sac_scale and mtb:scale
Describes the app as of .
Where are you riding next?
Linje builds the ride, then works out when to leave and which way round. Join the waitlist for early access.

