James Tait's diary

Recent diary entries

On Mapping Golf Courses

Posted by James Tait on 20 June 2015 in English (English)

I’m not a golfer. When I grew up, golf was a rich person’s game. Average Joes like me couldn’t afford to play golf. Things have changed. My boys are golfers. I’m just their geek dad, a Free Software nerd and OpenStreetMap obsessive who takes them places. Golf can still be a rich person’s game, but it doesn’t have to be. The rich kids just have more equipment.

One such piece of equipment is GPS assistance. A little custom-made gadget that knows about golf courses and the features and layout of each hole and assists with things like choosing your club and your line based on where you are and where you need to get to. This, to someone like me, sounds like a challenge. We have this data (or where we don’t, we can create it). So, ahead of the first round of the 2015 Derbyshire Futures Tour, I set about mapping the course.

Actually mapping the course, the holes and their features from the Bing imagery was a breeze. But when I got to thinking about how the software would work, I came up short. My idea was something like this:

  1. The golf club is represented by an area (leisure=golf_course; name=Name of Club)
  2. Each course at a club is represented by a relation (type=golf_course; name=Name of Club, Name of Course).
  3. The relation groups all the ways tagged golf=hole, and the ref tag on each way represents the hole number.
  4. The tee boxes (golf=tee) and greens (golf=green) are also tagged using ref for the hole number.
  5. Bunkers are tagged (golf=bunker, natural=sand); water hazards (golf=water_hazard; natural=water); lateral water hazards (golf=lateral_water_hazard; natural=water); fairways (golf=fairway); and woods (natural=wood) and individual trees (natural=tree).
  6. Search for a course. This would search Nominatim or similar for relations of type=golf_course that closely match what the user searched for. This could even be automated as a first step, so the user just has to select the course from a list.
  7. Download the data for the course, render it, show distance to the hole, recommended club, etc. Record strokes and distances. The sky’s the limit here.

But there’s a problem: tee boxes, fairways and greens are associated with a hole on a course, which is part of a club - but that’s not represented in the data. We only have a link from the course relation to its holes - there’s nothing linking a tee box to a hole or a green to a hole, and there’s nothing linking bunkers and trees to the course. Now for downloading the data, this is not necessarily a problem, as we can figure out the bounding box. But when it comes to “show me an overview of the first hole” then it becomes:

  1. Select the first item of role=hole in the relation.
  2. Look at its ref tag.
  3. Select all ways in our bounding box with the same ref tag (and probably golf=tee, etc.)
  4. Figure out the hole’s bounding box.
  5. Select anything else in that bounding box.
  6. Render.

If instead we had a hierarchy of relations, we could do:

  1. Select the first item of role=hole in the relation.
  2. Select the child relations for role=tee, role=fairway, role=green, etc.
  3. Figure out the hole’s bounding box.
  4. Select anything else in that bounding box.
  5. Render.

It’s only one step less, but by iterating over the child relations, all the related ways are selected explicitly, rather than having to iterate over every way we’ve downloaded and discard most of them. I think this would make for more coherent data and more performant applications.

Location: Shirland and Higham CP, North East Derbyshire, Derbyshire, East Midlands, England, United Kingdom

A new obsession

Posted by James Tait on 13 July 2009 in English (English)

My tagging of RCN Route 66 has become obsessive. Whenever I see those little blue signs as I'm driving by, I'm hunting for the little white shield that indicates that I've stumbled upon another segment. Sooner or later I'm going to have to get on my bike and ride around the lot.

Location: Darley Abbey, Derby, East Midlands, England, DE22 1DT, United Kingdom

Route 66

Posted by James Tait on 19 June 2009 in English (English)

No, not THAT Route 66! Derby Regional Cycle Network Route 66, the Derby Ringway. Following a very enjoyable cycle ride along NCN 54 last weekend, I decided to try and improve some of the cycle route coverage on OSM, and Route 66 is along my school run so it was the obvious choice. I've had to take some detours to fill in some of the joins, but the Mickleover/Littleover/Heatherton part of it all joins up now.

Location: Mickleover, Derby, East Midlands, England, DE3 9GJ, United Kingdom

Taking Shape

Posted by James Tait on 28 August 2008 in English (English)

Since getting my grubby little mitts on a GPS receiver, I've been a bit like a kid with a new toy. I don't have masses of free time to go out specifically for the purpose of gathering traces, so I promised myself I'd just do it as and when I was out and about.

So I did and it worked... to a point. I had a minor issue with the Dell BT-309 not working with GpsMid on the Nokia 6280 after I'd hooked it up to JOSM on my laptop. The GPS was showing it had a fix, but GpsMid was saying no fix. If I changed the mode to Sirf instead of NMEA then when I loaded GpsMid it would centre the map on my current position, but the position was never refreshed. It turned out that gpsd or JOSM (I'm still not sure which) had put the GPS into binary mode, while GpsMid was expecting plain old NMEA. Or something. So I lost a day's tracking to that little snag.

