How to calculate 'off track' error from GPS data?
I think Hausdorff distance may be what your looking for. It's basically a measure of how similar two geometries are.
General steps to apply it to this problem:
- Find the closest point on the track to beginning and end of each planned segment.
- divide the track into segments between these sets of points.
- Calculate the Hausdorff distance between the planned segment and the closest segment.
Your question said qgis, but the bounty says any FOSS solution, so im going for PostGIS:
SELECT ST_HausdorffDistance(
(SELECT geometry FROM segments WHERE fid=1),
ST_Line_Substring(geometry,
ST_Line_Locate_Point(geometry, (select st_pointn(geometry, 1) from segments)),
ST_Line_Locate_Point(geometry, (select st_pointn(geometry, ST_NPoints(geometry)) from segments))
)
)
FROM tracks WHERE ogc_fid=1
From the above example, I suggest that you
- Create points along the green lines at a regular interval
- Get the perpendicular distance from those points to the blue line and, finally,
- Compute the average error based on those distances.
Note that you could reject points that are too far (above a given tolerance for GPS worst precision) due to the absence of blue line in front of a green line (this does not happen on your drawing, but it could be an issue).
For the first and the second step, there are two excellent answers (both by gene) here for step 1 and here for step 2. The last step shouldn't be a problem for you (using postgis, or group stats plugin, or python...).
Alternatively, you can draw the perpendicular line for each end point of the green line. Then you build an area from you set of lines (e.g. with GRASS), then you divide your area by the length of the green lines => this gives you the average absolute error.