Golf course style for OpenStreetMap

rweait's picture

photo ccby chispita from flickr
In July 2009, Peter Miller wondered aloud on the OpenStreetMap-talk mailing list, if detailed rendering of golf courses was coming to OpenStreetMap? It's a fair question and one that has run through the mind of any OpenStreetMap enthusiast who has spent an afternoon at a good walk ruined.[1]

Peter asked:

Any chance of opengolfmap? I am needing a map to show the interaction
between an existing golf course and a proposed cycle route. I can add
the data to the map but I am not aware of anything that will render it.

I've taken a first cut at golf course rendering rules, using the wiki for guidance and using available resources. The results are rough but encouraging, I think. Until recently, all golf courses on OpenStreetMap were undifferentiated green blobs.

golf course area rendered by Mapnik

The Pine Lakes Country Club, in Myrtle Beach was built in 1927 and is known as The Granddaddy in an area known for golf courses.

Find Pine Lakes Country Club on

Available resources

OpenStreetMap has tags to show areas of water and trees, and the aerial imagery in the area is good, so I started by adding:
k:natural; v:water # for water features and
k:landuse; v:forest # for trees

The aerial imagery had long shadows that made for some guesswork on the tree placement. Even so, the server did a good job of rendering the new trees and water data which gave the map a little bit of the flavour of Pine Lakes. This project could really benefit from a fact finding mission and a site survey to Pine Lakes. I'll happily make that sacrifice.

Pine Lakes, trees and water

New golf tags

With the easy stuff done I had to face the mapnik style sheet. I wanted to add tee boxes, fairways, greens and bunkers to the map to really show the character of the golf course. Most of these features were visible from the available images. The wiki article on golf course tagging covered all of this except the tee boxes.

k:golf; v:fairway
k:golf; v:green
k:golf; v:bunker
k:golf; v:tee # added in the same spirit.

With most of the holes added to the map, I saved a local copy and started rendering.

First I turned the golf_course area off at high zoom levels by adding a MinScaleDenominator line to the k:leisure; v:golf_course rule.

  <Filter>[leisure] = 'golf_course'</Filter>
    <CssParameter name="fill">#b5e3b5</CssParameter>

Then I added the tee, fairway and green areas, only at high zoom levels, with a single paragraph. Added after the k:leisure; v:golf_course rule.

  <Filter>[golf] = 'fairway' or [golf] = 'tee' or [golf] = 'green'</Filter>
    <CssParameter name="fill">#b5e3b5</CssParameter>

And then I added the bunker area, again with with a single rule-paragraph.

  <Filter>[golf] = 'bunker'</Filter>
  <PolygonPatternSymbolizer file= "%SYMBOLS_DIR%/beach.png" type="png" width="10" height="10"/>

Finally, two changes were required to the select statement in the leisure layer.
(select way,aeroway,amenity,landuse,leisure,man_made,golf,military,"natural",power,tourism,name
from %PREFIX%_polygon
where landuse is not null
or leisure is not null
or aeroway='apron'
or man_made='pier'
or golf in ('bunker','tee','fairway','green')
or amenity in ('parking','university','college','school','hospital','grave_yard')
or military in ('barracks','danger_area')
or "natural" in ('field','beach','glacier','heath','mud','wood')
or power in ('station','sub_station')
or tourism in ('attraction','camp_site','caravan_site','picnic_site','zoo')
order by z_order,way_area desc
) as leisure

basic golf style rendered by mapnik

When rendered by mapnik, locally we can see a dogleg right with a psychologically challenging tee shot over the water. Stay right, or use a fade to take some of the sting out of the long approach shot to the clubhouse green, carefully guarded by two silent, sandy sentries. Or something like that.

Next steps

There is room to improve the map of this course with a detailed site survey, including rough location, cart paths, hole numbering, distances and recommended shots. The course was recently remodeled after an ownership change and several bouts of hurricane damage. The aerial imagery may be out of date.

The cartography for this basic golf style can be improved. Colours should be better matched. Bunkers are a little weak and tee boxes should stand out more against water. The addition of rough and hole outlines will improve the appearance of rendered golf courses.

The style sheet organization can be improved with a proper golf course layer. The current style is added to the leisure layer and while appropriate, it may be too busy for a general-purpose map.

You'll find my complete style template file, as used to render these examples, below.

Your comments, questions and suggestions regarding golf course rendering on OpenStreetMap are are welcome.


Map images and data © 2009 CCBYSA OpenStreetMap and contributors.
Golf photo © 2008 CCBY chispita_666 on flickr.

[1]Golf: A good walk ruined ~ Mark Twain


The original golf style in XML format.

This article from the archives was originally published on Mon, 08/17/2009 - 01:54