Skip to content

Commit

Permalink
Add message if no elevation data is available
Browse files Browse the repository at this point in the history
  • Loading branch information
bagage committed Feb 24, 2021
1 parent 86891e3 commit 1d83804
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -770,3 +770,16 @@ table.dataTable.display tbody tr:hover.selected {
content: '\f06a'; /* fa-exclamation */
margin-left: 3px;
}

#elevation-chart {
position: relative;
}

#no-elevation-data {
z-index: 1000;
margin: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,11 @@ <h1 class="leaflet-sidebar-header">
</div>
</div>

<div class="collapse" id="elevation-chart"></div>
<div class="collapse" id="elevation-chart">
<span id="no-elevation-data" data-i18n="footer.no-elevation-data" style="display: none"
>No elevation data available for this route.</span
>
</div>

<footer class="flexrow">
<div id="stats-info" class="flexgrow">
Expand Down
7 changes: 7 additions & 0 deletions js/plugin/Heightgraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ BR.Heightgraph = function (map, layersControl, routing, pois) {
}

if (track && track.getLatLngs().length > 0) {
// there is no elevation data available above 60°N, except within 10°E-30°E (issue #365)
var bounds = track.getBounds();
if (bounds.getSouth() > 60 && (bounds.getEast() > 30 || bounds.getWest() < 10)) {
$('#no-elevation-data').show();
} else {
$('#no-elevation-data').hide();
}
var geojsonFeatures = geoDataExchange.buildGeojsonFeatures(track.getLatLngs());
this.addData(geojsonFeatures);

Expand Down
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"mean-cost-factor": "Mean cost factor",
"meter": "meters",
"meter-abbrev": "m",
"no-elevation-data": "No elevation data available for this route.",
"plain-ascend": "Plain ascend",
"stats-info": "Start drawing a route to get stats.",
"total-energy": "Total Energy",
Expand Down

0 comments on commit 1d83804

Please sign in to comment.