The coordinate Transformer, and represents a deserializing result of par-formatted data.

If the parameters is zero, such as the unsupported components, the transformations are identity transformation on such components. For example, the transformation by the TKY2JGD and the PatchJGD par is identity transformation on altitude, and by the PatchJGD(H) par is so on latitude and longitude.

// Contents of SemiDyna2023.par
const contents = "...";
const tf = Transformer.fromString(contents, "SemiDynaEXE");

// Geospatial Information Authority of Japan
const origin = new Point(36.10377479, 140.087855041, 2.34);

// forward transformation
const result = tf.forward(origin);
// prints Point(latitude=36.103773017086695, longitude=140.08785924333452, altitude=2.4363138578103)
console.log(result.toString());

// verified backward transformation
const q = tf.backwardCompat(result);
// prints Point(latitude=36.10377479, longitude=140.087855041, altitude=2.34)
console.log(q.toString());

// backward transformation compatible to GIAJ web app/APIs
const p = tf.backward(result);
// prints Point(latitude=36.10377479000002, longitude=140.087855041, altitude=2.339999999578243)
console.log(p.toString());

Constructors

  • Makes a Transformer.

    Parameters

    • format: Format

      The format of par file

    • parameter: Map<number, Parameter>

      The transformation parameter

    • Optionaldescription: string

      The description

    Returns Transformer

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    ]),
    );

    // prints "SemiDynaEXE"
    console.log(tf.format);
    // prints 5
    console.log(tf.unit());
    // prints Map(2) { 54401005 => Parameter { ... }, 54401055 => Parameter { ... }}
    console.log(tf.parameter);
    // prints undefined
    console.log(tf.description);

Accessors

  • get description(): undefined | string
  • The description, or the header of par-formatted data.

    Returns undefined | string

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    ]),
    "my SemiDynaEXE"
    );

    // prints "my SemiDynaEXE"
    console.log(tf.description);
  • get format(): Format
  • The format of par file.

    Returns Format

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    ]),
    "my SemiDynaEXE"
    );

    // prints "SemiDynaEXE"
    console.log(tf.format);
  • get parameter(): Map<number, Parameter>
  • The transformation parameter.

    The entry represents single line of par-formatted file's parameter section, the key is meshcode, and the value parameter.

    Returns Map<number, Parameter>

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    ]),
    "my SemiDynaEXE"
    );

    // prints Map(2) { 54401005 => Parameter { ... }, 54401055 => Parameter { ... }}
    console.log(tf.parameter);

