Globals


Instance Methods

TAItoTDB(tai: JulianDate): JulianDate

Converts atomic time to barycentric dynamical time.

Parameters

  • tai (JulianDate) — Atomic time.

Returns

  • JulianDate

getSunPosition(jDate: JulianDate): Vec3

Returns Sun position in the geocentric coordinate system by the time.

Parameters

  • jDate (JulianDate) — Julian date time.

Returns

T(jd: JulianDate): number

Returns julian days from Epoch.

Parameters

  • jd (JulianDate) — Julian date.

Returns

  • number — Days from epoch

getDayNumber(year: number, month: number, day: number): number

Gets the date's julian day.

Parameters

  • year (number) — Year.
  • month (number) — Month.
  • day (number) — Day.

Returns

  • number — Day number

DateToUTC(date: Date): JulianDate

Converts javascript date to the universal(UTC) julian date.

Parameters

  • date (Date) — Date.

Returns

  • JulianDate — UTC julian date

DateToTAI(date: Date): JulianDate

Converts javascript date to the atomic(TAI) julian date.

Parameters

  • date (Date) — Date.

Returns

  • JulianDate — TAI julian date

UTCtoTAI(jd: JulianDate): JulianDate

Converts coordinated universal(UTC) julian date to atomic(TAI) julian date.

Parameters

  • jd (JulianDate) — UTC julian date.

Returns

  • JulianDate — TAI julian date

TAItoUTC(tai: JulianDate): JulianDate | undefined

Converts atomic julian date(TAI) to the coordinated universal(UTC) julian date.

Parameters

  • tai (JulianDate) — TAI julian date.

Returns

  • JulianDate | undefined — UTC julian date

UTCtoDate(utc: JulianDate): Date

Converts UTC julian date to the javascript date object.

Parameters

  • utc (JulianDate) — UTC julian date.

Returns

  • Date — JavaScript Date object

TAItoDate(tai: JulianDate): Date

Converts TAI julian date to the javascript date object.

Parameters

  • tai (JulianDate) — TAI julian date.

Returns

  • Date — JavaScript Date object

addMilliseconds( jd: JulianDate, milliseconds: number, ): JulianDate

Adds milliseconds to the julian date.

Parameters

  • jd (JulianDate) — Julian date.
  • milliseconds (number) — Milliseconds to add.

Returns

  • JulianDate — Julian date

addSeconds(jd: JulianDate, seconds: number): JulianDate

Adds seconds to the julian date.

Parameters

  • jd (JulianDate) — Julian date.
  • seconds (number) — Seconds to add.

Returns

  • JulianDate — Julian date

addHours(jd: JulianDate, hours: number): JulianDate

Adds hours to the julian date.

Parameters

  • jd (JulianDate) — Julian date.
  • hours (number) — Hours to add.

Returns

  • JulianDate — Julian date

addMinutes(jd: JulianDate, minutes: number): JulianDate

Adds minutes to the julian date.

Parameters

  • jd (JulianDate) — Julian date.
  • minutes (number) — Minutes to add.

Returns

  • JulianDate — Julian date

addDays(jd: JulianDate, days: number): JulianDate

Adds days to the julian date.

Parameters

  • jd (JulianDate) — Julian date.
  • days (number) — Days to add.

Returns

  • JulianDate — Julian date

getMilliseconds(jd: JulianDate): number

Gets milliseconds of a julian date.

Parameters

  • jd (JulianDate) — julian date.

Returns

  • number — Milliseconds

getSeconds(jd: JulianDate): number

Gets seconds of a julian date.

Parameters

  • jd (JulianDate) — julian date.

Returns

  • number — Seconds

getHours(jd: JulianDate): number

Gets hours of a julian date.

Parameters

  • jd (JulianDate) — julian date.

Returns

  • number — Hours

getMinutes(jd: JulianDate): number

Gets minutes of a julian date.

Parameters

  • jd (JulianDate) — julian date.

Returns

  • number — Minutes

getDays(jd: JulianDate): number

Gets days of a julian date.

Parameters

  • jd (JulianDate) — julian date.

Returns

  • number — Days

secondsToDays(s: number): number

Returns days in seconds.

Parameters

  • s (number) — Seconds.

Returns

  • number — Days

daysToSeconds(d: number): number

Returns seconds in days.

Parameters

  • d (number) — Days.

Returns

  • number — Seconds

formatDate()

Formats a date by a template, e.g. "MM/dd/yyyy", "hh:mm:ss.ms". Tokens: yyyy/yy year, MMM month name, MM/M month, dd/d day, hh/h hours, mm/m minutes, ss/s seconds, ms milliseconds, a/A am/pm. Case matters for M/m only. On a 12-hour clock am/pm is appended after the time unless the template places it with "a".

densifyPath( path: Array.<CoordinatesType>, isClosed: boolean, step?: number, ): Array.<CoordinatesType>

Returns the path with points between the ones further apart than the step in longitude or latitude, the closed path gets them on the edge from its last point to the first one too.

Parameters

  • path (Array.<CoordinatesType>) — Geodetic points.
  • isClosed (boolean) — The last point goes back to the first one.
  • step (number, optional) — Longest segment in degrees.

Returns

  • Array.<CoordinatesType>

removeRepeatedPoints( path: Array.<CoordinatesType>, isClosed: boolean, ): Array.<CoordinatesType>

Returns the path without the points equal to the point before them, a closed path also without its last points equal to the first one, as a GeoJSON ring has it. A segment of no length has no direction, so a line can't join the segments around it.

Parameters

  • path (Array.<CoordinatesType>) — Geodetic points.
  • isClosed (boolean) — The last point goes back to the first one.

