Mapping our Scotland holiday

Teario
13 min readSep 20, 2015

--

Instead of going somewhere overseas this year for a holiday we decided instead to take a bit of a road trip to Scotland. I’d visited the country twice before now, once with school to a military base and a second time to stay in a log cabin over new year.

A few months before the trip I bought a Land Rover Defender. I’d liked them for some time and I suddenly found myself in the right circumstances to pick one up.

We had no real plan for what to do in Scotland. Other than drive alongside Loch Ness and stop off at Edinburgh, we were just going to go where the wind took us. A bit more of a plan did emerge when I discovered the previous owner of the Defender had tried to drive it to John O’Groats but had given up on two occasions (once in the Defender, another in his Freelander). I accepted that as a challenge and added a new destination. When looking for a nice route back down from there, I found the NC500. A route was starting to take shape.

Only a few days before the trip, I decided it’d be good to get up a map that shows the realtime position and route history of our trip that we could share with friends and family. I threw together a solution in 3 hours that was about the bare minimum for doing the job.

The Defender already has a tracker fitted, however the provider of that tracking service does not have any public-facing api for retrieving positional history. Their website has a live feed page which refreshes itself every 30 seconds, so I just intercepted the traffic from my browser on that page and wrote some code to pretend it was the browser and pull down the data once per minute.

The rest of the setup is Mongo, NodeJS and Nginx. The Node app takes care of extracting the position from the tracker provider and inserting it into Mongo. It provides a set of endpoints for the api such as /route, /images, /vehicle to provide relevant information to the client app. There is a single map page which shows the route, image thumbnails (larger images displayed on click) and a pin of the vehicle’s current location, state (moving/idle) and speed.

One problem I immediately encountered in testing was that when the vehicle was idle a long time, say over night, there was no point in storing the location every 60 seconds because the vehicle wouldn’t move. So I added in a bit of code which checked the current location against the previously stored location and then reject any that were closer than 20 metres, eventually settling at 50 metres after more testing.

The other major feature I added was photo upload. This was intentionally a very minimalist page with only a single file field and a button. The rationale here was that internet access in the Scottish highlands was going to be sporadic and I didn’t want to waste time downloading anything but what was essential to get the photo uploaded. Once a picture was submitted, NodeJS would then scale it down and produce a small thumbnail version. It’d also read the exif data and put in a database entry if the exif provided a location for the image. When a user looks at the map, all of the thumbnails appear in the places they are taken and can be clicked to show the larger version.

The morning of the trip I quickly added another feature which would allow the collection of data from the tracking provider to be disabled. If the tracking company kicked up a fuss I could remotely disable the harvesting of data from them. I showed one other person how to disable it in case I couldn’t access the internet to do it myself. Fortunately this was never necessary.

We set off on the 29th of August relatively early. The Defender was packed up the night before with a tent, sleeping bags, 2 weeks worth of clothes, oil, water for us, water for the car, an emergency fuel can, gas cooker and some fold up chairs.

Coffee stop in Buxton

A fellow Defender-owning friend of mine told me once about a game he and his wife plays, called “Will ‘e Wave”. The premise is that as another Defender approaches you guess if the other driver will give the Land Rover wave. After a few waves back we decided to keep track of how many we got on the trip, which was 30 out of 50. In total we saw 231 other Defenders or Series.

When internet was available I started to add pictures onto the map. It quickly became obvious that there was an issue though as with multiple image thumbnails it was only possible to expand the same one image. All thumbnails seemed to expand to that same image, which was the last one added. I knew the problem straight away was going to be a rookie mistake in the for-loop which adds the thumbnails and sets up the info windows.

for( var i = 0; i < data.length; ++i ){
var image = 'img/thumb/' + data[i].name;

var marker = new google.maps.Marker({
position: {lat: data[i].location[1], lng: data[i].location[0]},
map: that.map,
icon: image
});

var info = new google.maps.InfoWindow({content:'<img src="img/upload/' + data[i].name+'" width="640">'});
marker.addListener('click', function(){
info.open(that.map, marker);
});

that.images.markers.push(marker);
}

