Represents a position on the Earth, a triplet latitude, longitude and altitude.

const point = new Point(35.0, 145.0, 5.0);

console.log(point.latitude); // Prints 35.0
console.log(point.longitude); // Prints 145.0
console.log(point.altitude); // Prints 5.0

// Prints Point(latitude=35.0, longitude=145.0, altitude=5.0)
console.log(point.toString());

Constructors

  • Makes a Point.

    Parameters

    • latitude: number

      The latitude [deg] of the point.

    • longitude: number

      The longitude [deg] of the point.

    • altitude: number = 0.0

      The altitude [m] of the point.

    Returns Point

    const point = new Point(35.0, 145.0, 5.0);

    console.log(point.latitude); // Prints 35.0
    console.log(point.longitude); // Prints 145.0
    console.log(point.altitude); // Prints 5.0

Accessors

  • get altitude(): number
  • The altitude [m] of the point.

    Returns number

    const point = new Point(35.0, 145.0, 5.0);
    console.log(point.altitude); // Prints 5.0
  • get latitude(): number
  • The latitude [deg] of the point.

    Returns number

    const point = new Point(35.0, 145.0, 5.0);
    console.log(point.latitude); // Prints 35.0
  • get longitude(): number
  • The longitude [deg] of the point.

    Returns number

    const point = new Point(35.0, 145.0, 5.0);
    console.log(point.longitude); // Prints 145.0

Methods

  • Make a Point by adding Correction.

    Parameters

    Returns Point

    const point = new Point(0.0, 0.0, 0.0);

    // Prints Point(1.0, 1.0, 1.0)
    console.log(point.add(new Correction(1.0, 1.0, 1.0)).toString());
    // This is not in-place,
    // prints Point(0.0, 0.0, 0.0)
    console.log(point.toString());
  • Returns true is other is equal to this.

    Parameters

    • other: unknown

      The other point.

    Returns other is Point

    ture if other is equal to this.

    const point = new Point(0., 0., 0.);
    console.log(point.eq(new Point(0., 0., 0.))); // Prints true
    console.log(point.eq(new Point(1., 0., 0.))); // Prints false
  • Returns a MeshCell containing this in.

    The result is independent of altitude.

    Parameters

    Returns MeshCell

    const point = new Point(36.10377479, 140.087855041, 5.0);

    // prints:
    // MeshCell(
    // southWest=MeshNode(
    // latitude=MeshCoord(first=54, second=1, third=2),
    // longitude=MeshCoord(first=40, second=0, third=7)
    // ),
    // southEast=MeshNode(
    // latitude=MeshCoord(first=54, second=1, third=2),
    // longitude=MeshCoord(first=40, second=0, third=8)
    // ),
    // northWest=MeshNode(
    // latitude=MeshCoord(first=54, second=1, third=3),
    // longitude=MeshCoord(first=40, second=0, third=7)
    // ),
    // northEast=MeshNode(
    // latitude=MeshCoord(first=54, second=1, third=3),
    // longitude=MeshCoord(first=40, second=0, third=8)
    // ),
    // meshUnit=1
    // )
    console.log(point.meshCell(1));
  • Returns the nearest south-east MeshNode of this

    The result is independent of altitude.

    Parameters

    Returns MeshNode

    const point = new Point(36.10377479, 140.087855041, 5.0);

    // prints:
    // MeshNode(
    // latitude=MeshCoord(first=54, second=1, third=2),
    // longitude=MeshCoord(first=40, second=0, third=7)
    // )
    console.log(point.meshNode(1));
    // prints:
    // MeshNode(
    // latitude=MeshCoord(first=54, second=1, third=0),
    // longitude=MeshCoord(first=40, second=0, third=5)
    // )
    console.log(point.meshNode(5));
  • Returns true is other is not equal to this.

    Parameters

    • other: unknown

      The other Point

    Returns boolean

    const point = new Point(0., 0., 0.);
    console.log(point.ne(new Point(0., 0., 0.))) // Prints false
    console.log(point.ne(new Point(1., 0., 0.))) // Prints true
  • Makes a normalized Point from this.

    The result has normalized latitude and longitude which value -90.0 <= and <= 90.0, and -180.0 <= and <= 180.0 respectively.

    Returns Point

    const point = new Point(100.0, 200.0, 5.0).normalize();

    console.log(point.latitude); // Prints 80.0
    console.log(point.longitude); // Prints -160.0
    console.log(point.altitude); // Prints 5.0
  • Make a Point by substracting Correction.

    Parameters

    Returns Point

    const point = new Point(0.0, 0.0, 0.0);

    // Prints Point(-1.0, -1.0, -1.0)
    console.log(point.sub(new Correction(1.0, 1.0, 1.0)).toString());
    // This is not in-place,
    // prints Point(1.0, 1.0, 1.0)
    console.log(point.toString());
  • Returns a meshcode represents the nearest south-east mesh node of this.

    The result is independent of altitude.

    Parameters

    Returns number

    const point = new Point(36.10377479, 140.087855041, 50.0);

    console.log(point.toMeshcode(1)); // prints 54401027
    console.log(point.toMeshcode(5)); // prints 54401005
  • Makes a Point where the node locates.

    The resulting altitude is 0.0.

    Parameters

    Returns Point

    const node = MeshNode.fromMeshcode(54401027);
    const point = Point.fromMeshNode(node);

    console.log(point.latitude); // prints 36.1
    console.log(point.longitude); // prints 140.0875
    console.log(point.altitude); // prints 0.0
  • Makes a Point where a node, represented by meshcode code, locates.

    The resulting altitude is 0.0.

    Parameters

    • meshcode: number

      The meshcode.

    Returns Point

    const point = Point.fromMeshcode(54401027);

    console.log(point.latitude); // prints 36.1
    console.log(point.longitude); // prints 140.0875
    console.log(point.altitude); // prints 0.0