Mike Cochrane

6 Surf Lifeguards Live Tracker

6 Surf Lifeguards Live Tracker

Over the past 34 days, 6 Surf Lifeguards have completed the first complete circumnavigation of New Zealand in Inflatable Rescue Boats (IRBs).

Back in December I bumped into team member Ash Matuschka at a Mercury engine maintenance. I'd already checkout out the website and it mentioned live tracking, so I had to ask how it as going to be done - it turned out that hadn't been fully resolved and I got invited to a meeting with Kordia. Kordia were providing AIS tracking systems for the boats.

Kordia were providing access to their nation wide AIS tracking system so the support team could track the boats in Google Earth. This was great as both the boats had AIS trackers on them. There was one problem - Kordia had no API's to a pull the data.

During some downtime I fired up Charles and looked at the authentication and request flow for their Google Earth based viewer. A quick proof of concept in PHP showed I could authenticate and pull the latest KMZ, extra the KML, parse the XML and get the location of all the vessels we were able to track. Game on!

A cron job later and I was recording where the boats were - at this stage just one of the Interislander Ferries that Kordia gave us access to for testing. Then a simple Google maps page and we could see where the ferry was.

Add a trail behind the boat, some cool direction boat icons that Surf Life Saving New Zealand rustled up, the planned route from the chart plotter, all the patrolled beaches in New Zealand, some tweets and we had the Six Surf Life Guards live tracker up and running.

Day 1

Track

After a huge day the guys are already back at Muriwai! While here we put some extra tracking gear on the lead boat so we didn't have so many blind spot issues. Some quick coding later and we're now pulling location from two sources and merging as appropriate.

Day 5

Track - Visitor Stats

Day 5 and had no idea how many people were really viewing the site and what they were doing. So I started tracking browsers with cookies and created a new stats page (http://6surflifeguards.mikenz.geek.nz/stats/) for the team to check the stats during the day.

Day 8

Track - Visitor Stats

When the support team tweeted that they were on the Bluebridge ferry heading to the South Island, I couldn't resist but to add them to the map too. This was the only time we were live tracking both the IRBs and the support team - much to the amusement of a few visitors.

Day 20

Track - Visitor Stats

The New Zealand Hearld embedded the live tracker on their website: http://www.nzherald.co.nz/nz/news/article.cfm?c_id=1&objectid=10701743. Unfortunately they squished it a bit narrow, and they didn't push it hard so it only caused a small increase in traffic.

Day 32

Track - Visitor Stats

After a perfect record so far of switching off the tracking gear when they arrived - it was left on. I got a txt from the support team when they noticed, and sure enough the boat had become amphibious and driven all they way to their the team's accommodation for the night. A few SQL delete queries and the boat was now back where it should have been.

Day 34

Track - Visitor Stats

The boys make it back to Auckland. It was great to be one of the many IRBs that greeted them off North Head to escort them in. Joined by the Coast Guard, Harbour Master, Mercury we made our way into the Viaduct with "best speed" permission. We were meet by the harbour tugs with their water canons running at the entry. It was an awesome way to see the guys back in.

Stats

Official(ish) Stats
2 boats, 6 (7 really) Surf Lifeguards, 5,200km, 34 days, 1 flip, 1 destroyed hull
Tracking Stats
52,000 browser sessions (approximately equal to visitors), 5,352 tracking points, 702 lines of PHP code (yep, that's all), 1 little VPS to host it all

It was a great adventure, thanks guys for the opportunity to be a last minute addition to the support crew - even if remotely most of the time.

Sprit of Adventure Trust, the offer is always still open if you want your own version no one replied to my emails offering.

Tags: php5gpslive trackingsix surf lifeguardstrackingaistracplus