Pad min. and sec. with leading zeros in DMS notation
FIxes 3776
This commit is contained in:
@@ -3,6 +3,7 @@ goog.provide('ol.CoordinateFormatType');
|
||||
goog.provide('ol.coordinate');
|
||||
|
||||
goog.require('goog.math');
|
||||
goog.require('goog.string');
|
||||
|
||||
|
||||
/**
|
||||
@@ -129,8 +130,8 @@ ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres) {
|
||||
var normalizedDegrees = goog.math.modulo(degrees + 180, 360) - 180;
|
||||
var x = Math.abs(Math.round(3600 * normalizedDegrees));
|
||||
return Math.floor(x / 3600) + '\u00b0 ' +
|
||||
Math.floor((x / 60) % 60) + '\u2032 ' +
|
||||
Math.floor(x % 60) + '\u2033 ' +
|
||||
goog.string.padNumber(Math.floor((x / 60) % 60), 2) + '\u2032 ' +
|
||||
goog.string.padNumber(Math.floor(x % 60), 2) + '\u2033 ' +
|
||||
hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user