How to use the @here/harp-geoutils.EarthConstants.EQUATORIAL_CIRCUMFERENCE function in @here/harp-geoutils

To help you get started, we’ve selected a few @here/harp-geoutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvUtils.ts View on Github external
position: THREE.Vector2,
    flipY: boolean = false,
    target: THREE.Vector2
): THREE.Vector2 {
    if (
        decodeInfo.worldTileProjectionCookie === undefined ||
        decodeInfo.worldTileProjectionCookie.extents !== extents
    ) {
        decodeInfo.worldTileProjectionCookie = createWorldTileTransformationCookie(
            extents,
            decodeInfo
        );
    }

    const { top, left, scale } = decodeInfo.worldTileProjectionCookie;
    const R = EarthConstants.EQUATORIAL_CIRCUMFERENCE;

    return target.set(
        ((left + position.x) / scale) * R,
        ((top + (flipY ? -position.y : position.y)) / scale) * R
    );
}