From 4aa5de663b458e414c6639db31c8e17fd1e5ad2a Mon Sep 17 00:00:00 2001 From: Jason Dekarske Date: Sat, 30 Apr 2022 17:56:41 -0700 Subject: [PATCH] nominatim course search --- apps/golfview/custom.html | 107 ++++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/apps/golfview/custom.html b/apps/golfview/custom.html index 48bfce5bc..73b101a7e 100644 --- a/apps/golfview/custom.html +++ b/apps/golfview/custom.html @@ -8,56 +8,52 @@ -
- - - -
-

No course loaded.

- - -
-
-

A course needs a few things to be parsed correctly by this tool.

-
    -
  • See official mapping guidelines here.
  • -
  • All holes and features must be within the target course's area.
  • -
  • Supported features are greens, fairways, tees, bunkers, water hazards and holes.
  • -
  • All features for a given hole should have the "ref" tag with the hole number as value. Shared features - should - list ref values separated by ';'. example.
  • -
  • There must be 18 holes and they must have the following tags: handicap, par, ref, dist
  • -
  • For any mapping assistance or issues, please file in the official - repo
  • -
- Example Course -
- +
+ + +
+
+
    +
    +
    +

    No course loaded.

    + + +
    +
    +

    A course needs a few things to be parsed correctly by this tool.

    +
      +
    • See official mapping guidelines here.
    • +
    • All holes and features must be within the target course's area.
    • +
    • Supported features are greens, fairways, tees, bunkers, water hazards and holes.
    • +
    • All features for a given hole should have the "ref" tag with the hole number as value. Shared features + should + list ref values separated by ';'. example.
    • +
    • There must be 18 holes and they must have the following tags: handicap, par, ref, dist
    • +
    • For any mapping assistance or issues, please file in the official + repo
    • +
    + Example Course +
    + @@ -67,6 +63,7 @@ const search_url = "https://nominatim.openstreetmap.org/search"; let search_query = null; let course_input = null; + let current_course = null; let search_results = $("#searchresults"); function courseSearch() { @@ -76,9 +73,6 @@ "q": inputVal, }; doSearch(); - - // query = `[out:json][timeout:5];way(${inputVal});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;`; - // doQuery(); } function processFeatures(course_verbose) { @@ -150,7 +144,6 @@ } var courses = []; - var course_name = "Davis"; $("#upload").click(function () { sendCustomizedApp({ storage: courses, @@ -158,9 +151,13 @@ }); $("#download").click(function () { - downloadObjectAsJSON(courses[0].content, "golfcourse-" + course_name); + downloadObjectAsJSON(courses[0].content, "golfcourse-download"); }); + function testfunc(params) { + console.log(params); + } + // download info from the course function doSearch() { $.get(search_url, search_query, function (result) { @@ -173,25 +170,35 @@ for (let index = 0; index < result.length; index++) { const element = result[index]; if (element.type != "golf_course") continue; - search_results.append($("
  • ").append($("").attr('href', 'google.com').text(element.display_name))); + search_results.append($("
  • ") + .append($("

    ").text(element.display_name) + .append($("

    ") + .append($('