new TerrainData
Terrain data for a single Tile. This type describes an interface and is not intended to be instantiated directly.
Methods
-
createMesh
-
Creates a TerrainMesh from this terrain data.
Parameters:
Name Type Description tilingScheme
TilingScheme The tiling scheme to which this tile belongs. x
Number The X coordinate of the tile for which to create the terrain data. y
Number The Y coordinate of the tile for which to create the terrain data. level
Number The level of the tile for which to create the terrain data. Returns:
Promise | TerrainMesh A promise for the terrain mesh, or undefined if too many asynchronous mesh creations are already in progress and the operation should be retried later. -
getWaterMask
-
Gets the water mask included in this terrain data, if any. A water mask is a rectangular Uint8Array or image where a value of 255 indicates water and a value of 0 indicates land. Values in between 0 and 255 are allowed as well to smoothly blend between land and water.
Returns:
Uint8Array | Image | Canvas The water mask, or undefined if no water mask is associated with this terrain data. -
interpolateHeight
-
Computes the terrain height at a specified longitude and latitude.
Parameters:
Name Type Description extent
Extent The extent covered by this terrain data. longitude
Number The longitude in radians. latitude
Number The latitude in radians. Returns:
Number The terrain height at the specified position. If the position is outside the extent, this method will extrapolate the height, which is likely to be wildly incorrect for positions far outside the extent. -
isChildAvailable
-
Determines if a given child tile is available, based on the TerrainData#childTileMask. The given child tile coordinates are assumed to be one of the four children of this tile. If non-child tile coordinates are given, the availability of the southeast child tile is returned.
Parameters:
Name Type Description thisX
Number The tile X coordinate of this (the parent) tile. thisY
Number The tile Y coordinate of this (the parent) tile. childX
Number The tile X coordinate of the child tile to check for availability. childY
Number The tile Y coordinate of the child tile to check for availability. Returns:
Boolean True if the child tile is available; otherwise, false. -
upsample
-
Upsamples this terrain data for use by a descendant tile.
Parameters:
Name Type Description tilingScheme
TilingScheme The tiling scheme of this terrain data. thisX
Number The X coordinate of this tile in the tiling scheme. thisY
Number The Y coordinate of this tile in the tiling scheme. thisLevel
Number The level of this tile in the tiling scheme. descendantX
Number The X coordinate within the tiling scheme of the descendant tile for which we are upsampling. descendantY
Number The Y coordinate within the tiling scheme of the descendant tile for which we are upsampling. descendantLevel
Number The level within the tiling scheme of the descendant tile for which we are upsampling. Returns:
Promise | TerrainData A promise for upsampled terrain data for the descendant tile, or undefined if too many asynchronous upsample operations are in progress and the request has been deferred. -
wasCreatedByUpsampling
-
Gets a value indicating whether or not this terrain data was created by upsampling lower resolution terrain data. If this value is false, the data was obtained from some other source, such as by downloading it from a remote server. This method should return true for instances returned from a call to TerrainData#upsample.
Returns:
Boolean True if this instance was created by upsampling; otherwise, false.