Jump to content

Geocache-GPX-Parser


ZeroOne

Recommended Posts

Greetings.

 

I wrote a little Java program to parse caches from Groundspeak .gpx files into Java objects and then into a tab-delimited text file. In this format it is easy to explore cache data in, say, a spreadsheet program. The program and its source code are available as an MIT-licensed Google Code project. You can either checkout the source and compile it with Apache Ant, or you can just download the pre-compiled .jar file and run it with "java -jar GeoGPXParser.jar somefile.gpx" or "java -jar GeoGPXParser.jar some/directory/with/gpx/files". The output is written into caches.txt into the directory in which you executed the program. Let me know what you think of the program. It was made for my own needs but I figured someone else might find it useful as well and thus decided to publish it. So far it only distinguishes between traditional caches, multi-caches and mystery caches, grouping all the rest into a category called "Other", but for my purposes this was enough.

Link to comment

This looked promising, but this is what I get:

 

C:\>java -jar GeoGPXParser.jar

Exception in thread "main" java.lang.UnsupportedClassVersionError: geogpxparser/

GeoGPXParser : Unsupported major.minor version 51.0

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(Unknown Source)

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.access$000(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

Could not find the main class: geogpxparser.GeoGPXParser. Program will exit.

 

C:\>java -version

java version "1.6.0_29"

Java SE Runtime Environment (build 1.6.0_29-b11)

Java HotSpot Client VM (build 20.4-b02, mixed mode, sharing)

Link to comment

Hey, thanks for trying out my program! :)

 

C:\>java -version

java version "1.6.0_29"

Java SE Runtime Environment (build 1.6.0_29-b11)

Java HotSpot Client VM (build 20.4-b02, mixed mode, sharing)[/font]

There's your problem: it's a Java 7 program. It is using some of those new tricks Java 7 provides and cannot be compiled or ran with Java 6, so you need to update your Java.

Link to comment

That seemed promising. I had to go to Oracle's website to get version 7 -- java.com doesn't host it yet.

 

This is what I am getting now:

 

C:\>java -jar GeoGPXParser.jar

Exception in thread "main" java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant

at java.lang.Class.getDeclaredMethods0(Native Method)

at java.lang.Class.privateGetDeclaredMethods(Unknown Source)

at java.lang.Class.getMethod0(Unknown Source)

at java.lang.Class.getMethod(Unknown Source)

at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)

at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

Caused by: java.lang.ClassNotFoundException: org.joda.time.ReadableInstant

at java.net.URLClassLoader$1.run(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 6 more

 

C:\>java -version

java version "1.7.0_01"

Java SE Runtime Environment (build 1.7.0_01-b08)

Java HotSpot Client VM (build 21.1-b02, mixed mode, sharing)

Link to comment

C:\>java -jar GeoGPXParser.jar

Exception in thread "main" java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant

Oh, well, my bad. It doesn't find the lib\joda-time-2.0.jar file. For me it's there so I didn't come across that problem, although it should be obvious... Sorry. So try this: get the new distribution package, unzip it and try to run it like before. Let me know how that works for you. :)

Link to comment

Hello again! I learned about these kind of challenge caches where you have to find three different types of caches from ten different cache owners, or something similar. It didn't occur to me how you could check this easily using just the geocaching.com site, so I improved my own program. :) Download your My Finds Pocket Query and input it to my program, and you'll get an owners.txt file out. Open that in your favorite spreadsheet program, and you'll get a nice list of cache owners along with information on how many caches are theirs and what types of caches have they hidden. :)

Edited by ZeroOne
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...