Jump to content

Findstats And Groundspeak Xml


Recommended Posts

Because the new revision of fizzymagic's findstats program calculates the "centroid" of one's finds, I got an idea. For fun, I would like to calculate the centroid of my finds as it evolved with time. It would also be amusing to see if and how the centroids of cachers who do or don't cache together converge (or not). Useless? Sure, but fun to play with anyways.

 

So I started to look into scripting. This is the idea (pseudocode):

 

- take the allfinds PQ, read it into a hash table

loop {

- determine (next) most recent day with log entries (via sort)

- write the (pruned) hash table back to gpx/xml

- run findstats and parse its output

- store centroid for the most recent day

- remove all entries from the hash table for caches that were found on the most recent day

} as long as there are entries in the hash table

 

The result would be a table containing all days for which there were any logs, and the associated centroids.

 

Although I'm comfortable with scripting (Perl) I didn't get very far. I have no trouble reading in the AFPQ via XML::Simple, also the data manipulations are no problem, but when I try to write it back to a gpx/xml file, findstats aborts with a generic "This program has terminated..." error message. This happens whether or not I did anything to change the data, i.e. a simple

 

$href = XMLIn('filename', ...);

$xml = XMLOut($href, ...);

print $xml;

 

will result in XML that findstats can't successfully read. There are options that can be passed to XMLIn() and XMLOut(), but I'm flying blind on what's appropriate there.

 

So here are my questions:

- Is this something that could be done with the existing findstats (e.g. does it allow command line switches restricting dates)?

- Where do I learn (gently) about the Groundspeak xml schema so that I have a better idea what happens when I read in/write out gpx files?

 

Thanks.

Link to comment
So here are my questions:

- Is this something that could be done with the existing findstats (e.g. does it allow command line switches restricting dates)?

- Where do I learn (gently) about the Groundspeak xml schema so that I have a better idea what happens when I read in/write out gpx files?

 

It's not entirely clear to me why you need to write an XML file, but generally when I do it from Perl I just do it by hand instead of using an XML parser.

 

In my opinion, XML::Twig is the best Perl-based XML parsing interface; it's a lot easier to use than XML::Simple.

 

While FindStats does not have any command line switches (I try to keep things simple for people), the source code (in C++) is available and you could pretty easily modify it as you have described. Give me till tonight to put up the newest source code and grab it then.

Edited by fizzymagic
Link to comment

It's not entirely clear to me why you need to write an XML file,

I need an updated XML file to pass to findstats as an argument, I haven't found another way to interact with findstats. The idea was to generate a series of successively shorter versions of the AFPQ -- what it would have looked like had I downloaded it yesterday/the day before/before I logged my recent finds. I could bypass findstats and calculate the centroid myself, but then I'd need to import the respective functions for distance calculations from somewhere, or implement them myself -- something I hoped to avoid.

 

In my opinion, XML::Twig is the best Perl-based XML parsing interface; it's a lot easier to use than XML::Simple.

Thanks, I'll look into that.

 

While FindStats does not have any command line switches (I try to keep things simple for people), the source code (in C++) is available and you could pretty easily modify it as you have described. Give me till tonight to put up the newest source code and grab it then.

Thanks for that, I'll take a look. Be aware though that this is going to get you more ignorant questions, beginning with where one'd get a compiler for it. I will go and see how far I can understand it.

 

Thanks for the quick response.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...