Since then I've broken my promise to myself and taken two expeditions for no other reason than I wanted to get some tracks. Monday night I took a walk around the back streets north of the A5111 and West of Upper Dale Road to fill in some of the GPS blanks and line up the streets I'd traced from the NPE. Tuesday night I took a drive around south of the A5111 and east of Stenson Road, filling in some of the bits that had been bugging me because I just couldn't get them to fit.

Those areas are taking shape now and I'm very pleased with the results so far. There are still more bits that need doing -- including a whole load of new (well, since the NPE!) developments south of Browning Circle I had no idea even existed -- but what's there now is, for the most part, accurate and has GPS data to support it.

Location: Peartree, Derby, East Midlands, England, DE23 8RR, United Kingdom

GPS-Enabled At Last!

Posted by James Tait on 24 August 2008 in English (English)

Today I took a drive up to Mansfield to get my hair cut, see my dad and pick up a Bluetooth-enabled GPS receiver to use with GpsMid on my Nokia 6280. I was amazed at how simple it was to start collecting traces. As a first stab, I took a quick walk around the block and produced a trace encompassing Goldsmith Street, Chaucer Street, some of Bancroft Lane and Rosemary Street, Layton Avenue and Stanton Place (I think, I need to check that street name).

When I came to leave, I took an extended route to pick up the rest of Bancroft Lane, some of Ladybrook Lane and the remaining bit of the ring road. It was so cool when I was approaching Derby seeing the map approaching (I only had a very small area, barely covering Derby, downloaded to my phone) and this allowed me to again take a small detour to take in some of the back streets of Derby that I'm not so familiar with and struggled to trace from the NPE. I made sure to go right around the roundabout just down the road, as I've been wanting to fill that in accurately for a while now, and also to weave around Lewis Street, Birdwood Street, St Augustine Street and Vincent Street to get the important points to line them up.

I edited the first trace in JOSM and uploaded the results... then uploaded the raw GPX in case that's useful for others. The second trace for some reason didn't work out, possibly a problem with the GPX export as it displays OK on the phone. The third trace came out really well and I've now lined up Lewis Street, even if some of the other streets in the area need some more data and a little more tweaking.

Location: Cavendish, Derby, East Midlands, England, DE23 8UB, United Kingdom

Increasing My Tool Set

Posted by James Tait on 22 August 2008 in English (English)

With the help of GpsMid (, a J2ME Midlet to display vector maps on a Java-enabled mobile phone, I've been adding more detail to the areas that I've been mapping. Although I don't yet have a GPS receiver, GpsMid will interface with one via Bluetooth and I intend to take full advantage of that fact the next time I'm in Mansfield and I can nab my brother's. In the meantime I'm making extensive use of GpsMid's Save Waypoint feature to mark significant places by hand which can then be more accurately positioned when I have actual GPS data to align things.

All of the back streets I regularly walk on my way to and from work are now mapped, mostly by tracing over the NPE, some by tracing someone else's GPS data. I've started to venture further afield, taking different routes home and pounding different streets when taking the kids to the park or nipping down to the shops so I can add more streets and more details. There are still some significant gaps where I don't know enough about the layout of the streets to reliably trace the NPE, but again I'll cover those when I'm GPS-enabled.

My eldest son likes to see the map on Daddy's phone and seems to understand that we're helping to draw it. My wife and people in the office are probably sick to death of me banging on about it and constantly polling them (and even complete strangers in the street!) for details, always mindful of the need to draw on their own knowledge, not that gained from Google Maps or similar.

Location: Peartree, Derby, East Midlands, England, DE23 8RR, United Kingdom

Corrections and Adjustments

Posted by James Tait on 14 August 2008 in English (English)

Following a comment from Mark Williamson on my last diary entry I was able to line up the NPE map with my ways and correct (hopefully!) some of my previous inaccuracies. I've also started playing tonight with JOSM, which highlighted a whole load of GPS data I didn't even know existed, so I was able to line up my ways with the GPS data in some instances. There's still a certain amount of interpolation where I have no GPS data (yet!) but it should be more accurate now.

Now if only I can stop myself spending so long doing this stuff... but it's so much FUN!

Location: Cavendish, Derby, East Midlands, England, DE23 8UB, United Kingdom

Contributing at Last

Posted by James Tait on 13 August 2008 in English (English)

Well I decided it was high time I started making some actual contributions, notwithstanding the lack of a GPS unit or usable aerial imagery for my area. So I started tracing over the old out-of-copyright map using Potlatch, adding my street and the back streets around Derby that I know.

I noticed the overlay is somewhat misaligned when compared to the existing ways, so I expect that when I do get my Freerunner in the next few weeks and start adding some GPS traces I will have some editing to do to correct what I've entered so far. No matter, at least we officially exist on OSM now.

Having mentioned what I was doing to one person in the office, another colleague piped up that they were also a contributor. I suspect that if I asked around I'd find one or two more as well -- I've noticed GPS traces of the private on-site access roads here, so clearly someone is actively tracing and uploading.

Location: Peartree, Derby, East Midlands, England, DE23 8RR, United Kingdom