Golf course style for OpenStreetMap

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.
http://wiki.openstreetmap.org/wiki/Proposed_features/Golf_course
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.

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 OpenStreetMap.org.
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.

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.
<Rule>
<Filter>[leisure] = 'golf_course'</Filter>
<MaxScaleDenominator>1000000</MaxScaleDenominator>
<MinScaleDenominator>20000</MinScaleDenominator>
<PolygonSymbolizer>
<CssParameter name="fill">#b5e3b5</CssParameter>
</PolygonSymbolizer>
</Rule>
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.
<Rule>
<Filter>[golf] = 'fairway' or [golf] = 'tee' or [golf] = 'green'</Filter>
<MaxScaleDenominator>20000</MaxScaleDenominator>
<PolygonSymbolizer>
<CssParameter name="fill">#b5e3b5</CssParameter>
</PolygonSymbolizer>
</Rule>
And then I added the bunker area, again with with a single rule-paragraph.
<Rule>
<Filter>[golf] = 'bunker'</Filter>
<MaxScaleDenominator>20000</MaxScaleDenominator>
<PolygonPatternSymbolizer file= "%SYMBOLS_DIR%/beach.png" type="png" width="10" height="10"/>
</Rule>
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

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.
Credits
Article © 2009 CCBY R.Weait.
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
| Attachment | Size |
|---|---|
| osm-golf-template.xml | 341.79 KB |




Brilliant as always
Richard this is a brilliant post that compliments your other OSM server tutorials. For a long time I've been wanting to render my own maps, the main issue being with tags/keys that aren't used by the default 'mapnik' style. With your other tutorial I got mapnik running well and I finally figured out the rest about 3 weeks before you post this article, it's what I was needing then!
Further golf mapping
It sounds great to have a golf map, even though I'm not a golfer. It could probably be further improved with a bit of OpenLayers & Javascript work on the page that you view it. Click a hole to have the description, par, etc. displayed at the side. Still from OpenStreetMap data perhaps, but not rendered on the map tiles.
Well Done
I'm just a beginner golf mapper but bravo on the looks.
Post new comment