IFClite TypeScript API
    Preparing search index...

    Interface CrsTransformer

    @ifc-lite/geo — headless CRS engine.

    Resolve a CRS, convert points to and from WGS84, read grid convergence and point scale, and look up the EGM96 geoid undulation. Works in Node and the browser, and makes no network request unless the host installs a loader.

    The definition-string functions the viewer builds on are the separate @ifc-lite/geo/proj4 entry; reading a WKT without resolving it is @ifc-lite/geo/wkt.

    interface CrsTransformer {
        datumShift: CrsDatumShift;
        definition: string;
        epsg: number | null;
        kind: "projected" | "geographic";
        linearUnit: LinearUnit | null;
        fromWgs84(
            coordinate: Coordinate,
        ): [number, number] | [number, number, number] | null;
        gridFactors(x: number, y: number): GridPointFactors | null;
        toWgs84(
            coordinate: Coordinate,
        ): [number, number] | [number, number, number] | null;
    }
    Index
    datumShift: CrsDatumShift

    How the datum shift of definition is carried out. Fixed for this transformer.

    definition: string

    The proj4 definition in use. Either a proj4 string or, for a WKT, a handle registered with this package's proj4 instance; treat it as opaque.

    epsg: number | null

    The EPSG code the input resolved through, when it named one.

    kind: "projected" | "geographic"

    geographic: coordinates are degrees. projected: metres.

    linearUnit: LinearUnit | null

    The unit the CRS itself is defined in, and its length in metres: the US survey foot (1200/3937 m) for a State Plane CRS in feet. Coordinates going into and coming out of this transformer are still metres; divide by toMetres to get the CRS's own numbers. null for a geographic CRS, or when the definition names a unit this package does not know.

    • WGS84 [longitude, latitude] in degrees to CRS coordinates. null with the same refusals as toWgs84: a non-finite or out-of-range input, a position outside a loaded grid's coverage or the WKT's declared extent. z is returned unchanged.

      Parameters

      Returns [number, number] | [number, number, number] | null

    • Grid convergence (gamma, radians, counter-clockwise positive: grid north is true north rotated by +gamma) and point scale factor (pointScale, grid distance over WGS84-ellipsoid distance) at a point of a projected CRS. null for a geographic CRS, within 0.1 degrees of a pole, or where the projection cannot be evaluated.

      Parameters

      • x: number
      • y: number

      Returns GridPointFactors | null

    • CRS coordinates to WGS84 [longitude, latitude] in degrees. null when the input (a given z included) is not finite, lies outside a loaded grid's coverage or the extent the WKT declares, or does not map to a valid position.

      z is returned unchanged: there is no vertical transformation, so a height above the CRS's vertical datum stays exactly that.

      Parameters

      Returns [number, number] | [number, number, number] | null