<span class="type">({{formatLabel aResult}})</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<span class="type">{{formatLabel aResult}}</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<td>{{this.rank_address}}</td>
<td>{{formatAdminLevel this.admin_level}}</td>
<td>{{formatDistance this.distance bDistanceInMeters}}</td>
- <td>{{detailsPermaLink this 'details >'}}</td>
+ <td><a href="{{detailsURL this}}">details</td>
</tr>
{{/inline}}
<div class="col-sm-10">
<h1>
{{aPlace.localname}}
- <small>{{detailsPermaLink aPlace 'link to this page'}}</small>
+ <small><a href="{{detailsURL aPlace}}">link to this page</a></small>
</h1>
</div>
<div class="col-sm-2 text-right">
<tbody>
{{#each aPolygons}}
<tr>
- <td>{{detailsLink this place_id}}</td>
+ <td><a href="{{detailsURL this}}">{{this.place_id}}</a></td>
<td>{{country_code}}</td>
<td>{{name}}</td>
<td>{{osmLink this}}</td>
<span class="type">({{formatLabel aResult}})</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<span class="type">{{formatLabel aResult}}</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<td>{{this.rank_address}}</td>
<td>{{formatAdminLevel this.admin_level}}</td>
<td>{{formatDistance this.distance bDistanceInMeters}}</td>
- <td>{{detailsPermaLink this 'details >'}}</td>
+ <td><a href="{{detailsURL this}}">details</td>
</tr>
{{/inline}}
<div class="col-sm-10">
<h1>
{{aPlace.localname}}
- <small>{{detailsPermaLink aPlace 'link to this page'}}</small>
+ <small><a href="{{detailsURL aPlace}}">link to this page</a></small>
</h1>
</div>
<div class="col-sm-2 text-right">
<tbody>
{{#each aPolygons}}
<tr>
- <td>{{detailsLink this place_id}}</td>
+ <td><a href="{{detailsURL this}}">{{this.place_id}}</a></td>
<td>{{country_code}}</td>
<td>{{name}}</td>
<td>{{osmLink this}}</td>
return '';
}
+function formatShortOSMType(sType) {
+ if (sType === 'node') return 'N';
+ if (sType === 'way') return 'W';
+ if (sType === 'relation') return 'R';
+ return '';
+}
+
function getIcon(aPlace) {
// equivalent to PHP Nominatim::ClassTypes::getIcon
// covers 83 of 214 available icon filenames, e.g. transport_roundabout_anticlockwise
return formatOSMType(sType, bExcludeExternal);
},
shortOSMType: function (sType) {
- if (sType === 'node') return 'N';
- if (sType === 'way') return 'W';
- if (sType === 'relation') return 'R';
- return '';
+ return formatShortOSMType(sType);
},
// { osm_type: 'R', osm_id: 12345 }
// <a href="https://www.openstreetmap.org/relation/12345">relation 12345</a
'<a href="https://' + sLanguage + '.wikipedia.org/wiki/' + sArticle + '" target="_blank">' + sTitle + '</a>'
);
},
- // { osm_type: 'R', osm_id: 12345 }
- // <a href="details.html?place_id=12345">details</a>
- detailsLink: function (aFeature, sTitle) {
- if (!aFeature) return '';
- if (!aFeature.place_id) return '';
-
- var sTitleEscaped = Handlebars.escapeExpression(sTitle || 'details >');
-
- return new Handlebars.SafeString(
- '<a href="details.html?place_id=' + aFeature.place_id + '">' + sTitleEscaped + '</a>'
- );
- },
- detailsPermaLink: function (aFeature, sTitle) {
+ // 'details.html?osmtype=R&osmid=2181874&class=boundary'
+ detailsURL: function (aFeature) {
if (!aFeature) return '';
- var sOSMType = formatOSMType(aFeature.osm_type, false);
+ var sOSMType = aFeature.osm_type;
+ if (sOSMType && sOSMType.length !== 1) {
+ sOSMType = formatShortOSMType(aFeature.osm_type, false); // node => N
+ }
if (!sOSMType) return '';
- var sTitleEscaped = Handlebars.escapeExpression(sTitle || sOSMType + ' ' + aFeature.osm_id);
-
- var sURL = 'details.html?osmtype=' + aFeature.osm_type + '&osmid=' + aFeature.osm_id;
- if (aFeature.category) {
+ var sURL = 'details.html?osmtype=' + sOSMType + '&osmid=' + aFeature.osm_id;
+ if (aFeature.class) {
+ sURL = sURL + '&class=' + aFeature.class;
+ } else if (aFeature.category) {
sURL = sURL + '&class=' + aFeature.category;
}
-
- return new Handlebars.SafeString(
- '<a href="' + sURL + '">' + sTitleEscaped + '</a>'
- );
+ return sURL;
},
formatPlaceType: function (aPlace) {
var sOut = aPlace.class + ':' + aPlace.type;
<span class="type">({{formatLabel aResult}})</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<span class="type">{{formatLabel aResult}}</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<td>{{this.rank_address}}</td>
<td>{{formatAdminLevel this.admin_level}}</td>
<td>{{formatDistance this.distance bDistanceInMeters}}</td>
- <td>{{detailsPermaLink this 'details >'}}</td>
+ <td><a href="{{detailsURL this}}">details</td>
</tr>
{{/inline}}
<div class="col-sm-10">
<h1>
{{aPlace.localname}}
- <small>{{detailsPermaLink aPlace 'link to this page'}}</small>
+ <small><a href="{{detailsURL aPlace}}">link to this page</a></small>
</h1>
</div>
<div class="col-sm-2 text-right">
<tbody>
{{#each aPolygons}}
<tr>
- <td>{{detailsLink this place_id}}</td>
+ <td><a href="{{detailsURL this}}">{{this.place_id}}</a></td>
<td>{{country_code}}</td>
<td>{{name}}</td>
<td>{{osmLink this}}</td>
<span class="type">({{formatLabel aResult}})</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<span class="type">{{formatLabel aResult}}</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<td>{{this.rank_address}}</td>
<td>{{formatAdminLevel this.admin_level}}</td>
<td>{{formatDistance this.distance bDistanceInMeters}}</td>
- <td>{{detailsPermaLink this 'details >'}}</td>
+ <td><a href="{{detailsURL this}}">details</td>
</tr>
{{/inline}}
<div class="col-sm-10">
<h1>
{{aPlace.localname}}
- <small>{{detailsPermaLink aPlace 'link to this page'}}</small>
+ <small><a href="{{detailsURL aPlace}}">link to this page</a></small>
</h1>
</div>
<div class="col-sm-2 text-right">
<tbody>
{{#each aPolygons}}
<tr>
- <td>{{detailsLink this place_id}}</td>
+ <td><a href="{{detailsURL this}}">{{this.place_id}}</a></td>
<td>{{country_code}}</td>
<td>{{name}}</td>
<td>{{osmLink this}}</td>
<span class="type">({{formatLabel aResult}})</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<span class="type">{{formatLabel aResult}}</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<td>{{this.rank_address}}</td>
<td>{{formatAdminLevel this.admin_level}}</td>
<td>{{formatDistance this.distance bDistanceInMeters}}</td>
- <td>{{detailsPermaLink this 'details >'}}</td>
+ <td><a href="{{detailsURL this}}">details</td>
</tr>
{{/inline}}
<div class="col-sm-10">
<h1>
{{aPlace.localname}}
- <small>{{detailsPermaLink aPlace 'link to this page'}}</small>
+ <small><a href="{{detailsURL aPlace}}">link to this page</a></small>
</h1>
</div>
<div class="col-sm-2 text-right">
<tbody>
{{#each aPolygons}}
<tr>
- <td>{{detailsLink this place_id}}</td>
+ <td><a href="{{detailsURL this}}">{{this.place_id}}</a></td>
<td>{{country_code}}</td>
<td>{{name}}</td>
<td>{{osmLink this}}</td>
return '';
}
+function formatShortOSMType(sType) {
+ if (sType === 'node') return 'N';
+ if (sType === 'way') return 'W';
+ if (sType === 'relation') return 'R';
+ return '';
+}
+
function getIcon(aPlace) {
// equivalent to PHP Nominatim::ClassTypes::getIcon
// covers 83 of 214 available icon filenames, e.g. transport_roundabout_anticlockwise
return formatOSMType(sType, bExcludeExternal);
},
shortOSMType: function (sType) {
- if (sType === 'node') return 'N';
- if (sType === 'way') return 'W';
- if (sType === 'relation') return 'R';
- return '';
+ return formatShortOSMType(sType);
},
// { osm_type: 'R', osm_id: 12345 }
// <a href="https://www.openstreetmap.org/relation/12345">relation 12345</a
'<a href="https://' + sLanguage + '.wikipedia.org/wiki/' + sArticle + '" target="_blank">' + sTitle + '</a>'
);
},
- // { osm_type: 'R', osm_id: 12345 }
- // <a href="details.html?place_id=12345">details</a>
- detailsLink: function (aFeature, sTitle) {
- if (!aFeature) return '';
- if (!aFeature.place_id) return '';
-
- var sTitleEscaped = Handlebars.escapeExpression(sTitle || 'details >');
-
- return new Handlebars.SafeString(
- '<a href="details.html?place_id=' + aFeature.place_id + '">' + sTitleEscaped + '</a>'
- );
- },
- detailsPermaLink: function (aFeature, sTitle) {
+ // 'details.html?osmtype=R&osmid=2181874&class=boundary'
+ detailsURL: function (aFeature) {
if (!aFeature) return '';
- var sOSMType = formatOSMType(aFeature.osm_type, false);
+ var sOSMType = aFeature.osm_type;
+ if (sOSMType && sOSMType.length !== 1) {
+ sOSMType = formatShortOSMType(aFeature.osm_type, false); // node => N
+ }
if (!sOSMType) return '';
- var sTitleEscaped = Handlebars.escapeExpression(sTitle || sOSMType + ' ' + aFeature.osm_id);
-
- var sURL = 'details.html?osmtype=' + aFeature.osm_type + '&osmid=' + aFeature.osm_id;
- if (aFeature.category) {
+ var sURL = 'details.html?osmtype=' + sOSMType + '&osmid=' + aFeature.osm_id;
+ if (aFeature.class) {
+ sURL = sURL + '&class=' + aFeature.class;
+ } else if (aFeature.category) {
sURL = sURL + '&class=' + aFeature.category;
}
-
- return new Handlebars.SafeString(
- '<a href="' + sURL + '">' + sTitleEscaped + '</a>'
- );
+ return sURL;
},
formatPlaceType: function (aPlace) {
var sOut = aPlace.class + ':' + aPlace.type;
<tbody>
{{#each aPolygons}}
<tr>
- <td>{{detailsLink this place_id}}</td>
+ <td><a href="{{detailsURL this}}">{{this.place_id}}</a></td>
<td>{{country_code}}</td>
<td>{{name}}</td>
<td>{{osmLink this}}</td>
<td>{{this.rank_address}}</td>
<td>{{formatAdminLevel this.admin_level}}</td>
<td>{{formatDistance this.distance bDistanceInMeters}}</td>
- <td>{{detailsPermaLink this 'details >'}}</td>
+ <td><a href="{{detailsURL this}}">details</td>
</tr>
{{/inline}}
<div class="col-sm-10">
<h1>
{{aPlace.localname}}
- <small>{{detailsPermaLink aPlace 'link to this page'}}</small>
+ <small><a href="{{detailsURL aPlace}}">link to this page</a></small>
</h1>
</div>
<div class="col-sm-2 text-right">
<span class="type">{{formatLabel aResult}}</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}
<span class="type">({{formatLabel aResult}})</span>
<p class="coords">{{aResult.lat}},{{aResult.lon}}</p>
- <a class="details btn btn-outline-secondary btn-sm"
- href="details.html?osmtype={{shortOSMType aResult.osm_type}}&osmid={{aResult.osm_id}}">details</a>
+ <a class="details btn btn-outline-secondary btn-sm" href="{{detailsURL aResult}}">details</a>
</div>
{{/inline}}