Returns

  • Array.<CoordinatesType>

gridPointsInside()

The nodes of the grid inside the polygon, not too close to its rings: a scan along each grid row with the ring segments that reach it.

splitLongEdges()

Splits the triangles with an edge longer than the step, but for the rounding, at the middle of their longest edge until there is none. Every triangle of a long edge splits it at the same point, so the triangles stay joined.

triangulateDelaunay()

The constrained Delaunay triangulation of the ring points and of the grid points inside, the triangles out of the polygon and in its holes are left out. Throws when the rings are not a valid polygon.

splitConvex()

Splits a convex polygon by the line where the coordinate on the axis is the value, into the parts below and above. The point on the line is the same for both parts and for every polygon with that edge, whichever way it goes.

triangulateEarcut()

Earcut triangles cut by the grid. Earcut takes the rings that are not a valid polygon too.

triangulateOnGrid( rings: Array.<Array.<CoordinatesType>>, step: number, ): Object

Triangulates a polygon with no edge longer than the step, for the cube tiles.

Parameters

  • rings (Array.<Array.<CoordinatesType>>) — Geodetic rings, the outer one and the holes.
  • step (number) — Longest edge in degrees.

Returns

  • Object

getCubeFaceExtents( points: Array.<LonLat>, proj: CubeProj, ): Array.<(Extent|null)>

Returns the rectangles of the image points on the cube faces, in the native coordinates of the faces, null for a face the image does not reach. A rectangle is of the points in front of the face plane, on its extension, cut by the face.

Parameters

  • points (Array.<LonLat>) — Points of the image grid.
  • proj (CubeProj) — Cube projection.

Returns

stretchChannel()

Fills the contrast stretch of a channel from the band statistics, keeping an explicit stretch untouched.

_entitiesConstructor( entities: Array.<Entity> | Array.<IEntityParams>, ): Array.<Entity>

Creates entity instance array.

Parameters

  • entities (Array.<Entity> | Array.<IEntityParams>) — Entity array.

Returns

parseColor()

Parses a hex, rgb, or named color string into RGBA [0..255] values.

buildColorLUT()

Builds a 256-color RGBA Lookup Table (Uint8Array of size 1024) from render options.

parseNoDataValue()

Parses and normalizes a nodata value from various representations (number, null, string "NaN", NaN, etc.).

isNoData()

Checks if a raster value represents NoData, taking NaN, null, and float precision into account.

getFastNoDataChecker()

Returns a high-performance nodata checking predicate for inner pixel loops.

getRasterMinMax()

Calculates min and max from a raster array, ignoring NaN and NoData.

createImageData()

Creates an ImageData instance with fallback for non-browser/worker/test environments.

renderSingleBandToImageData()

Renders a single band raster to an ImageData using a color LUT.

renderMultiBandToImageData()

Renders 3 separate band arrays into an RGB ImageData.

renderRgbRastersToImageData()

Converts raw RGB/RGBA raster array(s) directly to an ImageData.

forwardUTM()

Projects WGS84 LonLat degrees [lon, lat] to UTM coordinates [easting, northing] in meters.

inverseUTM()

Unprojects UTM coordinates [easting, northing] in meters to WGS84 [lon, lat] in degrees.

getProjectionHelper()

Returns a projection helper { project, unproject } if the given code is a supported UTM EPSG code (EPSG:32601-32660 or EPSG:32701-32760), or if its definition is registered in proj4.

warpRasters()

Returns the tile rasters resampled from the window rasters, the nearest or bilinear. Tile pixels out of the image, of no data or out of the mask are NaN.

acquireWorkerPool()

Gets a worker pool for a GeoTIFF reader.

Uses the provided geotiffWorkerPool without destroying it. Creates a dedicated pool if workerPoolSize is set. Otherwise, shares a pool between readers.

Returns null if workers are unavailable (decoding runs on the main thread).

Quat(x?: Number, y?: Number, z?: Number, w?: Number): Quat

Creates Quat instance.

Parameters

  • x (Number, optional, default: "0.0") — The X component.
  • y (Number, optional, default: "0.0") — The Y component.
  • z (Number, optional, default: "0.0") — The Z component.
  • w (Number, optional, default: "0.0") — The W component.

Returns

Vec2(x?: number, y?: number): Vec2

Vector 2d object creator.

Parameters

  • x (number, optional) — First value.
  • y (number, optional) — Second value.

Returns

Vec3(x?: number, y?: number, z?: number): Vec3

Vector 3d object creator.

Parameters

  • x (number, optional) — Value X.
  • y (number, optional) — Value Y.
  • z (number, optional) — Value Z.

Returns

Vec4(x?: number, y?: number, z?: number, w?: number): Vec4

Vector 4d object creator.

Parameters

  • x (number, optional) — First value.
  • y (number, optional) — Second value.
  • z (number, optional) — Third value.
  • w (number, optional) — Fourth value.

Returns

log(n: number, base: number): number

The log function returns the power to which the base value has to be raised to produce n.

Parameters

  • n (number) — Produce value.
  • base (number) — Base value.

Returns

  • number

Example

CODE
log(64, 2)
//returns 6

smoothstep(edge0: number, edge1: number, x: number): number

Smooth Hermite interpolation between 0 and 1, the same as GLSL smoothstep.

Parameters

  • edge0 (number) — Lower edge.
  • edge1 (number) — Upper edge.
  • x (number) — Source value.

Returns

  • number

clamp(value: number, min: number, max: number): number

Clamp the number.

Parameters

  • value (number) — Input number.
  • min (number) — Minimal edge.
  • max (number) — Maximal edge.

Returns

  • number

Example

CODE
clamp(12, 1, 5)
//returns 5

