Skip to main content

Function: normalizeLongitudes()

normalizeLongitudes(bounds): Bounds

Defined in: antimeridian.ts:27

Move bounds so that the west edge is in [-180°, 180°), keeping the width: the east edge may then run past 180°. Bounds 360° or wider become -180° to 180°.

Parameters​

bounds​

readonly [number, number, number, number]

Returns​

Bounds

Example​

Bounds one world east, as a map can give them for a view across the antimeridian, move back by 360°:

normalizeLongitudes([535, -10, 545, 10]); // [175, -10, 185, 10]
normalizeLongitudes([-400, -10, 400, 10]); // [-180, -10, 180, 10]