Skip to content

Commit

Permalink
Distance units consistent with gui display.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zivi committed May 6, 2016
1 parent 8e0fae7 commit b4e9374
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,17 @@ function initAutoComplete(field) {
}

function calcRoute() {
var unitSystem = google.maps.UnitSystem.IMPERIAL;
var start = $("#from").val() || $("#from").attr("placeholder");
var end = $("#to").val() || $("#to").attr("placeholder");
var travelMode = $("#travel-mode").val();
if (measurementMode === "km") {
unitSystem = google.maps.UnitSystem.METRIC;
};
var request = {
origin: start,
destination: end,
unitSystem: unitSystem,
travelMode: google.maps.TravelMode[travelMode.toUpperCase()]
};
var DirectionsService = new google.maps.DirectionsService();
Expand Down Expand Up @@ -196,7 +201,7 @@ function plotElevation(elevations, status) {
for (i = 0; i < elevations.length; i++) {

// Change elevation from meters to feet.
if(measurementMode == "miles"){
if(measurementMode === "miles"){
feetMultiplicator = 3.28084;
}
else{
Expand Down

0 comments on commit b4e9374

Please sign in to comment.