Introduction

The code to produce the overview of the walks on open Street map can seem very daunting at first. However, it is relatively straightforward but a lot of thought and knowledge has gone into creating the code as it now stands.

The aim of this documentation is to give an overview of how that code works and the thinking behind various aspects of it. Program code is an abstract model of the real world but in this instance we trying to produce something visual and I found it helpful to picture what is going on in the real world and so hopefully images here will aid understanding of what the code is trying to achieve.

Segmentation

The basic process is to break each walk down into a number of segments where each segment is a part that is shared by other walks. At a point where another walk joins or leaves the root then that segment is split and it is replaced by two new segments. In the displayed map, if for example, a segment is walked by three walks then that segment is displayed three times each with a different colour matching a walk and with a dash pattern such that it appears to be a stripey coloured line.

Routes meeting

In order to be able to identify where a segment starts we need to identify where two routes coincide. This is explained in some detail and is more complex than might initially appear.

Routes merging

Just because two routes have a point in common they aren’t necessarily following the same path, for instance they may be crossing. Determining whether they do in fact follow the same path is the most complex part of the process. It also involves some judgement. If the length of the segment is short then it can be ignored. Short segments can’t show the dashed result and the worst that happens is that they display as solid lines and mask the routes displayed underneath them.