OpenStreetMap logo OpenStreetMap

Checking for changes to Long Distance Paths

Posted by SomeoneElse on 30 July 2021 in English. Last updated on 15 October 2021.

Lyke Wake Walk relation in OSM - ways and nodes

Previously I wrote about checking National Parks in Britain and Ireland for breakage, by counting the number of valid polygons in a rendering database.

A similar approach can also be used to check line features as well as polygons. It’s possible to count the number of contiguous sections of a given polygon. For example, here’s the Lyke Wake Walk, which is in one piece:

psql -d gis -c "SELECT count(*) FROM planet_osm_line WHERE (osm_id = '-1996318');"
(1 row)

and here is the Sabrina Way, which isn’t:

psql -d gis -c "SELECT count(*) FROM planet_osm_line WHERE (osm_id = '-537430');"
(1 row)

If something is changed in OSM that introduces an extra piece, or fixes a gap, that number will change. This script can be used to count the change in the number, like this:

Change in relation components for Sabrina_Way 537430
<     12
>     13

If run from cron it can check every day and will only send an email alert when the number changes.

If there is a change, and can be investigated with a site such as

Edit 2: Also useful is the answer to this help question that looks for modified ways that make up a relation.

Edit 1: Where this process falls down is where a very long-distance path is added a superrelation and there’s a gap between the relations, which is what this changeset was fixing. Here two long several relations make up two super-relations that share some of their route. For completeness, the edit that I was fixing that created a gap in the Cleveland Way was actually fixing a previous edit of mine that introduced an unwanted spur to E2 at this location.

Location: Stainton Hall Farm, Danby, North Yorkshire, England, YO21 2JH, United Kingdom


Log in to leave a comment