diff --git a/src/ol/coordinate.js b/src/ol/coordinate.js index 21c230115d..eea13ca6c9 100644 --- a/src/ol/coordinate.js +++ b/src/ol/coordinate.js @@ -101,14 +101,13 @@ ol.coordinate.createStringXY = function(opt_fractionDigits) { /** - * @private - * @param {number} degrees Degrees. * @param {string} hemispheres Hemispheres. + * @param {number} degrees Degrees. * @param {number=} opt_fractionDigits The number of digits to include * after the decimal point. Default is `0`. * @return {string} String. */ -ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fractionDigits) { +ol.coordinate.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionDigits) { var normalizedDegrees = ol.math.modulo(degrees + 180, 360) - 180; var x = Math.abs(3600 * normalizedDegrees); var dflPrecision = opt_fractionDigits || 0; @@ -130,8 +129,8 @@ ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fraction } return deg + '\u00b0 ' + ol.string.padNumber(min, 2) + '\u2032 ' + - ol.string.padNumber(sec, 2, dflPrecision) + '\u2033 ' + - hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0); + ol.string.padNumber(sec, 2, dflPrecision) + '\u2033' + + (normalizedDegrees == 0 ? '' : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0)); }; @@ -313,8 +312,8 @@ ol.coordinate.squaredDistanceToSegment = function(coordinate, segment) { */ ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) { if (coordinate) { - return ol.coordinate.degreesToStringHDMS_(coordinate[1], 'NS', opt_fractionDigits) + ' ' + - ol.coordinate.degreesToStringHDMS_(coordinate[0], 'EW', opt_fractionDigits); + return ol.coordinate.degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' + + ol.coordinate.degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits); } else { return ''; }