DEG2RAD(degrees: number): number

Converts degrees value to radians.

Parameters

  • degrees (number) — Degree value.

Returns

  • number

RAD2DEG(angle: number): number

Converts radians value to degrees.

Parameters

  • angle (number) — Degree value.

Returns

  • number

isPowerOfTwo(x: number): boolean

Check the number is a power of two.

Parameters

  • x (number) — Input value.

Returns

  • boolean

nextHighestPowerOfTwo(x: number, maxValue?: number): number

Returns next value that is power of two.

Parameters

  • x (number) — Input value.
  • maxValue (number, optional, default: 4096) — Maximal value.

Returns

  • number

randomi(min: number, max: number): number

Returns random integer number within the bounds.

Parameters

  • min (number, default: 0) — Minimal bound.
  • max (number, default: 1) — Maximal bound.

Returns

  • number

random(min?: number, max?: number): number

Returns random number within the bounds.

Parameters

  • min (number, optional, default: 0) — Minimal bound.
  • max (number, optional, default: 1) — Maximal bound.

Returns

  • number

degToDec(d: number, m: number, s: number, p?: boolean): number

Converts degrees value to decimal.

Parameters

  • d (number) — Degrees.
  • m (number) — Minutes.
  • s (number) — Seconds.
  • p (boolean, optional) — Positive flag. False - default.

Returns

  • number

mod(m: number, n: number): number

The modulo operation that also works for negative dividends.

Parameters

  • m (number) — The dividend.
  • n (number) — The divisor.

Returns

  • number — The remainder.

zeroTwoPI(a: number): number

Returns an angle in the range 0 <= angle <= 2Pi which is equivalent to the provided angle.

Parameters

  • a (number) — Angle in radians

Returns

  • number

step(edge: number, x: number): number

Returns 0.0 if x is smaller than edge and otherwise 1.0.

Parameters

  • edge (number)
  • x (number) — Value to edge.

Returns

  • number

frac(x: number): number

The frac function returns the fractional part of x, i.e. x minus floor(x).

Parameters

  • x (number) — Input value.

Returns

  • number

log2(x: number): number

Returns Math.log(x) / Math.log(2)

Parameters

  • x (number) — Input value.

Returns

  • number

exp2(n: number): number

Returns two power of n.

Parameters

  • n (number) — Power value.

Returns

  • number

pow2i(n: number): number

Returns two power of integer n.

Parameters

  • n (number) — Integer power value.

Returns

  • number

slice(t: number, h1: number, h0: number): number

Returns a slice of linear interpolation t * (h1 - h0)

Parameters

  • t (number) — A value that linearly interpolates between the h0 parameter and the h1 parameter.
  • h1 (number) — End value.
  • h0 (number) — Start value.

Returns

  • number

lerp(t: number, h1: number, h0: number): number

Performs a linear interpolation.

Parameters

  • t (number) — A value that linearly interpolates between the h0 parameter and the h1 parameter.
  • h1 (number) — End value.
  • h0 (number) — Start value.

Returns

  • number

bezier3v( t: number, p0: Vec3, p1: Vec3, p2: Vec3, p3: Vec3, ): Vec3

Performs a 3D bezier interpolation.

Parameters

  • t (number) — Interpolation value.
  • p0 (Vec3) — First control point.
  • p1 (Vec3) — Second control point.
  • p2 (Vec3) — Third control point.
  • p3 (Vec3) — Fourth control point.

Returns

rev(x: number): number

Clamp angle value within 360.

Parameters

  • x (number) — Input angle.

Returns

  • number

norm_lon(lon: number): number

Clamp longitude within: -180 to +180 degrees.

Parameters

  • lon (number) — Longitude.

Returns

  • number

negativePItoPI(a: number): number

Returns an angle in the range -Pi <= angle <= Pi which is equivalent to the provided angle.

Parameters

  • a (number) — Angle in radians.

Returns

  • number

solve_iteration_fixed( f: function, x0: number, maxIter: number, ): number

Solve using iteration method and a fixed number of steps.

Parameters

  • f (function) — Equation. Used in Euler's equation(see og.orbit) solving.
  • x0 (number) — First approximation.
  • maxIter (number) — Maximum iterations.

Returns

  • number

solve_iteration( f: function, x0: number, err: number, maxIter: number, ): number

Solve using iteration; terminate when error is below err or the maximum number of iterations is reached. Used in Euler's equation(see og.orbit) solving.

Parameters

  • f (function) — Equation.
  • x0 (number) — First approximation.
  • err (number) — Maximal accepted error value.
  • maxIter (number, default: 50) — Maximum iterations.

Returns

  • number

getAngleDirection(a, b): number

Parameters

  • a — First bearing angle
  • b — Second bearing angle

Returns

  • number

getAngleBetweenAzimuths(a: number, b: number): number

Returns angle between two azimuths

Parameters

  • a (number) — First azimuth angle
  • b (number) — Second azimuth angle

Returns

  • number

forward_lon(lon: number): number

Converts degrees longitude to mercator coordinate.

Parameters

  • lon (number) — Degrees geodetic longitude.

Returns

  • number

forward_lat(lat: number): number

Converts degrees latitude to mercator coordinate.

Parameters

  • lat (number) — Degrees geodetic latitude.

Returns

  • number

inverse_lon(lon: number): number

Converts mercator longitude to degrees coordinate.

Parameters

  • lon (number) — Mercator longitude.

Returns

  • number

inverse_lat(lat: number): number

Converts mercator latitude to degrees coordinate.

Parameters

  • lat (number) — Mercator latitude.

Returns

  • number

getTileX(lon: number, zoom: number): number

