Is it possible to add barriers in Nearest?

Document type: Tech doc  
Associated product(s): Product name: Nearest
Views: 68  |  Created: 2 years agoLast updated: 2 years ago

Normally Nearest searches for targets as the crow flies. However this is not always convenient if there is a major river, estuary or mountain range in to cross in order to go to the nearest target.

To improve the searching of Nearest, boundaries have been added in the form of vectors (a line between two points). Nearest will never cross one of these vectors, preferring to cross the boundary at an approved crossing point.

Adding Nearest Barriers

To quote from the Nearest Manual:

“A good example of a barrier is an estuary. For Instance, the distance from Cardiff to Weston-super-Mare is less than 20 miles. But, in practice, to travel from Cardiff to Weston-super-Mare involves a journey around the River Severn estuary or over the Severn Bridge many miles up river.

So, to make distances that Nearest calculates more realistic, you can have the Barriers facility enabled.”

Example

Barriers are defined by settings in the Nearest.ini file, an example of which is shown below:

NearestBarriers=Yes

+ 292600 685500 1 312200 680300 1 ; Firth of Forth

+ 312600 679600 1 466600 713700 0

The diagram below explains these ini file settings.

In this example, the Firth of Forth barrier is represented simply as two straight lines. These lines are described by the OS grid reference of their extremities. (N.B. Grid references must be Ordnance Survey National Grid version to be interpreted correctly by Nearest). The space between these two lines represents the bridge over the Firth of Forth.

The grid reference corresponding to the extremity of each line is labelled as either ‘1’ or ‘0’ in the .ini file. A point labelled ‘1’ denotes that it is possible to pass through or around a barrier at this extremity. Conversely a point labelled ‘0’ denotes that it is not possible to pass through or around a barrier at this extremity.

Hence, in the above example, because it is possible to pass around the barrier at the point (292600, 685500), it is labelled ‘1’ in the ini file. Likewise because it is also possible to pass through the barrier between points (312200, 680300) and (312600, 679600), these points are also labelled ‘1’ in the ini file. However, the point (466600, 713700) is labelled ‘0’ as it is a long way out to sea and cannot be passed around (this point is not labelled on the above diagram).

Other barriers can be added where required by making further amendments to the .ini file as described above. Appropriate grid references can be chosen from OS approved sources such as http://www.streetmap.co.uk/.

Was this document helpful?

What can we do to improve this information?