Archive for the ‘Knowledge’ Category

Quick Algonquin Map with Garmin GPS and Google KML

We’ll I’ve been busy the last few weeks at work but I took a bit of time off and headed for the north end of Algonquin Park, North Tea Lake to be precise. While on my trip I nabbed my Dad’s old Garmin GPS unit and decided to see what I could come up with when I got back. Unfortunately, the particular model I had was a late 90’s version with little memory so it ran out of space on our return trip but I managed to get some fun data.

Searching the web, I came across this page that had a great list of Garmin related resources. I selected one of the FREE GPS apps which fortunately had an option to save as a Google KML file. Doing so I could just import that into a Google Map and volia, my trip for all to see.

I’ve clean up the KML file a bit as there were a bunch of waypoints and data from previous trips but it was pretty quick and dirty. I’m planning on writing a post over at GoogleMapsBook.com about using the Garmin GPS tracking and waypoint info to create a mashup (with the algonquin map) for your own site but until then, I thought posting my 5 minute tracking mashup might be interesting. Zoom in on the river at the start, it’s fun to look at.

The trip was great fun, I’ll post a few pictures sometime as well.

Rapid Web Development with the prototype library

While I work on tweaking the design of the site, I though I’d just write a quick opinion piece. I‘ve been experimenting with a variety of libraries lately to see what’s out there on the web. One bit of internet goodness I’ve been using a lot is Prototype, the JavaScript library made popular by Ruby on Rails and the AJAX boom several months ago. Prototype touts itself as:

a JavaScript framework that aims to ease development of dynamic web applications. Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for web application developers everywhere

But AJAX is far from the only thing that Prototype has going for it. It also provides a list of useful functions, the simplest (and my favorite) being the $() function to replace the document.getEementById() function - my keyboard is much happier! The downside is in the documentation. The doumentation is very lacking, almost non-existant, which is very annoying, but there are sites such as script.aculo.us that are picking up the slack and providing some informed documentation. A quick google search will also reveal a lot of working examples you can learn from as well.

Aside from what it has to offer, I was impressed by it’s ease of use and simplicity while working on a recent idea. At work, we were starting to use paper and pens to track the time we were spending on each project. As a growing company, we need to know this information so that we can better adjust our quotes and estimates, but the time spent writing and tracking the information became tedious after only one week. thinking about it on my commute home from work one day I had a better idea. Enter Prototype and a JavaScript app.

Starting from a quick sketch, I was able to create a working app using an XHTML/Prototype user interface and PHP server side base, in less than an hour. It relied on 100% AJAX communication but it was for my personal use anyways so it didn’t matter. Quick, fast, simple, clean code and anything else I could ask for. Now tracking time is as simple as typing in a task and hitting go. No more fumbling with paper and pens.

Time Tracker

If you haven’t tried prototype yet I highly suggest you do. You’ll be up and running in minutes!

GEvent order of events

One of the nice features of the Google Map’s API is that you can add your own event listeners to do things when certain events are triggered on the map. It’s quite easy to do using either the GEvent.addListener() or the GEvent.bind() methods, but tying to guess the exact order the events will trigger is a whole different story.

I was recently working on a project that required the map to fetch points within the viewport after it had been moved or dragged. This is easy enough to do by adding a listener for the moveEnd event and using the GXmlHttp object to query the server, but things didn’t go so smoothly once I started zooming the map in and out. When zooming out, the points that cam back were only within the original window at the previous zoom, not the new zoom. I tracked the problem down to the fact that the map triggers the moveEnd event prior to triggering the zoom event so my map was fetching point before the zoom!

I started to wonder just what the order of events where so I whipped up this little map to capture the order. Basically it’s just has an event listener for each possible event so just click, move and zoom to see what happens. It can be very enlightening to see just what events are triggered at which times. (Just for fun I’ve also included some of the undocumented events)

Check out the map

Content & imagery © Copyright 2007 by Jeffrey Sambells as appropriate.