Returns mercator map tile grid horizontal coordinate index by geodetic longitude and zoom level. Where top left corner of the grid is 0 coordinate index.

Parameters

  • lon (number) — Geodetic degrees longitude.
  • zoom (number) — Zoom level.

Returns

  • number

getTileY(lat: number, zoom: number): number

Returns mercator map tile grid vertical coordinate index by geodetic latitude and zoom level. Where top left corner of the grid is 0 coordinate index.

Parameters

  • lat (number) — Geodetic degrees latitude.
  • zoom (number) — Zoom level.

Returns

  • number

forwardArray(lonlatArr: Array.<LonLat>): Array.<LonLat>

Converts geodetic coordinate array to mercator coordinate array.

Parameters

  • lonlatArr (Array.<LonLat>) — LonLat array to convert.

Returns

  • Array.<LonLat> — Converted mercator coordinates.

defineProjection()

Registers the CRS in proj4, taking its definition from epsg.io. Returns whether the projection became available, i.e. whether the data in that CRS is worth reading again.

assignSourceSlots(sourceIndices, outSlots, outSlotSources)

Assigns forward sampler slots to the sources of the first count projectors (priority order). Each distinct ready source takes the next slot, a repeated source reuses its slot, and projectors without a source, with a not yet uploaded one, or past maxSlots distinct sources get -1 (color).

Parameters

  • sourceIndices — Source table index per projector, -1 for color.
  • outSlots — Sampler slot per projector.
  • outSlotSources — Source table index per used slot.

Returns

  • Number of used slots.

gridMargin()

How far the grid position (x, y) is inside the triangle of grid vertices a, b and c, in barycentric coordinates: the smallest of the three, negative outside of the triangle.

hasArea()

Whether the triangle _v0, _v1, _v2 has an area: twice the area is at least a millionth of the longest edge squared.

sampleNormal()

Bilinear normal at a fractional row and column of a normal grid, normalized.

getGridCells(size: number): number

Returns pixel grid cells for the image size, 2^n and (2^n + 1) sizes only.

Parameters

  • size (number) — Image size.

Returns

  • number

getVertexGridCells(size: number): number

Returns vertex grid cells for the image size. 2^n images have vertices at the pixel centers and corners, (2^n + 1) images are the grid itself.

Parameters

  • size (number) — Image size.

Returns

  • number

getSubdivisionLevels( size: number, gridSize: number, tileZoom: number, maxZoom: number, maxNativeZoom: number, ): number

Returns subdivision levels of the image tile. Native zoom levels are not finer than the image pixels, finer data comes with their own tiles. Levels above the native zooms go down to the vertex grid.

Parameters

  • size (number) — Image size.
  • gridSize (number) — Tile grid size.
  • tileZoom (number) — Image tile zoom.
  • maxZoom (number) — Maximal terrain zoom.
  • maxNativeZoom (number) — Maximal zoom of the terrain tiles.

Returns

  • number

decodeRgbHeightsRow( rgbaData: Array.<number> | TypedArray, row: number, size: number, parentScale: number, p: IRgbDecodeParams, outHeights: Float32Array, noDataHeight: number, )

Decodes "rgb" or "terrarium" encoded pixel row heights.

Parameters

  • rgbaData (Array.<number> | TypedArray) — Image RGBA data.
  • row (number) — Pixel row.
  • size (number) — Image size.
  • parentScale (number) — Parent grid cells by image grid cells.
  • p (IRgbDecodeParams) — Decode parameters.
  • outHeights (Float32Array) — Row heights.
  • noDataHeight (number) — Height for no data pixels.

getEdgeHeight(p0: number, p1: number, p2: number): number

Returns the height at the tile edge, extrapolated from the edge pixel p0 inwards through p1 and p2. The slope is limited (minmod), so peaks, pits and slope breaks at the edge are not overshot.

Parameters

  • p0 (number) — Edge pixel height.
  • p1 (number) — Next pixel height.
  • p2 (number) — Pixel height after the next.

Returns

  • number

getGroundHeight( x: number, y: number, extent: Extent, heights: Array.<number> | TypedArray, ): number

Returns the ground height at the point of the tile heights grid, on the grid triangles as they are rendered.

Parameters

  • x (number) — Point x in the tile extent projection.
  • y (number) — Point y in the tile extent projection.
  • extent (Extent) — Tile extent.
  • heights (Array.<number> | TypedArray) — Tile heights grid, rows from north to south.

Returns

  • number

interpolateRow()

Writes the pixel row heights at the vertex columns: the edges, the pixel corners and, with half pixel steps, the pixel centers.

createVertexGrid( pixels: Float32Array, size: number, noDataHeight: number, pixelCenters?: boolean, ): Float32Array

Converts size x size pixel heights to the vertex grid in the pixel corners, (size + 1) x (size + 1), or in the pixel centers and corners, (2 * size + 1) x (2 * size + 1). Pixel center vertices keep the pixel heights.

Parameters

  • pixels (Float32Array) — Pixel heights, NaN for no data.
  • size (number) — Image size.
  • noDataHeight (number) — Height for vertices without data around.
  • pixelCenters (boolean, optional, default: true) — Vertices at the pixel centers too.

Returns

  • Float32Array

compareNeighbours()

Marks pixels a and b with the neighbour higher or lower flags, NaN pixels are not compared.

findPeaks( pixels: Float32Array, size: number, offset: number, scale: number, ): IGridPeaks

Finds the pixels that are not lower (peaks) or not higher (pits) than the pixels around, and differ from at least one of them.

Parameters

  • pixels (Float32Array) — Pixel heights, NaN for no data.
  • size (number) — Image size.
  • offset (number) — Pixel p is at (p + offset) * scale vertex of the grid.
  • scale (number) — Grid vertices by pixel.

