From b687c8f1cbd62f88c61db9b209bc8f7145203d3c Mon Sep 17 00:00:00 2001 From: marc tobias Date: Sat, 11 Apr 2020 01:03:21 +0200 Subject: [PATCH] add pages /deletable.html, /polygons.html --- build.sh | 16 +++- dist/assets/js/nominatim-ui.js | 40 ++++++++ dist/deletable.hbs | 39 ++++++++ dist/deletable.html | 161 +++++++++++++++++++++++++++++++ dist/details.html | 5 +- dist/handlebar_helpers.js | 5 +- dist/polygons.hbs | 45 +++++++++ dist/polygons.html | 167 +++++++++++++++++++++++++++++++++ dist/reverse.html | 5 +- dist/search.html | 5 +- src/assets/js/deletable.js | 20 ++++ src/assets/js/polygons.js | 20 ++++ src/handlebar_helpers.js | 3 + src/templates/deletable.hbs | 39 ++++++++ src/templates/polygons.hbs | 45 +++++++++ 15 files changed, 607 insertions(+), 8 deletions(-) create mode 100644 dist/deletable.hbs create mode 100644 dist/deletable.html create mode 100644 dist/polygons.hbs create mode 100644 dist/polygons.html create mode 100644 src/assets/js/deletable.js create mode 100644 src/assets/js/polygons.js create mode 100644 src/templates/deletable.hbs create mode 100644 src/templates/polygons.hbs diff --git a/build.sh b/build.sh index f77b8a3..84d0050 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,7 @@ rsync --quiet --recursive src/assets/css/ dist/assets/css/ rsync --quiet --recursive src/assets/images/ dist/assets/images/ mkdir -p dist/assets/js/ -cat src/assets/js/base.js src/assets/js/detailpage.js src/assets/js/searchpage.js > dist/assets/js/nominatim-ui.js +cat src/assets/js/base.js src/assets/js/detailpage.js src/assets/js/searchpage.js src/assets/js/deletable.js src/assets/js/polygons.js > dist/assets/js/nominatim-ui.js rsync --quiet node_modules/jquery/dist/jquery.min.js dist/assets/js/ rsync --quiet node_modules/leaflet/dist/leaflet.js dist/assets/js/ @@ -55,4 +55,18 @@ echo '' >> dist/details.html echo '' >> dist/details.html echo '' >> dist/details.html +cat src/layout.html | grep -v '' | grep -v '' | sed -e 's/BODYID/deletable-page/' > dist/deletable.html +echo '' >> dist/deletable.html +echo '' >> dist/deletable.html +echo '' >> dist/deletable.html + +cat src/layout.html | grep -v '' | grep -v '' | sed -e 's/BODYID/polygons-page/' > dist/polygons.html +echo '' >> dist/polygons.html +echo '' >> dist/polygons.html +echo '' >> dist/polygons.html + cp src/index.html dist/ diff --git a/dist/assets/js/nominatim-ui.js b/dist/assets/js/nominatim-ui.js index d213626..56f731f 100644 --- a/dist/assets/js/nominatim-ui.js +++ b/dist/assets/js/nominatim-ui.js @@ -681,3 +681,43 @@ jQuery(document).ready(function () { } } }); +// ********************************************************* +// DELETABLE PAGE +// ********************************************************* + +jQuery(document).ready(function () { + if (!$('#deletable-page').length) { return; } + + var api_request_params = { + format: 'json' + }; + + fetch_from_api('deletable', api_request_params, function (aPolygons) { + var context = { aPolygons: aPolygons }; + + render_template($('main'), 'deletable-template', context); + update_html_title('Deletable objects'); + + update_data_date(); + }); +}); +// ********************************************************* +// BROKEN POLYGON PAGE +// ********************************************************* + +jQuery(document).ready(function () { + if (!$('#polygons-page').length) { return; } + + var api_request_params = { + format: 'json' + }; + + fetch_from_api('polygons', api_request_params, function (aPolygons) { + var context = { aPolygons: aPolygons }; + + render_template($('main'), 'polygons-template', context); + update_html_title('Broken polygons'); + + update_data_date(); + }); +}); diff --git a/dist/deletable.hbs b/dist/deletable.hbs new file mode 100644 index 0000000..35ab9e0 --- /dev/null +++ b/dist/deletable.hbs @@ -0,0 +1,39 @@ +
+
+
+

