The macro I use for the stats created an SQL database, and a good portion of the stats is calculated from the resulting SQL.
Originally Posted by benandtina
However, for this I just made a macro using GSAK's GetNear function. It cycles through each cache and enters the coordinates into the GetNear function and the result is a delimited string which includes the distance to the 2 nearest caches (the first nearest is the cache I am checking the distance to). This is the simple macro:
I might try using my stats SQL database at a later time, I knew this would work and it was quick to write. GSAK is migrating to a full SQL database in the near future which will make a lot of this much easier.
$Data = getnear($d_latitude + " " + $d_Longitude, "M", 2)
$Distance = Extract($Data, ";", 7)
$d_User2 = $Distance
The hardest part I have about using SQL is efficiently getting the distances to the nearest caches using only the coordinates. In order to do this you currently have to calculate the distances from each cache 4534 times (the number of available caches in the state in my DB). That is over 2 million distance calculations! But I am open to any ideas!
While we're talking math, if you or anyone else can come up with a better formula for me to predict the "Future Milestone Date Predictions" section of my stats I'd be all ears. I know little about how to calculate predictions, my 10 second lame formula is
I'm not even sure I remember what that code does! But IIRC it puts more emphasis on the average number of caches placed per day in the last year than it does the average for all time.
$PredictedCachesPerDay = (($TotalCaches/(DateDiff($DateFirst,$DateToday))) + ($LastYearTotal/(DateDiff($OneYearAgo,$DateToday))*2))/3
I then take and calculate at what date at the calculated rate per day will occur.