Lessons from Geotagging Project
Okay, so after bitching and complaining about how nobody presents location-related data on maps, I'm going to put my money where my mouth is.
The basic notion is simple. I typically carry a digital camera and a GPS unit on hikes and bike rides. The camera stamps each image with the date and time it was taken, and the GPS data can tell me where I was at that time. So, I put them together, and plot the location of each picture on my GPS maps. Click the icon, see the picture from that spot.
But getting all that data together has proven to be far more challenging than I thought.
Along the way, I learned a few things.
Parsing image EXIF data is a long, long way from straight-forward. Manufacturers pretty much do whatever they want. Hooray for Sanselan!
My camera is confused. It gets the time right, but the timezone wrong. I took a picture on October 27, 2007 at 1:31:28pm PDT. The timestamp reads:
2007-10-27T13:31:28-0400
The -0400 indicates a time zone of GMT-4, or EDT (or AST, really). (Yes, I have verified that I've set the camera to the correct timezone.) I'm going to try deleting all the timezone presets except my home setting, and see if that helps.
Old versions (and maybe new ones too) of Apache's "Crimson" XML
parsing code freak out if an element's xmlns attribute
isn't the first attribute listed. These old versions are included
with the Tomcat server I'm testing on. I'm hoping that installing the
latest Crimson code will fix this.
Time zones are a pain in the ass, even if you handle them correctly. If you handle them wrong, may God have mercy on your soul.
MySQL stores TIMESTAMP values in UTC, but converts them from the current time zone for storage, and converts them back to the current time zone for retrieval. Good to know.
Don't try to do heavy-duty calculation or recursion in XSL. It sucks. Just parse the file (see above reference to SAX) and do your work in a real language. It's more of a time investment, but you get so much for free that it's worth it.
My initial time estimate turned out to be radically short. In the end, unexpected bugs, necessary research, and trying to code while very tired nearly tripled the actual time it took to complete this. Remember: No one expects the Spanish Inquisition!
And that, in a nutshell, is why I do these projects. Actually building something like this leads you through territory you never considered.