I'm trying to custom render some golf courses by hole. The goal is to show a vector image of each hole and it's associated features.
I'm able to recurse through a course's relation but I can't figure out how to keep both tags and node locations. I'd like to output something like this (maybe after some post processing):
{
hole: 1,
par: 4,
...,
teeboxes: [{id:"x",nodes:[{lat,lon},...]},...],
fairways: [{id:"x",nodes:[{lat,lon},...]},...],
green: [{id:"x",nodes:[{lat,lon},...]},...],
}
My query currently looks like this:
[out:json][timeout:5];
relation["name"="Davis Golf Course"];
way(r)["golf"="hole"];
foreach->.a(
.a out;
way(around.a:40.0)["golf"];
out;
)
This gets me all of the features in the right order but I only get node IDs without node coordinates. The following will just gave me all nodes from these features, but I don't know which they belong to.
[out:json][timeout:5];
relation["name"="Davis Golf Course"];
way(r)["golf"="hole"];
foreach->.a(
.a out;
way(around.a:40.0)["golf"];
>>;
out;
)
I'm rather new, so I might be out in left field here. Thanks for any help! Course reference
I was able to successfully query what I wanted with this:
[out:json][timeout:5];
way(<golf_course>);map_to_area ->.golfcourse;
way["golf"="hole"](area.golfcourse)->.holes;
(
relation["golf"="fairway"](area.golfcourse);
way["golf"~"^(green|tee|water_hazard|bunker|fairway)"](area.golfcourse);
)->.features;
.holes out geom;
.features out geom;