I'm very sorry to be asking this in public, but for some reason this is challenging me. I'm trying to output a couple of outlines, represented by routes, into a .gpx file which is basically XML. I don't think that really matters, I'm just trying to give some background for the fragment below.

I've got mean and standard deviation lat and long, accumulated using Welford's Method. I'm fairly happy with that bit, and they display OK using QGIS.

I can draw a rectangular or elliptical outline with edges corresponding to the standard deviation. However that leaves the area of the ellipse slightly smaller than that of the rectangle: to get a better visual approximation what fudge factor do I have to apply to boost the ellipse's area to that of the rectangle, and why?

WriteLn(gpx, ' <rte>');

WriteLn(gpx, ' <name>Cartesian standard deviation</name>');

x := meanLong + sigmaLong; y := meanLat + sigmaLat;

WriteLn(gpx, ' <rtept lat="', y:14:12, '" lon="', x:14:12, '"/>');

x := meanLong + sigmaLong; y := meanLat - sigmaLat;

WriteLn(gpx, ' <rtept lat="', y:14:12, '" lon="', x:14:12, '"/>');

x := meanLong - sigmaLong; y := meanLat - sigmaLat;

WriteLn(gpx, ' <rtept lat="', y:14:12, '" lon="', x:14:12, '"/>');

x := meanLong - sigmaLong; y := meanLat + sigmaLat;

WriteLn(gpx, ' <rtept lat="', y:14:12, '" lon="', x:14:12, '"/>');

x := meanLong + sigmaLong; y := meanLat + sigmaLat;

WriteLn(gpx, ' <rtept lat="', y:14:12, '" lon="', x:14:12, '"/>');

WriteLn(gpx, ' </rte>');

// As an approximation, I suppose that I could get the area of an ellipse

// using pi * minor_radius * major_radius, compare it with the area of

// the Cartesian standard deviation and introduce a fudge factor to draw an

// ellipse with the same area...

fudge := 1.0;

WriteLn(gpx, ' <rte>');

WriteLn(gpx, ' <name>Polar standard deviation</name>');

for i := 0 to 30 do begin

x := meanLong + sigmaLong * fudge * Cos(i * (2 * Pi / 30));

y := meanLat + sigmaLat * fudge * Sin(i * (2 * Pi / 30));

WriteLn(gpx, ' <rtept lat="', y:14:12, '" lon="', x:14:12, '"/>')

end;

WriteLn(gpx, ' </rte>');

MarkMLl