The problem here is that when the item is clicked, i is no longer the index of the thumbnail because the loop has continued and the value has been incremented. This is a pretty obvious one for Javascript developers and I should really have caught it. Leaving the map broken wasn’t something I wanted to do so I got on my phone, SSH’d into the server and used nano to edit the file using my mobile data. The solution was to simply insert an anonymous function within the loop which is immediately called. I know this is generally bad practice and the function should be outside of the loop but this was the best I could do through my phone at the time.

Another issue that I encountered which I hadn’t planned for was Nginx declaring a maximum size for uploaded files. The test images I used during development were all under this limit but most of those taken on the trip ended up over. I didn’t want to start editing Nginx configs through the phone as I don’t have a lot of experience using it and I worried I would break more by trying to fix it. I did attempt to reduce the file size using another app but that also ended up stripping the exif data which meant it couldn’t be placed on the map anyway. I never did fix this problem until after the trip was over.

Our first stop was in Glasgow for 2 nights where we visited some art galleries, admired the view from the top of the Mackintosh tower at The Lighthouse and I discovered a baby elephant produces my weight in dung every day. We found a really nice cafe called Mono and ended up eating there both evenings, because I enjoyed my meal so much the first time.

After Glasgow we headed toward Fort William and on alongside Loch Ness all the way up to Inverness. The roads started to wind up into the hills more as we headed further north and everything looked so picturesque. I stopped constantly to take photographs of the rolling mist, which meant we arrived near Wick quite late and decided to stop off for the night before heading to John O’Groats the following morning.

We didn’t expect to find much at John O’Groats other than a signpost to take a picture against and the multicoloured buildings I’d seen in pictures online. As it turns out, there’s a Starbucks! Following a few pictures near the sign we sat in the warm cafe and watched as others arrived. There were runners, cyclists, motorcyclists and walkers arriving every few minutes. Once warmed up, we left and drove the short distance to Duncansby Head so we could see the lighthouse and sea stacks.

Our next destination was Applecross, though it was going to be more than a day’s travel away. It was chosen mostly as an excuse to travel down the west coast of the country, but after a bit more research I also discovered Bealach na Bà which sounded like it would be a fun route to travel.

Not many miles from John O’Groats the car began to make some strange clicking noises. I recognised it as a relay, because it was the same noise that the windscreen wiper relay made every time the wipers activated. Following some disassembly it seemed to be part of the indicator circuit, though the indicators and hazard lights continued to work as expected. Shortly after this, the dashboard indicator for headlights also stopped working, though the headlights remained operational. Slightly worried but also miles from anywhere to have a proper look at it, we just pushed on all the way to Ullapool.

I also took some accidental art which I’ve become quite fond of.

Ullapool was nice and the owner of the B&B was very friendly. We took the last room in the place and he promptly put up the “No Vacancies” sign then disappeared into the street. Shortly after dropping our bags in the room we went to a pub for dinner and bumped into him again.

On checking out the next day we discussed our plans to get to Applecross and the B&B owner recommended that we stop off at Corrieshalloch Gorge and Gruinard Island. At the gorge was a suspension bridge stating that it could hold no more than 6 occupants at a time and it swayed in the wind. The gorge itself was wondrous, especially viewed from the platform a short walk on from the bridge.

Gruinard Island we saw as we drove nearby. The most striking thing about it was seeing just how close it lies to the mainland. It must be no more than a 5 minute journey by boat, which is absolutely terrifying given its history.

Much travelling later we stopped for a break at Victoria Falls. Although the falls are quite shallow the water flow is rapid. It is a somewhat surreal atmosphere because the entire site is surrounded by logging equipment and the remains of trees. It was impossible not to feel a pang of sadness at what could have been a spot of such beauty.

On the way back I tried to take a picture of the Defender to make it look like a toy car.

From this point on the car no longer had a functional alarm. During a quick stop at Torridon for some food, the alarm started to set itself off. Consistently it would trigger within minutes of arming it for no apparent reason, so the only solution was to leave it off. Fortunately the dashboard lights had returned to normal by this point and the indicator relay had even stopped making noises.

At Applecross we set up camp for the evening and then I sat outside the closed reception building for a while trying to upload some more photos. This is the first time I discovered what happens when the tracker can’t get a signal to update its location on the server. It doesn’t do any sort of local data cache and retry later, the data for those points in time is simply discarded. Some of the route down shows up as straight lines, so I figured at some point later I’d have to alter the tracker and allow manual insertion of corrective route points.

