@kayahr/etchmap
    Preparing search index...

    Interface Projection

    A reversible mapping between source coordinates and normalized tile-world coordinates.

    For example, the built-in WebMercatorProjection interprets source X as longitude and source Y as latitude, both in degrees.

    interface Projection {
        interpolateLine?(start: Point, end: Point, ratio: number): Point;
        project(point: Point): Point;
        unproject(point: Point): Point;
    }

    Implemented by

    Index
    • Optionally interpolates the natural route between two source-coordinate points.

      Custom projections may omit this method. In that case, path vertices are projected directly and connected with linear segments in projected viewport coordinates, making natural interpolation behave like projected interpolation.

      Implementations must accept finite coordinates and a ratio from zero through one, and must return a point with finite coordinates.

      Parameters

      • start: Point

        Route start in source coordinates.

      • end: Point

        Route end in source coordinates.

      • ratio: number

        Interpolation ratio between zero for start and one for end.

      Returns Point

      Interpolated point in source coordinates.

      Any implementation-defined exception. The built-in implementation throws RangeError when ratio is not finite.

    • Converts source coordinates into normalized tile-world coordinates.

      The normalized tile world conventionally spans zero through one on both axes, but coordinates outside that range are allowed so clipping can preserve paths beyond finite tile-world edges. Implementations must return a point with finite coordinates.

      Parameters

      • point: Point

        Point in source coordinates.

      Returns Point

      Point in normalized tile-world coordinates.

      Any implementation-defined exception.

    • Converts normalized tile-world coordinates into source coordinates.

      Implementations must return a point with finite coordinates.

      Parameters

      • point: Point

        Point in normalized tile-world coordinates.

      Returns Point

      Point in source coordinates.

      Any implementation-defined exception.