Deletable

+ +

+ {{aPolygons.length}} objects have been deleted in OSM but are still in the Nominatim database. +

+ + + + + + + + + + + + + {{#each aPolygons}} + + + + + + + + + + {{/each}} + +
Place idCountry CodeNameOSM idOSM typeClassType
{{detailsLink this place_id}}{{country_code}}{{name}}{{osmLink this}}{{osm_type}}{{class}}{{type}}
+ + +
+
+
+ + + OpenStreetMap Nominatim + + + + + + + + + + + + + + + +
+ You need Javascript enabled to view this page. +
+ +
+
+ +
+ Data from API request +
+ Data last updated: + +
+ +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + diff --git a/dist/details.html b/dist/details.html index 0267b5f..3ca103a 100644 --- a/dist/details.html +++ b/dist/details.html @@ -46,7 +46,8 @@
  • API Reference
  • FAQ
  • OpenStreetMap Help
  • -
  • Nominatim on Github
  • +
  • Nominatim on Github
  • +
  • This frontend on Github
  • Report problem with results
  • @@ -72,7 +73,7 @@ to check how the address was generated before reporting a problem.

    - Use Nominatim issues on github + Use Nominatim issues on github to report problems.

    diff --git a/dist/handlebar_helpers.js b/dist/handlebar_helpers.js index 7af3384..de8778b 100644 --- a/dist/handlebar_helpers.js +++ b/dist/handlebar_helpers.js @@ -14,6 +14,9 @@ function formatOSMType(sType, bExcludeExternal) { } Handlebars.registerHelper({ + formatOSMType: function (sType, bExcludeExternal) { + return formatOSMType(sType, bExcludeExternal); + }, shortOSMType: function (sType) { if (sType === 'node') return 'N'; if (sType === 'way') return 'W'; @@ -131,7 +134,7 @@ Handlebars.registerHelper({ }, formatSearchRank: function (iRank) { // same as - // https://github.com/openstreetmap/Nominatim/blob/master/sql/functions.sql + // https://github.com/osm-search/Nominatim/blob/master/sql/functions.sql // get_searchrank_label() if (iRank < 2) return 'continent'; diff --git a/dist/polygons.hbs b/dist/polygons.hbs new file mode 100644 index 0000000..9e74ef6 --- /dev/null +++ b/dist/polygons.hbs @@ -0,0 +1,45 @@ +

    +
    +
    +

    Broken polygons

    + +

    + Total number of broken polygons: {{aPolygons.length}}. +

    + + + + + + + + + + + + + + + {{#each aPolygons}} + + + + + + + + + + + + {{/each}} + +
    OSM typeOSM idClassTypeNameCountry CodeError messageUpdated 
    {{osm_type}}{{osmLink this}}{{class}}{{type}}{{name}}{{country_code}}{{errormessage}}{{updated}} + josm +
    + + +
    +
    +
    + + + OpenStreetMap Nominatim + + + + + + + + + + + + + + + +
    + You need Javascript enabled to view this page. +
    + +
    +
    + +
    + Data from API request +
    + Data last updated: + +
    + +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + diff --git a/dist/reverse.html b/dist/reverse.html index 390a812..f19e051 100644 --- a/dist/reverse.html +++ b/dist/reverse.html @@ -46,7 +46,8 @@
  • API Reference
  • FAQ
  • OpenStreetMap Help
  • -
  • Nominatim on Github
  • +
  • Nominatim on Github
  • +
  • This frontend on Github
  • Report problem with results
  • @@ -72,7 +73,7 @@ to check how the address was generated before reporting a problem.

    - Use Nominatim issues on github + Use Nominatim issues on github to report problems.

    diff --git a/dist/search.html b/dist/search.html index 1e2fab8..f0282d0 100644 --- a/dist/search.html +++ b/dist/search.html @@ -46,7 +46,8 @@

  • API Reference
  • FAQ
  • OpenStreetMap Help
  • -
  • Nominatim on Github
  • +
  • Nominatim on Github
  • +
  • This frontend on Github
  • Report problem with results
  • @@ -72,7 +73,7 @@ to check how the address was generated before reporting a problem.

    - Use Nominatim issues on github + Use Nominatim issues on github to report problems.

    diff --git a/src/assets/js/deletable.js b/src/assets/js/deletable.js new file mode 100644 index 0000000..308b70c --- /dev/null +++ b/src/assets/js/deletable.js @@ -0,0 +1,20 @@ +// ********************************************************* +// DELETABLE PAGE +// ********************************************************* + +jQuery(document).ready(function () { + if (!$('#deletable-page').length) { return; } + + var api_request_params = { + format: 'json' + }; + + fetch_from_api('deletable', api_request_params, function (aPolygons) { + var context = { aPolygons: aPolygons }; + + render_template($('main'), 'deletable-template', context); + update_html_title('Deletable objects'); + + update_data_date(); + }); +}); diff --git a/src/assets/js/polygons.js b/src/assets/js/polygons.js new file mode 100644 index 0000000..3ccaf11 --- /dev/null +++ b/src/assets/js/polygons.js @@ -0,0 +1,20 @@ +// ********************************************************* +// BROKEN POLYGON PAGE +// ********************************************************* + +jQuery(document).ready(function () { + if (!$('#polygons-page').length) { return; } + + var api_request_params = { + format: 'json' + }; + + fetch_from_api('polygons', api_request_params, function (aPolygons) { + var context = { aPolygons: aPolygons }; + + render_template($('main'), 'polygons-template', context); + update_html_title('Broken polygons'); + + update_data_date(); + }); +}); diff --git a/src/handlebar_helpers.js b/src/handlebar_helpers.js index c7dca54..de8778b 100644 --- a/src/handlebar_helpers.js +++ b/src/handlebar_helpers.js @@ -14,6 +14,9 @@ function formatOSMType(sType, bExcludeExternal) { } Handlebars.registerHelper({ + formatOSMType: function (sType, bExcludeExternal) { + return formatOSMType(sType, bExcludeExternal); + }, shortOSMType: function (sType) { if (sType === 'node') return 'N'; if (sType === 'way') return 'W'; diff --git a/src/templates/deletable.hbs b/src/templates/deletable.hbs new file mode 100644 index 0000000..35ab9e0 --- /dev/null +++ b/src/templates/deletable.hbs @@ -0,0 +1,39 @@ +

    +
    +
    +

    Deletable

    + +

    + {{aPolygons.length}} objects have been deleted in OSM but are still in the Nominatim database. +

    + + + + + + + + + + + + + {{#each aPolygons}} + + + + + + + + + + {{/each}} + +
    Place idCountry CodeNameOSM idOSM typeClassType
    {{detailsLink this place_id}}{{country_code}}{{name}}{{osmLink this}}{{osm_type}}{{class}}{{type}}
    + + +
    +
    +
    +
    +
    +

    Broken polygons

    + +

    + Total number of broken polygons: {{aPolygons.length}}. +

    + + + + + + + + + + + + + + + {{#each aPolygons}} + + + + + + + + + + + + {{/each}} + +
    OSM typeOSM idClassTypeNameCountry CodeError messageUpdated 
    {{osm_type}}{{osmLink this}}{{class}}{{type}}{{name}}{{country_code}}{{errormessage}}{{updated}} + josm +
    + + +
    +
    +