The speed bumps, stop and give way signs and railway crossings Triple Caution calls come from OpenStreetMap. This is how we make that database, so anyone can make it again.

Where it comes from

OpenStreetMap’s data for the whole world, as the planet file OpenStreetMap publishes every week (planet-YYMMDD.osm.pbf). We take a new one about once a month.

The data is © OpenStreetMap contributors and available under the Open Database License 1.0 (ODbL). The database we make from it is available under the same licence.

How it is made

1. The roads

Keep the ways a car drives on, with their nodes: highway is motorway, motorway_link, trunk, trunk_link, primary, primary_link, secondary, secondary_link, tertiary, tertiary_link, unclassified, residential, living_street, service or road.

2. The points on them

Of the nodes of those roads, keep:

A point that isn’t on one of those roads is left out.

3. Which way a sign is for

A stop or give way sign is for the traffic going one way. A junction here is a node two or more of the roads above share.

That way is kept as a compass bearing: the direction of the road at the sign, towards the next node the traffic drives to.

4. The files

Each point takes 10 bytes, little-endian: its latitude and longitude as 32-bit integers in millionths of a degree, its kind as one byte (0 speed bump, 1 stop, 2 give way, 3 railway crossing) and the way it is for as one byte, in 2-degree steps clockwise from north, or 255 for every way. Points with the same place, kind and way are kept once.

The points are cut into squares of one degree, one file each, named by the square’s south-west corner in whole degrees (50_4: 50° to 51° north, 4° to 5° east), each sorted by latitude. An index lists every square that has points, with how many, and the planet file they were made from.

Tools and updates

We do steps 1 and 2 with osmium and steps 3 and 4 with a short program of our own. Any OpenStreetMap tool that filters by tag finds the same points.

We make the squares again from a newer planet file about once a month; the app fetches a square again the next time a route passes through it. Questions? Email info@triplecaution.app.