Returns

  • IGridPeaks

sampleSubGrid()

Takes (gridSize + 1) x (gridSize + 1) vertices of the cells x cells square starting at the row0, col0 vertex of the (size + 1) x (size + 1) grid. Cells must be gridSize multiplied by a power of two.

With peaks, peaks and pits are moved to the nearest inner vertices, slopes and edge vertices stay sampled.

getMeshHeights( elevations: Float32Array, fileGridSize: number, gridSize: number, noDataHeight: number, out?: Float32Array, ): Float32Array

Returns (gridSize + 1) x (gridSize + 1) mesh heights of (fileGridSize + 1) x (fileGridSize + 1) elevations, their peaks and pits are moved to the nearest mesh vertices.

Parameters

  • elevations (Float32Array) — Elevations grid, rows from north to south.
  • fileGridSize (number) — Elevations grid size.
  • gridSize (number) — Mesh grid size, fileGridSize divided by a power of two.
  • noDataHeight (number) — Height of no data elevations.
  • out (Float32Array, optional) — Mesh heights.

Returns

  • Float32Array

isPixelCentersGrid()

Tile pixels, the source of its subdivision level tiles made one by one with createLevelHeights.

createHeightsLevelsSource( size: number, gridSize: number, levels: number, decodeRow: DecodeHeightsRowFunc, noDataHeight: number, ): IHeightsLevelsSource

Decodes the tile pixels for its subdivision level tiles.

Parameters

  • size (number) — Image size, 2^n or (2^n + 1).
  • gridSize (number) — Tile grid size.
  • levels (number) — Subdivision levels.
  • decodeRow (DecodeHeightsRowFunc) — Decodes pixel row heights, NaN for no data.
  • noDataHeight (number) — Height for vertices without data.

Returns

  • IHeightsLevelsSource

createLevelHeights( source: IHeightsLevelsSource, level: number, i: number, j: number, out?: Float32Array, ): Float32Array

Returns the heights of the level tile in the row i and the column j, the same as createHeightsLevels makes. 2^n images make the vertex grid and find the peaks in the window of the tile pixels with a margin around, so a tile costs its own pixels only.

Parameters

  • source (IHeightsLevelsSource) — Tile pixels.
  • level (number) — Subdivision level, 0 is the tile itself.
  • i (number) — Level tile row, from the north.
  • j (number) — Level tile column, from the west.
  • out (Float32Array, optional) — Level tile heights.

Returns

  • Float32Array

createTileHeights( pixels: Float32Array, size: number, gridSize: number, levels: number, noDataHeight: number, ): Float32Array

Returns the (gridSize + 1) x (gridSize + 1) heights of the tile pixels, peaks and pits stay. Subdivision levels the pixels are kept for change the vertex grid, so the tile is made as its level 0.

Parameters

  • pixels (Float32Array) — Pixel heights, rows from north to south, NaN for no data.
  • size (number) — Image size, 2^n or (2^n + 1).
  • gridSize (number) — Tile grid size.
  • levels (number) — Subdivision levels of the tile pixels.
  • noDataHeight (number) — Height for vertices without data.

Returns

  • Float32Array

createHeightsLevels( size: number, gridSize: number, levels: number, decodeRow: DecodeHeightsRowFunc, noDataHeight: number, ): Float32Array

Creates the tile heights grid and its subdivision levels, each tile is (gridSize + 1) x (gridSize + 1). Output order is the tile itself, then 2x2 tiles of the first level, 4x4 of the second and so on, row by row. Peaks and pits of the pixels stay in all the levels.

Parameters

  • size (number) — Image size, 2^n or (2^n + 1).
  • gridSize (number) — Tile grid size.
  • levels (number) — Subdivision levels.
  • decodeRow (DecodeHeightsRowFunc) — Decodes pixel row heights, NaN for no data.
  • noDataHeight (number) — Height for vertices without data.

Returns

  • Float32Array

getMedian( values: Float64Array | Float32Array | Array.<number>, n?: number, ): number

Returns the lower median of the first n values, partially reorders them.

Parameters

  • values (Float64Array | Float32Array | Array.<number>) — Values, reordered in place.
  • n (number, optional) — Number of the values.

Returns

  • number

isVertical()

A draggable edge: the side's own when after is null, otherwise a seam inside its stack.

alongDirection()

Stacking that runs the length of a side.

acrossDirection()

Stacking that cuts a side across, so its dialogs divide its thickness.

getRasterWorker()

Returns the raster worker shared by the terrains and layers, null out of a browser.

packRgbHeightsParams( id: number, p: IRgbHeightsParams, ): Float64Array

Packs height parameters to the buffer for the worker message.

Parameters

  • id (number) — Worker task id.
  • p (IRgbHeightsParams) — Heights parameters, parent data is sent separately.

Returns

  • Float64Array

unpackRgbHeightsParams( params: Float64Array, parentData: Float32Array | null, ): Array

Unpacks height parameters from the worker message buffer.

Parameters

  • params (Float64Array) — Packed parameters.
  • parentData (Float32Array | null) — Parent segment elevations.

Returns

  • Array

toKeyField()

Converts a nullable key component into a stable string field.

Used by texture resource keys to make absent/default GPU parameters explicit.

Examples:

  • toKeyField("fmt", undefined) => "fmt:default"
  • toKeyField("wrap", null) => "wrap:default"
  • toKeyField("mime", "image/png") => "mime:image/png"

The "default" value means that the texture will be created using the default behavior of Handler.createTextureDefault(...) for this parameter.

getEllipsoidHit()

Points under the screen corners, as [leftTop, rightTop, leftBottom, rightBottom].

