Represents mesh node, a pair of the MeshCoord instances.

We note that this supports non-negative latitude and longitude only, and longitude satisfies MeshCoord(0, 0, 0) <= and <= MeshCoord(80, 0, 0).

const point = new Point(36.10377479, 140.087855041);

let node = MeshNode.ofPoint(point, 1);
// Prints MeshNode(latitude=MeshCoord(first=54, second=1, third=2), longitude=MeshCoord(first=40, second=0, third=7))
console.log(node.toString());

let node = MeshNode.ofPoint(point, 5);
// Prints MeshNode(latitude=MeshCoord(first=54, second=1, third=0), longitude=MeshCoord(first=40, second=0, third=5))
console.log(node.toString());

Constructors

  • Makes a MeshNode instance.

    Parameters

    • latitude: MeshCoord

      The mesh coord of latitude.

    • longitude: MeshCoord

      The mesh coord of longitude.

    Returns MeshNode

    const point = new Point(36.10377479, 140.087855041);

    let node = MeshNode.ofPoint(point, 1);
    // Prints MeshNode(latitude=MeshCoord(first=54, second=1, third=2), longitude=MeshCoord(first=40, second=0, third=7))
    console.log(node.toString());

    let node = MeshNode.ofPoint(point, 5);
    // Prints MeshNode(latitude=MeshCoord(first=54, second=1, third=0), longitude=MeshCoord(first=40, second=0, third=5))
    console.log(node.toString());

Accessors

  • get latitude(): MeshCoord
  • The latitude of MeshNode.

    Returns MeshCoord

    const node = new MeshNode(new MeshCoord(54, 1, 2), new MeshCoord(40, 0, 7));
    // Prints MeshCoord(first=54, second=1, third=2)
    console.log(node.latitude.toString());
  • get longitude(): MeshCoord
  • The longitude of MeshNode.

    Returns MeshCoord

    const node = new MeshNode(new MeshCoord(54, 1, 2), new MeshCoord(40, 0, 7));
    // Prints MeshCoord(first=40, second=0, third=7)
    console.log(node.longitude.toString());

Methods

  • Returns true is other is equal to this.

    Parameters

    • other: unknown

    Returns other is MeshNode

    const node = new MeshNode(new MeshCoord(54, 1, 2), new MeshCoord(40, 0, 7));
    // Prints true
    console.log(node.eq(new MeshNode(new MeshCoord(54, 1, 2), new MeshCoord(40, 0, 7))));
    // Prints false
    console.log(node.eq(new MeshNode(new MeshCoord(0, 0, 0), new MeshCoord(0, 0, 0))));
  • Returns true if this is compatible to the meshUnit.

    Parameters

    • meshUnit: MeshUnit

      the mesh unit, 1 or 5

    Returns boolean

    true if this is compatible to the meshUnit

    const node = MeshNode.fromMeshcode(54401027);
    console.log(node.isMeshUnit(1)); // Prints true
    console.log(node.isMeshUnit(5)); // Prints false
  • Returns true is other is not equal to this.

    Parameters

    • other: unknown

    Returns boolean

    const node = new MeshNode(new MeshCoord(54, 1, 2), new MeshCoord(40, 0, 7));
    // Prints false
    console.log(node.ne(new MeshNode(new MeshCoord(54, 1, 2), new MeshCoord(40, 0, 7))));
    // Prints true
    console.log(node.ne(new MeshNode(new MeshCoord(0, 0, 0), new MeshCoord(0, 0, 0))));
  • Returns a meshcode represents this.

    The result is up to 8 digits.

    Returns number

    The meshcode.

    const node = new MeshNode(new MeshCoord(54, 1, 2), new MeshCoord(40, 0, 7));
    console.log(node.toMeshcode()); // Prints 54401027
  • Returns a Point (latitude and longitude) where this locates.

    Returns Point

    The point.

    const node = new MeshNode(new MeshCoord(54, 1, 2), new MeshCoord(40, 0, 7));
    // Prints Point(latitude=36.1, longitude=140.0875, altitude=0.0)
    console.log(node.toPoint());
  • Makes a MeshNode obj represented by meshcode.

    Parameters

    • meshcode: number

      The meshcode.

    Returns MeshNode

    A MeshNode obj.

    const node = MeshNode.fromMeshcode(54401027);
    // Prints MeshNode(latitude=MeshCoord(first=54, second=1, third=2), longitude=MeshCoord(first=40, second=0, third=7))
    console.log(node.toString());
  • Makes the nearest north-west MeshNode of point.

    Parameters

    • point: Point

      The point.

    • meshUnit: MeshUnit

      The unit of the mesh, 1 or 5.

    Returns MeshNode

    A MeshNode instance.

    const point = new Point(36.103774791666666, 140.08785504166664, 10.0);

    let node = MeshNode.fromPoint(point, 1);
    // Prints MeshNode(latitude=MeshCoord(first=54, second=1, third=2), longitude=MeshCoord(first=40, second=0, thrid=7))
    console.log(node.toString());

    let node = MeshNode.fromPoint(point, 5);
    // Prints MeshNode(latitude=MeshCoord(first=54, second=1, third=0), longitude=MeshCoord(first=40, second=0, thrid=5))
    console.log(node.toString());