From: Sarah Hoffmann Date: Wed, 2 Dec 2020 15:17:14 +0000 (+0100) Subject: restructure rank display X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/commitdiff_plain/586f7f836124af2ea87b5f580c9e92b671ba4b1f restructure rank display Search rank is not really bound to place types anymore, therefore only display a number. Address rank is the more important rank now. Add it to the display and return the equivalent place type there. --- diff --git a/dist/deletable.html b/dist/deletable.html index a33aa38..1478809 100644 --- a/dist/deletable.html +++ b/dist/deletable.html @@ -426,8 +426,12 @@ {{aPlace.admin_level}} - Rank - {{formatSearchRank aPlace.rank_search}} + Search Rank + {{aPlace.rank_search}} + + + Address Rank + {{aPlace.rank_address}} ({{formatAddressRank aPlace.rank_address}}) {{#if aPlace.calculated_importance}} diff --git a/dist/details.html b/dist/details.html index a33aa38..1478809 100644 --- a/dist/details.html +++ b/dist/details.html @@ -426,8 +426,12 @@ {{aPlace.admin_level}} - Rank - {{formatSearchRank aPlace.rank_search}} + Search Rank + {{aPlace.rank_search}} + + + Address Rank + {{aPlace.rank_address}} ({{formatAddressRank aPlace.rank_address}}) {{#if aPlace.calculated_importance}} diff --git a/dist/handlebar_helpers.js b/dist/handlebar_helpers.js index 36deacd..e07c339 100644 --- a/dist/handlebar_helpers.js +++ b/dist/handlebar_helpers.js @@ -233,28 +233,23 @@ Handlebars.registerHelper({ } return ''; }, - formatSearchRank: function (iRank) { - // same as - // https://github.com/osm-search/Nominatim/blob/master/sql/functions.sql - // get_searchrank_label() - - if (iRank < 2) return 'continent'; - if (iRank < 4) return 'sea'; - if (iRank < 8) return 'country'; - if (iRank < 12) return 'state'; - if (iRank < 16) return 'county'; - if (iRank === 16) return 'city'; - if (iRank === 17) return 'town / island'; - if (iRank === 18) return 'village / hamlet'; - if (iRank === 20) return 'suburb'; - if (iRank === 21) return 'postcode area'; - if (iRank === 22) return 'croft / farm / locality / islet'; - if (iRank === 23) return 'postcode area'; - if (iRank === 25) return 'postcode point'; - if (iRank === 26) return 'street / major landmark'; + formatAddressRank: function (iRank) { + if (iRank < 4) return 'other'; + if (iRank < 6) return 'country'; + if (iRank < 8) return 'region'; + if (iRank < 10) return 'state'; + if (iRank < 12) return 'state district'; + if (iRank < 14) return 'county'; + if (iRank < 16) return 'municipality'; + if (iRank < 18) return 'city / town / village'; + if (iRank < 20) return 'city / village district'; + if (iRank < 22) return 'suburb / hamlet'; + if (iRank < 24) return 'neighbourhood'; + if (iRank < 26) return 'city block / square'; + if (iRank === 26) return 'major street'; if (iRank === 27) return 'minory street / path'; - if (iRank === 28) return 'house / building'; - return 'other: ' + iRank; + if (iRank <= 30) return 'house / building'; + return 'other'; }, tooManyHierarchyLinesWarning: function (aPlace) { if (!aPlace.hierarchy) return ''; diff --git a/dist/polygons.html b/dist/polygons.html index a33aa38..1478809 100644 --- a/dist/polygons.html +++ b/dist/polygons.html @@ -426,8 +426,12 @@ {{aPlace.admin_level}} - Rank - {{formatSearchRank aPlace.rank_search}} + Search Rank + {{aPlace.rank_search}} + + + Address Rank + {{aPlace.rank_address}} ({{formatAddressRank aPlace.rank_address}}) {{#if aPlace.calculated_importance}} diff --git a/dist/reverse.html b/dist/reverse.html index a33aa38..1478809 100644 --- a/dist/reverse.html +++ b/dist/reverse.html @@ -426,8 +426,12 @@ {{aPlace.admin_level}} - Rank - {{formatSearchRank aPlace.rank_search}} + Search Rank + {{aPlace.rank_search}} + + + Address Rank + {{aPlace.rank_address}} ({{formatAddressRank aPlace.rank_address}}) {{#if aPlace.calculated_importance}} diff --git a/dist/search.html b/dist/search.html index a33aa38..1478809 100644 --- a/dist/search.html +++ b/dist/search.html @@ -426,8 +426,12 @@ {{aPlace.admin_level}} - Rank - {{formatSearchRank aPlace.rank_search}} + Search Rank + {{aPlace.rank_search}} + + + Address Rank + {{aPlace.rank_address}} ({{formatAddressRank aPlace.rank_address}}) {{#if aPlace.calculated_importance}} diff --git a/src/handlebar_helpers.js b/src/handlebar_helpers.js index 36deacd..e07c339 100644 --- a/src/handlebar_helpers.js +++ b/src/handlebar_helpers.js @@ -233,28 +233,23 @@ Handlebars.registerHelper({ } return ''; }, - formatSearchRank: function (iRank) { - // same as - // https://github.com/osm-search/Nominatim/blob/master/sql/functions.sql - // get_searchrank_label() - - if (iRank < 2) return 'continent'; - if (iRank < 4) return 'sea'; - if (iRank < 8) return 'country'; - if (iRank < 12) return 'state'; - if (iRank < 16) return 'county'; - if (iRank === 16) return 'city'; - if (iRank === 17) return 'town / island'; - if (iRank === 18) return 'village / hamlet'; - if (iRank === 20) return 'suburb'; - if (iRank === 21) return 'postcode area'; - if (iRank === 22) return 'croft / farm / locality / islet'; - if (iRank === 23) return 'postcode area'; - if (iRank === 25) return 'postcode point'; - if (iRank === 26) return 'street / major landmark'; + formatAddressRank: function (iRank) { + if (iRank < 4) return 'other'; + if (iRank < 6) return 'country'; + if (iRank < 8) return 'region'; + if (iRank < 10) return 'state'; + if (iRank < 12) return 'state district'; + if (iRank < 14) return 'county'; + if (iRank < 16) return 'municipality'; + if (iRank < 18) return 'city / town / village'; + if (iRank < 20) return 'city / village district'; + if (iRank < 22) return 'suburb / hamlet'; + if (iRank < 24) return 'neighbourhood'; + if (iRank < 26) return 'city block / square'; + if (iRank === 26) return 'major street'; if (iRank === 27) return 'minory street / path'; - if (iRank === 28) return 'house / building'; - return 'other: ' + iRank; + if (iRank <= 30) return 'house / building'; + return 'other'; }, tooManyHierarchyLinesWarning: function (aPlace) { if (!aPlace.hierarchy) return ''; diff --git a/src/templates/detailspage.hbs b/src/templates/detailspage.hbs index e0225e8..410f3c8 100644 --- a/src/templates/detailspage.hbs +++ b/src/templates/detailspage.hbs @@ -73,8 +73,12 @@ {{aPlace.admin_level}} - Rank - {{formatSearchRank aPlace.rank_search}} + Search Rank + {{aPlace.rank_search}} + + + Address Rank + {{aPlace.rank_address}} ({{formatAddressRank aPlace.rank_address}}) {{#if aPlace.calculated_importance}}