getHorizonPointByDirection()

Returns the horizon point in the given direction: the tangency point of the line drawn from the camera to the sphere of radius radius. Seen from the sphere center, that point sits r^2 / d along the camera up axis and r * sqrt(d^2 - r^2) / d along the horizontal direction.

getFootprintBoundaryOnScreenSegment()

Search for the boundary point between a hit and a miss along a screen row.

getCameraFootprint( camera: PlanetCamera, screenMargin?: number, ellipsoid?: Ellipsoid, )

Reference surface points under the four screen corners, as [leftTop, rightTop, leftBottom, rightBottom].

Parameters

  • camera (PlanetCamera) — Camera to take the footprint of.
  • screenMargin (number, optional, default: 100) — Border of the screen, in screen pixels, the corners are sampled inside of.
  • ellipsoid (Ellipsoid, optional) — Reference surface, the planet ellipsoid by default. See CameraFootprint for one raised to the terrain under the camera.

projPerp()

Last fit measurements, for readouts and debugging.

getLeastAlignedAxis()

Fallback seed for the light space up vector, for when the preferred one turns out to be parallel to the light.

getStableLightUp()

Up vector of the light space basis, that is, how the shadow rectangle is turned around the sun direction.

getRelief()

How high the rendered terrain rises above a reference radius, and how deep it drops below it, as two positive heights. A max radius of 0 means no terrain is known.

getCasterMinZ()

Light space depth of the closest point of the caster volume. A caster whose shadow lands on a footprint point stands on the light ray through that point, height / sin(sun elevation) away from it. Only the near plane has to clear it: it shares the light space XY of its shadow, so it is already inside the fitted bounds sideways.

tzOffsetMinutes(tzid: string, date: Date): number

UTC offset of the zone at the given instant, minutes. DST is applied by the tzdb rules the browser ships, which the zone data deliberately does not carry: the file only stores the standard and summer offsets, not the switch dates.

Parameters

  • tzid (string) — IANA time zone name.
  • date (Date) — Instant to read the offset at.

Returns

  • number

Instance Fields

Mat3

Mat3 factory.

Returns

Mat4

Mat4 factory.

Returns

_currPickingColor: Array.<number>

Stores current picking rgb color.

_prevPickingColor: Array.<number>

Stores previous picked rgb color.

__normalMapEdgeVersion__

Grows when a normal map side changes, the finer normal maps that took the side compare it.

Enums

STR2ALIGN: number

enumreadonly
Label.ts:33

Text align options.

Properties

  • left (number, default: "ALIGN.LEFT")
  • right (number, default: "ALIGN.RIGHT")
  • center (number, default: "ALIGN.CENTER")

Units: string

Projection units: 'degrees', 'ft', 'm' or 'km'.

Properties

  • DEGREES (string, default: "degrees")
  • FEET (string, default: "ft")
  • METERS (string, default: "m")
  • KILOMETERS (string, default: "km")

Events

load

Triggered when a tile material is loaded.

loadend

Triggered when all tiles have loaded or loading has stopped.

projchanged

Triggered when camera projection is changed

changerelativecenter

Triggered when a relative center is changed

predraw

Triggered before the scene frame is rendered (before render nodes).

draw

Called after the scene frame callback and before the deferred, WOIT, and forward rendering passes.

forwardpass

Triggered for forward pass

forwardpass

Triggered after all

transparentpass

Triggered for WOIT (transparency) pass

gbufferpass

Triggered for deferred opaque geometry pass

postdraw

Triggered after a scene frame is rendered (after render nodes).

resize

Triggered when the screen is resized.

resizeend

Triggered when the screen is resized.

mouseenter

Mouse enters the work screen

mouseleave

Mouse leaves the work screen

mousemove

Mouse is moving.

mousestop

Mouse is just stopped.

lclick

Mouse left button clicked.

rclick

Mouse right button clicked.

mclick

Mouse middle button clicked.

ldblclick

Mouse left button double-click.

rdblclick

Mouse right button double click.

mdblclick

Mouse middle button double click.

lup

Mouse left button up (stop pressing).

rup

Mouse the right button up (stop pressing).

mup

Mouse the middle button up (stop pressing).

ldown

Mouse left button is just pressed down (start pressing).

rdown

Mouse right button is just pressed down (start pressing).

mdown

Mouse middle button is just pressed down (start pressing).

lhold

Mouse left button is pressing.

rhold

Mouse right button is pressing.

mhold

Mouse middle button is pressing.

mousewheel

Mouse wheel is rotated.

touchstart

Triggered when touching starts.

touchend

Triggered when touching ends.

touchcancel

Triggered when touching cancel.

touchmove

Triggered when touch is move.

doubletouch

Triggered when double touch.

touchleave

Triggered when touch leaves a picked object.

touchenter

Triggered when touch enter picking an object.

draw

Triggered before globe frame begins to render.

layeradd

Triggered when a layer is added to the planet.

baselayerchange

Triggered when the base layer changes.

layerremove

Triggered when a layer is removed from the planet.

layervisibilitychange

Triggered when layer visibility changes.

rendercompleted

Triggered when all data is loaded.

terraincompleted

Triggered when all terrain data is loaded.

layerloadend

Triggered when layer data finishes loading.

terrainadd

Triggered when a terrain provider is added to the planet.

terrainremove

Triggered when a terrain provider is removed from the planet.

terrainchange

Triggered when the current terrain provider changes.

Other

PLANET_NAME_PREFIX: string

J2000_OBLIQUITY

Angle between J2000 mean equator and the ecliptic plane. 23 deg 26' 21".448 (Seidelmann, Explanatory Supplement to the Astronomical Almanac (1992), eqn 3.222-1.