Methods

  • Returns the backward-transformed position.

    The result's error from an exact solution is suppressed under Transformer.MAX_ERROR.

    Notes, the error is less than 1e-9 [deg], which is error of GIAJ latitude and longitude parameter. This implies that altitude's error is less than 1e-5 [m], which is error of the GIAJ altitude parameter.

    This is not compatible to GIAJ web app/APIs (but more accurate).

    Parameters

    Returns Point

    The backwardly transformed point

    error.PointError

    error.ParameterNotFoundError

    error.CorrectionNotFoundError

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    [54401055, new Parameter(-0.00663, 0.01492, 0.10374)],
    [54401055, new Parameter(-0.00664, 0.01506, 0.10087)],
    ]),
    );

    const origin = new Point(36.103773017086695, 140.08785924333452, 2.4363138578103);
    const result = tf.backward(origin);

    // In this case, no error remains.
    console.log(result.latitude); // Prints 36.10377479, exact: 36.10377479
    console.log(result.longitude); // Prints 140.087855041, exact: 140.087855041
    console.log(result.altitude); // Prints 2.34, exact: 2.34

    Transformer.backwardCorrection

  • Returns the backward-transformed position compatible to GIAJ web app/APIs.

    This is compatible to GIAJ web app/APIs, and is not exact as the original as.

    Parameters

    Returns Point

    The backwardly transformed point

    error.PointError

    error.ParameterNotFoundError

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    [54401055, new Parameter(-0.00663, 0.01492, 0.10374)],
    [54401055, new Parameter(-0.00664, 0.01506, 0.10087)],
    ]),
    );

    const origin = new Point(36.103773017086695, 140.08785924333452, 2.4363138578103);
    const result = tf.backwardCompat(origin);

    console.log(result.latitude); // Prints 36.10377479000002, exact: 36.10377479
    console.log(result.longitude); // Prints 140.087855041, exact: 140.087855041
    console.log(result.altitude); // Prints 2.339999999578243, exact: 2.34

    Transformer.backwardCompatCorrection

  • Return the correction on backward-transformation.

    Parameters

    Returns Correction

    error.PointError

    error.ParameterNotFoundError

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    [54401055, new Parameter(-0.00663, 0.01492, 0.10374)],
    [54401055, new Parameter(-0.00664, 0.01506, 0.10087)],
    ]),
    );

    const origin = new Point(36.103773017086695, 140.08785924333452, 0.0);
    const corr = tf.backwardCompatCorrection(origin);

    console.log(corr.latitude); // Prints 1.7729133219831587e-6
    console.log(corr.longitude); // Prints -4.202334509042613e-6
    console.log(corr.altitude); // Prints -0.0963138582320569

    Transformer.backwardCompat

  • Return the verified correction on backward-transformation.

    Parameters

    Returns Correction

    error.PointError

    error.ParameterNotFoundError

    error.CorrectionNotFoundError

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    [54401055, new Parameter(-0.00663, 0.01492, 0.10374)],
    [54401055, new Parameter(-0.00664, 0.01506, 0.10087)],
    ]),
    );

    const origin = new Point(36.103773017086695, 140.08785924333452, 0.0);
    const corr = tf.backwardCorrection(origin);

    console.log(corr.latitude); // Prints 1.7729133100878255e-6
    console.log(corr.longitude); // Prints -4.202334510058886e-6
    console.log(corr.altitude); // Prints -0.09631385781030007

    Transformer.backward

  • Returns the forward-transformed position from point.

    Parameters

    Returns Point

    The forwardly transformed point

    error.PointError

    error.ParameterNotFoundError

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    [54401055, new Parameter(-0.00663, 0.01492, 0.10374)],
    [54401055, new Parameter(-0.00664, 0.01506, 0.10087)],
    ]),
    );

    const origin = new Point(36.10377479, 140.087855041, 2.34);
    const result = tf.forward(origin);

    console.log(result.latitude); // Prints 36.103773017086695
    console.log(result.longitude); // Prints 140.08785924333452
    console.log(result.altitude); // Prints 2.4363138578103

    Transformer.forwardCorrection

  • Return the correction on forward-transformation.

    Parameters

    Returns Correction

    error.PointError

    error.ParameterNotFoundError

    const tf = new Transformer(
    "SemiDynaEXE",
    new Map([
    [54401005, new Parameter(-0.00622, 0.01516, 0.0946)],
    [54401055, new Parameter(-0.0062, 0.01529, 0.08972)],
    [54401055, new Parameter(-0.00663, 0.01492, 0.10374)],
    [54401055, new Parameter(-0.00664, 0.01506, 0.10087)],
    ]),
    );

    const origin = new Point(36.10377479, 140.087855041, 0.0);
    const corr = tf.forwardCorrection(origin);

    console.log(corr.latitude); // Prints -1.7729133100878255e-6
    console.log(corr.longitude); // Prints 4.202334510058886e-6
    console.log(corr.altitude); // Prints 0.09631385781030007

    Transformer.forward

  • Returns the meshUnit of the format.

    Returns MeshUnit

    The meshUnit of the format.

    // Prints 1
    console.log(new Transformer("TKY2JGD", new Map()).unit());
    // Prints 5
    console.log(new Transformer("SemiDynaEXE", new Map()).unit());
  • Deserialize par-formatted string into a Transformer.

    This fills by 0.0 for altitude parameter when "TKY2JGD" or "PatchJGD" given, and for latitude and longitude when "PatchJGD_H" or "HyokoRev" given.

    Parameters

    • text: string

      The par formatted text

    • format: Format

      The format of the text

    • Optionaldescription: string

    Returns Transformer

    error.ParseParError

    // Contents of SemiDyna2023.par
    const contents = "...";
    const tf = Transformer.fromString(contents, "SemiDynaEXE");

    // prints "SemiDynaEXE"
    console.log(tf.format);
    // prints all parameters
    console.log(tf.parameter);
    // prints first 16 lines
    console.log(tf.description);

    const point = new Point(35.0, 135.0);
    const result = tf.forward(point);