Skip to content

ui/map/rendering/mercatorUtils

Interfaces

LngLatPoint

Defined in: ui/map/rendering/mercatorUtils.ts:11

Shared web-mercator math for the THREE.js custom layers. The 3D aircraft and 3D route layers each position their meshes in a local meters-from- scene-origin frame; both used to carry private copies of these conversions.

Properties

lng
lng: number;

Defined in: ui/map/rendering/mercatorUtils.ts:12

lat
lat: number;

Defined in: ui/map/rendering/mercatorUtils.ts:13

Functions

relativePositionMeters()

function relativePositionMeters(origin, target): object;

Defined in: ui/map/rendering/mercatorUtils.ts:21

East/north offset in meters from origin to target, using the mercator meter scale at the origin (consistent with a scene whose camera transform is scaled by meterInMercatorCoordinateUnits at the origin).

Parameters

origin

LngLatPoint

target

LngLatPoint

Returns

object

east
east: number;
north
north: number;

altitudeScaledForOrigin()

function altitudeScaledForOrigin(
   altMeters, 
   point, 
   origin): number;

Defined in: ui/map/rendering/mercatorUtils.ts:43

Pre-scale an altitude so that, after the camera projection multiplies scene Y by meterInMercatorCoordinateUnits at the SCENE ORIGIN's lat, the resulting world Z equals altitude x per-point mercator scale. This makes altitude rendering independent of which scene origin a layer happens to use, so layers with different origins agree on visual height.

Parameters

altMeters

number

point

LngLatPoint

origin

LngLatPoint

Returns

number


mercatorCameraMatrix()

function mercatorCameraMatrix(mainMatrix, origin): Matrix4;

Defined in: ui/map/rendering/mercatorUtils.ts:61

Camera projection matrix for a scene positioned in meters relative to origin: mainMatrix x translate(origin in mercator) x uniform meter scale.

Expects the scene group to map its local (east, up, north) frame into mercator axes with a plain rotateX(PI/2) and no mirror — keeping every scale positive avoids flipping texture content (e.g. fuselage text).

Parameters

mainMatrix

ArrayLike\<number>

origin

LngLatPoint

Returns

Matrix4