Makes a 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);
The description, or the header of par-formatted data.
Static
MAX_Max error of Transformer.backward and Transformer.backwardCorrection.
Equals to 5e-14
.
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).
The origin
The backwardly transformed point
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
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.
The origin
The backwardly transformed point
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
Return the correction on backward-transformation.
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
Return the verified correction on backward-transformation.
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
Returns the forward-transformed position from point
.
The origin
The forwardly transformed point
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
Return the correction on forward-transformation.
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
Static
fromDeserialize 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.
The par formatted text
The format of the text
Optional
description: string// 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);
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.
Example