# Midline Analysis

Midline analyses use the distance along a line instead of the straight line distances between locations.

## Contents

## Creating a midline file

The midline file which is used to defined the potential routes between locations needs to be a Ranges vector line file. At its simplest it could be a single line. If it represents a river the coordinates should be arranged going upstream. For a network, such as a river system, secondary (or higher order) branches should be represented as other, later lines in the file, and their first point should be one of the points from the primary line (or one of the other lines that is of a lower order). This is to ensure that the network joins up. For a simple example see the file */fish/midline.vel*. One way to create such a file from scratch is to use the Ranges on-screen digitising tool to draw up the middle of a scanned river image from a map or aerial photo.

## How does Ranges calculate midline distances ?

For each of a pair of locations Ranges finds the closest line within the midline file, and calculates the shortest (perpendicular) distance to the line. The distance along the midline between these two points is then added to the two perpendicular distances. Where there is more than one potential route between two points in the network Ranges will attempt to find the shortest route (making the assumption that the individual is most likely to have taken the shortest route). For a simple river network with no islands or braiding there will just be one potential route. Ranges can cope with islands and braiding, however it may fail if confronted with a more complex network such as one that might be generated from a large system of hedgerows.

## Midline inter-location measures

This option can be used to calculate the distances and speeds between locations along the midline. The *headings* option is not available for midline analyses, and the *times* option will give the same results as conventional inter-location measures. The distance calculation produces a file called *temp_paths.edg* in the ranges folder, which contains the path used to calculate the distance between each pair of locations. The statistics (csv) output file for distances contains the total distance between each pair of locations, and then the number of linear sections, the length of each with positive values indicating upstream and negative downstream (assuming that the lines were input with the coordinates going upstream). There is an option (**link midline to locations**) to include the perpendicular sections from the location on to the midline.

## Midline linear ranges

The midline linear range is a line or group of lines which extends to the furthest locations for that range, it will be a subsection of the midline file. It produces an edge file (*.edg*) containing these linear ranges, and a statistics file (*.csv*) which stores their lengths. There is an option (**link midline to locations**) to include the perpendicular sections from the location on to the midline.

## Midline cluster analysis

A problem with trying to calculate the home range areas of fish within a river, is that if the river bends, the home range estimate may end up including areas of the bank which the fish has not used. Cluster analysis creates groups of locations that are close to each other and then puts a polygon around these. The rational behind using midline distances, was that locations that were close together as the crow flies but not as the fish swims (e.g. locations either side of the neck of an oxbow) were less likely to end up in the same group. Initial investigations have shown that conventional (Euclidean) cluster analysis can produce good estimates of fish home ranges with relatively little bank included, and that midline cluster analysis produces little improvement. However it is possible that midline cluster analysis may prove useful in other systems, so we have included it her in case you wish to investigate.