Following a hot breakfast in the campsite’s stunning dining room, we packed up and headed for the mountain pass. I was quite nervous about the inclines we were going to encounter as the Defender’s clutch was slipping and so we tended to lose a lot of power going uphill. The other major concern I had was the large turning circle of the car on the hairpin bends of the pass. As we were passing over in the direction of Tornapress which seemed to be the less common way of tackling it, I was hopeful we’d get away without holding anyone up for too long.

In fact the Defender performed brilliantly on this road. It was impossible to really get any speed going over because of poor visibility and having to pull into passing places due to the single track nature of the road, so the loss of power didn’t present any issues. We met a friendly Australian heading the opposite direction to us who remarked at how tight the hairpin bends were and that he’d had to 3-point turn a few of them. For us there was only one situation where that happened.

As soon as we reached the other side I felt like I wanted to turn around and go back to Applecross. The drive over the pass was a lot of fun and I definitely made a mental note to come back one day and drive it again.

We changed our plans a bit at this point and decided to go back to Fort William and the lovely campsite we had found there for a 2 night stop over. Next morning we rose early and I filled myself up on a croissant, the perfect breakfast for a mountain climber. We set off to try and get to the top of Ben Nevis.

We’d opted for the ‘tourist route’ to the top, because we hadn’t really packed any serious walking clothes. I was in trainers, the thick tracksuit bottoms I’d brought to sleep in if it was cold, a t-shirt and two sweaters. It seemed like packing for cold was the best option, but this particular day turned out to be the warmest of the entire trip.

Despite being on what was supposed to be the easy route, it was extremely tiring. We tended to see the same sets of people repeatedly, passing them when they stopped for a break and then again as they passed us when we stopped. After what seemed like an eternity we reached a big lake and had to fight the urge to just throw ourselves into it so we could cool off. What we didn’t know at this point was that we were looking at the ‘half-way lake’.

The second half of the climb was significantly more rocky and my poor choice of footwear really slowed us down. We ran out of water about 30 minutes from the summit but decided to push on and risk drinking from a stream on the way back down. Even at this point we were far further up than any of the surrounding peaks. The clear weather meant we could see for miles into the distance. I got a small sense of what it must feel like to climb some of the world’s tallest peaks.

At last, we made it. The view was incredible, looking down on the surrounding landscape, the other peaks so far below. Then up, where it almost felt like you could thrust your arms up through the Karman line, the distant sky changing rapidly from white to deep blue.

It took us 4:30 to reach the peak and a further 3:30 to get back down.

The trip was drawing to a close now but we still wanted to see Edinburgh before heading home, so we drove straight there the following day. We assumed it’d be easy to find a place to stay but actually spent over 4 hours searching and still came up with nothing. In the end Emma had to request a favour from a friend of hers, who let us stay with her for the night.

We actually visited the National Museum of Scotland 3 times in 2 days. There was so much to see in there, it’s where we spent almost all of our time in the city. When visiting museums I have a strange fascination with trying to touch and feel something from as far back in time as I can. A 2,000 year old column at Berlin’s Pergamon museum was previously at the top of my list but here I got the chance to encounter a 4 billion year old rock sample. I encountered a Widmanstätten pattern for the first time still feel fascinated by it.

On the final day of the holiday we headed back to the museum in the morning to see the top floor. We hadn’t managed to do that the previous day as we had spent so much time at the other exhibits. We had a long drive back and actually ended up staying in Middleton to break the journey up over two days. I spent some time once we got back cleaning up the tracking data and making a feature where some parts of the journey could be hidden so that it didn’t point straight to our house. In future I plan to allow dropping of a pin with a radius inside which all saved points default to being hidden.

Our journey was 1,700 miles in total over 12 days. Despite the few problems we encountered, the Defender never let us down when we needed it. I think back about the most memorable things we did, like climbing Ben Nevis, tackling the mountain pass, seeing the rock stacks off the northern coast, clinging on to a swaying bridge over the gorge and being awed by the exhibits at the Scottish National Museum and I realise two things. First, that these were all activities we did in the moment, unplanned and as we came across them. Second, that I can’t wait to see what happens on our next holiday adventure.

--

--