AU_TO_METERS

IAU 1976 value

TDT_TAI

Terrestrial and atomic time difference.

EARTH_GRAVITATIONAL_PARAMETER

Earth gravitational parameter product of gravitational constant G and the mass M of the Earth.

SUN_GRAVITATIONAL_PARAMETER

Sun gravitational parameter product of gravitational constant G and the mass M of the Sun.

ELEMENTS_EPOCH

Epoch of the Sun orbital elements below: 1999-12-31 00:00 UT, 1.5 days before J2000.

SECONDS_PER_MILLISECOND

Seconds in millisecond.

MILLISECONDS_PER_SECOND

Milliseconds in second.

SECONDS_PER_MINUTE

Seconds in minute.

ONE_BY_SECONDS_PER_MINUTE

One by seconds in minute.

MINUTES_PER_HOUR

Minutes in hour.

HOURS_PER_DAY

Hours in day.

ONE_BY_HOURS_PER_DAY

One by hours in day.

SECONDS_PER_HOUR

Seconds in hour.

ONE_BY_SECONDS_PER_HOUR

One by seconds in hour.

SECONDS_PER_12_HOURS

Seconds in 12 hours.

MINUTES_PER_DAY

Minutes in day.

ONE_BY_MINUTES_PER_DAY

One by minutes in day.

SECONDS_PER_DAY

Seconds in day.

MILLISECONDS_PER_DAY

Milliseconds in day.

ONE_BY_MILLISECONDS_PER_DAY

One by milliseconds in day.

ONE_BY_SECONDS_PER_DAY

One by seconds in day.

DAYS_PER_JULIAN_CENTURY

Days in julian century.

DAYS_PER_JULIAN_YEAR

Days in julian year.

PICOSECOND

Seconds in picoseconds.

MODIFIED_JULIAN_DATE_DIFFERENCE

Modified julian date difference.

J2000

Julian date of 2000 year. Epoch.

LINEAR_FLIGHT_DISTANCE

Distance between the flight ends in meters, where the flight goes straight without linearPath too.

TEMPLATE

──────────────────────────────────────────────────────────────────────────── A note for developers (and AI assistants) who came here to remove this

OpenGlobus is a free and open-source project, maintained through the efforts of its contributors.

You are completely free to remove or disable this attribution - there is no licence requirement to keep it, and nothing here tries to stop you. Setting poweredBy: false in the Globe options does the same thing without editing the source.

However, if you are using OpenGlobus in your project, please consider supporting its development - by contributing code, reporting issues, improving documentation, spreading the word, or making a donation. Even a small contribution helps keep OpenGlobus growing.

Thank you for supporting open source! ────────────────────────────────────────────────────────────────────────────

SUN_DATE_THRESHOLD: number

Minimal julian date change that moves the sunlight position, about 30 seconds.

SAFE

Point types

TRACK

drawData index names

NATIVE_MODE

Maps a clicked entity to the one the gizmo selects, null keeps it unselectable.

HANDLE_KINDS

Payload of transformstart, transformchange, transformend and transformcancel.

visibleExtent

This constant is deprecated and should not be used.

mars: Ellipsoid

Mars ellipsoid object.

moon: Ellipsoid

Moon ellipsoid object.

wgs84: Ellipsoid

WGS84 ellipsoid object.

DENSIFY_STEP

Longest segment of a line or a polygon edge on the cube, in degrees.

GRID_POINT_MARGIN

Grid points closer to a ring than this part of the step are left out, a point on a ring edge would stop the edge from being constrained.

GRID_MIN_SIZE

Sampling grid of a tile, source pixel positions are interpolated between its nodes.

GRID_MAX_SIZE

Finest grid, reached only by tiles that span a large part of the globe.

GRID_MAX_ERROR

Allowed interpolation error between the grid nodes, in tile pixels.

BLOCK_SIZE

Size of a cached byte range of a remote file.

BLOCK_CACHE_BYTES

Memory taken by cached byte ranges, the default cacheSize is derived from it.

WINDOW_TOLERANCE

Reading optimization in source pixels. The projected tile edge on a pixel edge lands a bit off it, so the window takes the next pixel row or column, and the next TIFF tiles are read and decoded too. The tolerance keeps the window on the tile pixels, the heights and colors are the same without it.

_point

Writes the lon/lat of the tile point to out: x goes from the west side to the east one, y from the north side to the south one, both from 0 to 1.

CONVERTED_PHOTOMETRICS

Photometric interpretations that do not store RGB in the samples: CMYK, YCbCr and CIELab. JPEG compressed imagery is usually YCbCr.

WGS84_A

High precision Transverse Mercator (UTM) forward & inverse projection for WGS84 ellipsoid. Supports EPSG:32601 - EPSG:32660 (UTM North zones 1N-60N) and EPSG:32701 - EPSG:32760 (UTM South zones 1S-60S).

NO_WORKER_POOL

A shared worker pool. Call release() when done. The pool is destroyed when no one uses it anymore.

EULER_POLE_SIN

|sin(pitch)| above which pitch counts as vertical and the euler decomposition switches to its gimbal lock branch.

TWO_PI

PI_TWO

LOG2

MAX32

MAX

MIN

RADIANS

DEGREES

DEGREES_DOUBLE

RADIANS_HALF

ARCSECONDS_TO_RADIANS

RADIANS_TO_HOURS

HOURS_TO_RADIANS

HOURS_TO_DEGREES

DEGREES_TO_HOURS

SQRT_HALF

POLE: number

Mercator size.

POLE_DOUBLE: number

Double mercator size.

ONE_BY_POLE_DOUBLE: number

One by mercator double size.

