src/misc/filters.js
function NumberCoordinatesFilter($filter) {
  /**
   * @param {import("ol/coordinate.js").Coordinate} coordinates Array of two numbers.
   * @param {(number|string)=} opt_fractionDigits Optional number of digit.
   *     Default to 0.
   * @param {string=} opt_template Optional template. Default to '{x} {y}'.
   *     Where "{x}" will be replaced by the easting coordinate and "{y}" by the
   *     northing one. Note: Use a html entity to use the semicolon symbol
   *     into a template.
   * @return {string} Number formatted coordinates.
   */
  const filterFn = function(coordinates, opt_fractionDigits, opt_template) {
    const template = opt_template ? opt_template : '{x} {y}';
    const x = coordinates[0];
    const y = coordinates[1];
    const fractionDigits = parseInt(/** @type {string} */(opt_fractionDigits), 10) | 0;
    const x_str = $filter('number')(x, fractionDigits);
    const y_str = $filter('number')(y, fractionDigits);
    return template.replace('{x}', x_str).replace('{y}', y_str);
  };
  return filterFn;
}
function NumberCoordinatesFilter($filter) {
  /**
   * @param {import("ol/coordinate.js").Coordinate} coordinates Array of two numbers.
   * @param {(number|string)=} opt_fractionDigits Optional number of digit.
   *     Default to 0.
   * @param {string=} opt_template Optional template. Default to '{x} {y}'.
   *     Where "{x}" will be replaced by the easting coordinate and "{y}" by the
   *     northing one. Note: Use a html entity to use the semicolon symbol
   *     into a template.
   * @return {string} Number formatted coordinates.
   */
  const filterFn = function(coordinates, opt_fractionDigits, opt_template) {
    const template = opt_template ? opt_template : '{x} {y}';
    const x = coordinates[0];
    const y = coordinates[1];
    const fractionDigits = parseInt(/** @type {string} */(opt_fractionDigits), 10) | 0;
    const x_str = $filter('number')(x, fractionDigits);
    const y_str = $filter('number')(y, fractionDigits);
    return template.replace('{x}', x_str).replace('{y}', y_str);
  };
  return filterFn;
}
function NumberCoordinatesFilter ( $filter ) { /**
   * @param {import("ol/coordinate.js").Coordinate} coordinates Array of two numbers.
   * @param {(number|string)=} opt_fractionDigits Optional number of digit.
   *     Default to 0.
   * @param {string=} opt_template Optional template. Default to '{x} {y}'.
   *     Where "{x}" will be replaced by the easting coordinate and "{y}" by the
   *     northing one. Note: Use a html entity to use the semicolon symbol
   *     into a template.
   * @return {string} Number formatted coordinates.
   */ const filterFn = function ( coordinates , opt_fractionDigits , opt_template ) { const template = opt_template ? opt_template : '{x} {y}' ; const x = coordinates [ 0 ] ; const y = coordinates [ 1 ] ; const fractionDigits = parseInt ( /** @type {string} */ ( opt_fractionDigits ) , 10 ) | 0 ; const x_str = $filter ( 'number' ) ( x , fractionDigits ) ; const y_str = $filter ( 'number' ) ( y , fractionDigits ) ; return template . replace ( '{x}' , x_str ) . replace ( '{y}' , y_str ) ; } ; return filterFn ; }
Format a couple of numbers as number coordinates.

Example without parameters:

<p>{{[7.1234, 46.9876] | ngeoNumberCoordinates}}</p>
<!-- will Become 7 47 -->

Example with defined fractionDigits and template (en-US localization):

<!-- With en-US localization -->
<p>{{[7.1234, 46.9876] | ngeoNumberCoordinates:2:'co {x} E; {y} N'}}</p>
<!-- will Become co 7.12 E; 46.99 N -->
<br/>
<!-- With en-US localization -->
<p>{{[2600000, 1600000] | ngeoNumberCoordinates:0:'{x}, {y}'}}</p>
<!-- will Become 2,600,000, 1,600,000 -->
<br/>
<!-- With fr-CH localization -->
<p>{{[2600000, 1600000] | ngeoNumberCoordinates:0:'{x}, {y}'}}</p>
<!-- will Become 2'600'000, 1'600'000 -->

@param {angular.IFilterService} $filter Angular filter
@return {numberCoordinates} A function to format numbers into coordinates string.
@ngInject
@ngdoc filter
@ngname ngeoNumberCoordinates
Format a couple of numbers as number coordinates .