Tide Times

October 29th, 2009

Over the past few months I’ve been putting together a Tide Times website. Basically it scrapes the tidal prediction pages for 56 locations around the UK from the Proudman Oceanographic Laboratory website (with their permission) and extracts the predictions for the next 28 days into a database.

Originally I simply plotted all 56 points on a Google Map. There was a minor detour while I had to manually correct a few markers which had similar names in the United States, but on the whole it worked fairly easily.  Simply click on any of the markers to show the tide times for today’s date, and that was it.

From there it was an hour’s work to create a template page which would display the day’s tides for any of the 56 locations, and to add a calendar arrangement allowing a user to check the tides for an upcoming date as well. A simple RewriteRule allowed me to present 56 different pages to Google and some basic SEO ensured the pages ranked quite well.

Tidal predictions are available for Aberdeen, Avonmouth, Bangor, Barmouth, Blackpool, Bournemuoth, Cobh, Cromer, Devonport, Donaghadee, Dover, Dublin, Felixstowe, Fishguard, Formby, Harwich, Heysham, Hilbre Island, Hinkley, Holyhead, Ilfracombe, Immingham, Kinlochbervie, Leith, Lerwick, Limerick, Liverpool, Llandudno, Londonderry, Lowestoft, Millford Haven, Millport, Moray Firth, Mumbles, Newhaven, Newlyn, Newport, North Shields, Port Ellen, Port Erin, Portpatrick, Portrush, Portsmouth, Rosslare, Sheerness, Sligo, Southport, St. Helier, St. Mary’s, Stornoway, Tobermory, Ullapool, Weymouth, Whitby, Wick and Workington.

I decided, as well, to employ Twitter to spread the word, manually creating 56 accounts to allow people to follow an individual port.  Next I created a cron job that ran for two hours early every morning, tweeting the day’s tides for each port to the relevant Twitter account.

There were a few niggles, such as an incorrect username causing the process to fail at a certain port in the list – the script would retry the same port over and over and leave those following it unchanged.  Thankfully it was near the end of the list (Ullapool I think) and I spotted this one after a few days, so there wasn’t too much damage.

Another problem that cropped up was in the parsing of the scraped pages – if a tide was over 10m then the first digit would be dropped, causing high tides that were occasionally lower than low tides.  Very odd indeed.

But eventually I managed to iron out all of these little niggles and the site has been ticking along nicely with no interaction from me.  The number of visitors has been steadily increasing over the past month until we hit a new high of 180 unique visitors on the 25th October, with 25 followers on the most popular Twitter account (Hilbre Island, in case you were wondering).  Even the minimal advertising on the site has helped a little, bringing in just over £10 so far for October.

Graph showing increase in Visitor Numbers

Graph showing increase in Visitor Numbers

So what was the point of it all?  Why did I do it?

Occasionally I take the dog out to Cleethorpes beach to let him have a run around and a swim, and it’s obviously better for both of us if I know what time the tide will be in at a certain location.  Cleethorpes isn’t one of the locations provided for free by the POL, but Immingham is, and that’s only a few miles down the coast.

So I set about scraping just Immingham, then decided to see if I could do the whole lot.  The POL kindly gave me permission to scrape the free pages (subject to their veto) and it kind of snowballed from there.

The site is available to use at www.TideTimes.org.uk and remains completely free.  If you like it, feel free to link to it or follow your nearest port on Twitter.  If you have any comments or suggestions, please leave a message here – I promise I’ll even read it.