In reply to G4ISJ:
Not easily Pete.
The database stores stuff that you can’t “magic” out of other data.
So the chaser data stores the fact some user had a QSO with VK5CZ/P when he was on some summit on 09/Mar/2013,08:12 using 14MHz,CW and the callsign DL/PA0SKP/P
We JOIN up the summit with the summits data and find out all the info on the summit VK5CZ/P was on including the lat & long.
We JOIN the chaser data key with the s2s key to find out the summit id for DL/PA0SKP/P.
We JOIN that summit id with the summits to find all the info on the that summit including its lat & long.
We do that for every record in the S2S table for a user and then that nice ASP.NET framework pushes it into a datatable view.
Then for every row in the datatable we run down pulling out lat&long for each summit pair and calculate the Great Circle distance and insert that back into the datatable with this.
public static int GCDistance(Double slat1, Double slng1, Double slat2, Double slng2)
{
// we get bad data in some summits so catch any crap values
try
{
Double R = 6371.0;
Double lat1 = DegreeToRadian( slat1 );
Double lon1 = DegreeToRadian( slng1 );
Double lat2 = DegreeToRadian( slat2 );
Double lon2 = DegreeToRadian( slng2 );
Double dLat = lat2-lat1;
Double dLon = lon2-lon1;
Double a = Math.Sin(dLat/2) * Math.Sin(dLat/2) +
Math.Sin(dLon/2) * Math.Sin(dLon/2) * Math.Cos(lat1) * Math.Cos(lat2);
Double c = c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1-a));
return Convert.ToInt32( R * c);
}
// catch crap data with System.DBNull for lat, long etc.
catch (Exception ex)
{
return 0;
}
}
Then render to HTML and push it down the interweb tubes to your PC!
I was surprised how quick it runs on a shared machine. Damn fast these big multi-core Xeons
So the distances only exists in a transient fashion. The values don’t get saved. It’s not worth the effort as we can evaluate them so quickly.
But that makes “who has the biggest” harder to find.
Andy
MM0FMF