Sunday, April 02, 2006

IceBurn's Lair - Tim's GMapper

location based services


DIGG EFFECT!
Sorry about my crappy bandwidth... i guess if you can read this you're just lucky :-) 03.28.06
If you just want so the end result, click on one of the links below (if you haven't tried GMaps 'hybrid' you might try that as well), if you want to know more about the 'how' part, read on.

Examples
PKI
UNO
DC (night)
DC (day)


The concept of MetaData (loosely defined as data about data - notwithstanding the semantic argument of data vs information) has existed for quite some time. Not long ago I discovered that Exif (data about pictures) had a field for GPS coordinates. So I set on my quest to figure out what these fields could be used for...or more accurately what actually used these fields.



My search was not particularly fruitful (if you have better luck, let me know) and only came up with a 'low-quality' (3 Mega Pixel) Ricoh with an add in Compact Flash GPS that sticks somewhat awkwardly out of the bottom of the Camera, a similar Pentax and a handful of Nikon 'high-end' digial SLRs. Recently Nikon started shipping an 'entry level' prosumer camera called the D200, which joins the D1H, D1X, and D2X as cameras that support GPS input. Nikon also offers a GPS cable for about $50-99 USD.


For some reason I really wanted to find some data that Canon also supported GPS input, but could not find any confirmation of this anywhere (again if this is inaccurate, let me know).

Further reasearch led to Red Hen Systems who makes an adapter for Garmin GPS' to mount right on the Hot Shoe ontop of the camera. This takes the place of the Nikon Cable, and keeps you from having to tote the GPS around seperately. Unfortuately this does not power the GPS unit itself, so you'll have to unmount and change the batteries in the GPS when needed. If interested call them up, they're realy nice people.

I finally decided on the Nikon D200 for a number of reasons, and so far really like it. The tagging of GPS data into the Exif of each picture is a really nice novelty for me but has obvious applications like Civil Surveying and Military Applications. I would like to have a nice section here about all the complicated things I did to get the GPS data to sync with the camera and how to get the camera to embed the data into the Exif, but the setup I picked (D200, D2x-GPS, Geko 301) just plain worked(tm). Didn't have to change a setting much less make a cable or anything.

The Sales folks as Red Hen informated me that the adapter would come with some sort of mapping software, and when it didn't I called them up and was informed that it's 'not quite ready' and they'd email be about beta testing (evidently the sales teams information didn't quite jive with the software team). So I set out to create my own, and as it turns out, with only a Image::ExifTool, the Google Maps API and a little over a hundred lines of PERL, I have a script that given a directory of images, will creat the GMaps htm, the associated XML for the GPS points and extract thumbnails from the picutres themselves. All that's left is to upload everything to a web directory!

GeoCaching has been around for some time, what makes this intersting is that it's done automatically with metadata. AutoGeoCaching?

Source Code:
You can download GMapper.zip which is the perl used to create the xml, and the php/html used to display/parse it.

Available by request, the Blue Icons(1-99) I use on my GMaps. If anyone has a lightweight way to have a generic blank icon and overlay the number on top (instead of unique graphics for each number), I'd be very interested.

To Do:

Figure out why my thumbnails have black bands at the top/bottom
Add id's to each google marker (ie A,B,C etc)
Have the map initially 'auto-zoom' to the relavent area
Create Marking graphics from 26-100 (or find a way to auto overlay the number onto a blank marker)
Add more information (sat accuracy / time taken) to the message box for each thumbnail
Log:
2006.03.09 - Initially put page up promised source 'soon'
2006.03.23 - changed to PHP, added 'debug' POST variable, reformatted the page, numbered markers...
2006.03.24 - finally posted some source code
2006.03.26 - post a zip of the blue icons I use for my markers and updated version of GMap.php (IE icon numbering bug)

No comments: