PilotGaea 2D O'view
    正在準備搜尋索引...

    函數 format

    • Transforms the given ol.Coordinate to a string using the given string template. The strings {x} and {y} in the template will be replaced with the first and second coordinate values respectively.

      Example without specifying the fractional digits:

      var coord = [7.85, 47.983333];
      var template = 'Coordinate is ({x}|{y}).';
      var out = ol.coordinate.format(coord, template);
      // out is now 'Coordinate is (8|48).'
      

      Example explicitly specifying the fractional digits:

      var coord = [7.85, 47.983333];
      var template = 'Coordinate is ({x}|{y}).';
      var out = ol.coordinate.format(coord, template, 2);
      // out is now 'Coordinate is (7.85|47.98).'
      

      參數

      • coordinate: Coordinate

        Coordinate.

      • template: string

        A template string with {x} and {y} placeholders that will be replaced by first and second coordinate values.

      • 可選opt_fractionDigits: number

        The number of digits to include after the decimal point. Default is 0.

      回傳 string

      Formatted coordinate.

      stable