Provides geodesy calculations. Use the factory methods in the GeodesyFactory module to create instances of this interface. For boolean operations on shapes see the ConstructiveGeometryFactory module.

interface Geodesy {
    reference: null | CoordinateReference;
    area(shape): number;
    distance(point1, point2, lineType?): number;
    distance3D(point1, point2, lineType?): number;
    forwardAzimuth(point1, point2, lineType?): number;
    interpolate(startPoint, endPoint, fraction, lineType?): Point;
    interpolate(point, distance, azimuth, lineType?): Point;
    shortestDistanceToLine(fromPoint, linePointOne, linePointTwo, options, resultPointSFCT): number;
}

Properties

reference: null | CoordinateReference

The reference in which this geodesy performs its calculations

Methods

  • Calculates the area of the given shape.

    Beware: this method calculates the 2D area of the passed shape. I.e. it ignore the z-values of the shape that is passed to this method.

    As an additional consequence, using a shape defined in a geocentric (3D cartesian) reference can not work correctly when using a cartesian geodesy. In that case, a ProgrammingError is thrown.

    Note: Currently only polygons are supported.

    Parameters

    • shape: Shape

      The shape for which to calculate the area.

    Returns number

    The area of the shape in m^2.

  • Calculates the distance between two points in meters in 2D space.

    If the reference of a point is null it will be assumed to be the same as this instance's calculation reference.

    Parameters

    Returns number

    the distance between the two points in meters

  • Calculates the distance between two points in 3D space expressed in meters (Cartesian Geodesy only).

    This method can be used only on Geodesy instances created by createCartesianGeodesy. Invoking this method on other types of Geodesy results in throwing a ProgrammingError.

    Parameters

    Returns number

    the distance between two points in 3D space expressed in meters.

    Throws

    ProgrammingError if method invoked on incorrect Geodesy instance.

  • Calculates the forward azimuth between two points.

    If the reference of a point is null it will be assumed to be the same as this instances calculation reference.

    Parameters

    Returns number

    the forward azimuth between the two points in degrees

  • Interpolate a point at the fraction of the segment defined by the two points.

    If the reference of the input point(s) is null it will be assumed to be the same as this instance's calculation reference.

    Parameters

    • startPoint: Point

      the starting point

    • endPoint: Point

      the end point.

    • fraction: number

      a fraction between 0.0 and 1.0.

    • Optional lineType: LineType

      the line type along which to compute the point (LineType.SHORTEST_DISTANCE if not specified)

    Returns Point

    an interpolated point specified with respect to the calculation reference

  • Computes the point at a given distance and azimuth from the given point.

    If the reference of the input point(s) is null it will be assumed to be the same as this instance's calculation reference.

    If the distance is negative, this will result in an interpolation in the opposite direction.

    Parameters

    • point: Point

      the starting point

    • distance: number

      the distance in meters

    • azimuth: number

      the azimuth (this is an angle in degrees)

    • Optional lineType: LineType

      the line type along which to compute the point (LineType.SHORTEST_DISTANCE if not specified)

    Returns Point

    an interpolated point specified with respect to the calculation reference

  • Calculates the shortest distance from point fromPoint to the line linePointOne-linePointTwo . Puts the result in the given point as a side effect, and returns the distance from fromPoint to that calculated point.

    Parameters

    • fromPoint: Point

      The point from which to calculate the distance to the line.

    • linePointOne: Point

      The first point of the line

    • linePointTwo: Point

      The second point of the line

    • options: ShortestDistanceToLineOptions

      The options for the calculation

    • resultPointSFCT: Point

      Point on the line linePointOne-linePointTwo that is calculated to be at the shortest distance from fromPoint. This point may be clipped onto the line segment depending on the value of clipToSegment property in the options.

    Returns number

    The distance to the line (or line segment) in meters