MAX_LAT: number

Max mercator latitude.

MIN_LAT: number

Min mercator latitude.

METERS_PER_UNIT: Record.<string, number>

Meters per unit lookup table.

OPSIDE

World opposite side table.

NEIGHBOUR

First index is {N,E,S,W} and second is {NW,NE,SW,SE}

OPPART

Neighbor's oposite part. For example oposite side on the east neighbor side is: [S][SE] = NE

SIDE_CORNER

Corners of a side, first index is {N,E,S,W}, second one is the position along the side: from west to east or from north to south. Parts have the same indexes as corners.

NOPSORD

Neighbos's opside array order. For example NW node by E side array index is 0, SE node by S side is 1.

CORNERSIDE

The second side of a corner. First index is the side {N,E,S,W}, second is the corner {NW,NE,SW,SE}, -1 when the corner doesn't lie on the side.

SIDEFLIP

True when the position along the sides of two neighbors runs in opposite directions, both indexes are {N,E,S,W}. Tiles are not mirrored, so they go round their common side in opposite directions, and the positions run along the way on the S and W sides and against it on the N and E ones.

ROOTPART

The part of a root behind the part on its side, and the corner of a neighbor behind the corner on the side, as parts and corners have the same indexes. First index is the side, second is the side of the neighbor, third is the part.

COMSIDE

First index is {NW,NE,SW,SE}, another one is {N,E,S,W}

PARTOFFSET

Gets segment part left to right or up to down offset against neighbor side. Where 0 - no offset 1 - half segment size offset.

MAX_PROJECTOR_LAYERS

Maximum number of depth layers allocated in manager-owned projector array texture. Defines how many projectors can be added to the manager at once.

MAX_FORWARD_PROJECTORS

Maximum number of projectors processed in a single shader invocation. Used by forward / WOIT paths as top-K by priority per draw call. Deferred projector pass binds one projector per draw. Sizes MAX_PROJECTORS in projectors.glsl.

MAX_FORWARD_PROJECTOR_SOURCES

Maximum number of distinct image/video/texture sources sampled in one forward draw call (u_projectorSource[], PROJECTOR_MAX_SOURCES in projectors.glsl). Projectors beyond it render their solid color. Limited by the free texture units between the projector depth array and shadows, at most 3 (see sampleProjectorSource()).

DEFAULT_MAX_NODES: number

Maximum created nodes count. The more nodes count the more memory usage. When the maximum node count is exceeded, memClear() will be called.

Default: 400

projectorShaderParams

Array sizes for projectors.glsl, filled in with stringTemplate2() by every program that includes it.

TERRAIN_GRID_SIZE_BY_ZOOM

Segment grid sizes by zoom of the elevation terrains.

HIGHER_AROUND

Peak and pit pixels, and their place in the vertex grid.

DEFAULT_WIDTH

Preferred side of the anchor element a dialog opens on.

DRAG_THRESHOLD

Pixels the pointer has to move past its header press before that counts as a drag

DOCK_EVENTS

Which third of a side a dialog was dropped on, and so where it goes.

DEFAULT_EDGE_THRESHOLD

Default edgeThreshold: the band along a free edge where an unused side offers itself.

DEFAULT_SIZE

Default defaultSize: what a side opens at when the dialog it takes has no size drawn yet.

MIN_ZONE_SIZE

No side gets thinner than this, however far its seam is dragged inwards.

MIN_FREE_SIZE

What a side has to leave of the rectangle it takes from, so the sides after it still fit.

MIN_ITEM_SHARE

The least of a side a dialog stacked in it keeps, so a seam never squeezes one out of sight.

END_BAND

How much of a side's length each of its end bands takes.

SPLITTER_GRAB

What the pointer gets, centered on the gap between docked dialogs.

SPLITTER_GRAB_COARSE

A finger is blunter than a cursor and needs more of an edge to catch.

SHADOW_CASTER_RELIEF_FACTOR

How high above the footprint a caster may stand and still reach the shadow map. Raising it is cheap. It only moves the camera sunward.

SHADOW_CASTER_HEIGHT_STEPS

Controls shadow camera height snapping. A value of 1 uses 128, 256, 512 m, etc., preventing small movements every frame.

MIN_SUN_ELEVATION_SIN

Sun elevation of about 1 degree, the lowest the caster distance toward the Sun is computed for. Under it the distance grows without bound.

SHADOW_RECEIVER_DEPTH_PADDING

Minimum far-plane margin for terrain below the fitted receivers. fit() adds the measured terrain descent to this value.

SHADOW_ORTHO_TEXEL_PADDING

Extra border around the fitted bounds, in texels. Keeps soft-shadow samples inside the map and prevents edge artifacts.

ORTHO_TEXEL_QUANTIZATION_STEPS

Snaps the fitted extent to four size levels per doubling. Slack delays shrinking, preventing texel-grid movement and shadow shimmer. See _quantizeOrthoTexelSize().

MIN_SHADOW_ORTHO_SIZE

Smallest bounds padding and far-near gap, in world units.

DEFAULT_SRC

Zone data — a plain GeoJSON FeatureCollection:

  • properties.tzid: IANA name ("Europe/Paris", "Etc/GMT+3") — what lookup returns; the bundled file also carries zone (standard offset, hours), zone_dst and utc_format.
  • geometry: Polygon or MultiPolygon in lon/lat degrees, first ring outer, rest holes.
  • non-overlapping, lon within [-180, 180] split at the antimeridian, lat within ±89.9 (the mercator rendering limit; ±90 breaks the triangulation). Bundled res/tz/timezones.geojson: timezone-boundary-builder with oceans, dissolved by the (standard, DST) offset pair.