return ((aAddressLine.isaddress && aAddressLine.isaddress == 'f') ? 'notused' : '');
},
// { osm_type: 'R', osm_id: 12345 }
- // <a href="//www.openstreetmap.org/relation/12345">relation 12345</a
+ // <a href="https://www.openstreetmap.org/relation/12345">relation 12345</a
osmLink: function(aPlace) {
if (!aPlace.osm_type) return '';
var sOSMType = formatOSMType(aPlace.osm_type, false);
if (!sOSMType) return '';
return new Handlebars.SafeString(
- '<a href="//www.openstreetmap.org/' + sOSMType + '/' + aPlace.osm_id + '">' + sOSMType + ' ' + aPlace.osm_id + '</a>'
+ '<a href="https://www.openstreetmap.org/' + sOSMType + '/' + aPlace.osm_id + '">' + sOSMType + ' ' + aPlace.osm_id + '</a>'
);
},
/* en:London_Borough_of_Redbridge => https://en.wikipedia.org/wiki/London_Borough_of_Redbridge */
);
},
// { osm_type: 'R', osm_id: 12345 }
- // <a href="//www.openstreetmap.org/relation/12345">relation 12345</a
+ // <a href="details.html?place_id=12345">details</a>
detailsLink: function(aFeature, sTitle) {
if (!aFeature) return '';
if (!aFeature.place_id) return '';
- sTitle = 'details >';
- var sTitle = Handlebars.escapeExpression(sTitle);
+ sTitle = Handlebars.escapeExpression(sTitle || 'details >');
return new Handlebars.SafeString(
- '<a href="details.html?place_id=' + aFeature.place_id + '">' + (sTitle ? sTitle : aFeature.place_id ) + '</a>'
+ '<a href="details.html?place_id=' + aFeature.place_id + '">' + sTitle + '</a>'
+ );
+ },
+ detailsPermaLink: function(aFeature, sTitle) {
+ if (!aFeature) return '';
+
+ var sOSMType = formatOSMType(aFeature.osm_type, false);
+ if (!sOSMType) return '';
+
+ sTitle = Handlebars.escapeExpression(sTitle || sOSMType + ' ' + aFeature.osm_id);
+
+ return new Handlebars.SafeString(
+ '<a href="details.html?osmtype=' + aFeature.osm_type + '&osmid=' + aFeature.osm_id + '&class=' + aFeature.class + '">' + sTitle + '</a>'
);
},
coverageType: function(aPlace) {
formatMapIcon: function(sIcon) {
if (!sIcon) return;
- var url = sIcon.match(/png$/) ? Nominatim_Config.Images_Base_Url + '/' + sIcon : Nominatim_Config.Images_Base_Url + 'nominatim/images/mapicons/' + sIcon + '.n.32.png';
+ var url = Nominatim_Config.Images_Base_Url + sIcon;
return new Handlebars.SafeString(
'<img class="mapicon" src="' + url + '" alt="' + sIcon + '"/>'
return capitalize(aPlace.type.replace(/_/g, ' '));
}
},
- tooManyParentLinesWarning: function(aPlace) {
- if (!aPlace.parentof) return;
+ formatSearchRank: function(iRank) {
+ // same as
+ // https://github.com/openstreetmap/Nominatim/blob/master/sql/functions.sql
+ // get_searchrank_label()
+
+ if (iRank < 2) {
+ return 'continent';
+ } else if (iRank < 4) {
+ return 'sea';
+ } else if (iRank < 8) {
+ return 'country';
+ } else if (iRank < 12) {
+ return 'state';
+ } else if (iRank < 16) {
+ return 'county';
+ } else if (iRank == 16) {
+ return 'city';
+ } else if (iRank == 17) {
+ return 'town / island';
+ } else if (iRank == 18) {
+ return 'village / hamlet';
+ } else if (iRank == 20) {
+ return 'suburb';
+ } else if (iRank == 21) {
+ return 'postcode area';
+ } else if (iRank == 22) {
+ return 'croft / farm / locality / islet';
+ } else if (iRank == 23) {
+ return 'postcode area';
+ } else if (iRank == 25) {
+ return 'postcode point';
+ } else if (iRank == 26) {
+ return 'street / major landmark';
+ } else if (iRank == 27) {
+ return 'minory street / path';
+ } else if (iRank == 28) {
+ return 'house / building';
+ } else {
+ return 'other: ' + iRank;
+ }
+ },
+ tooManyHierarchyLinesWarning: function(aPlace) {
+ if (!aPlace.hierarchy) return;
var c = 0;
- for (var type in aPlace.parentof) {
+ for (var type in aPlace.hierarchy) {
c = c + type.length+1;
}
if (c < 500) return;