GlobusTerrain

Class that loads segment elevation data, converts it to the array and passes it to the planet segment.

Constructor

new GlobusTerrain(nameopt, optionsopt)

Parameters:
NameTypeAttributesDefaultDescription
namestring<optional>
""

Terrain provider name.

optionsIGlobusTerrainParams<optional>

Provider options:

Properties
NameTypeAttributesDefaultDescription
minZoomnumber<optional>
3

Minimal visible zoom index when terrain handler works.

maxZoomnumber<optional>
14

Maximal visible zoom index when terrain handler works.

maxNativeZoomnumber<optional>
14

Maximal available terrain zoom level.

urlstring<optional>
"https://{s}.srtm3.openglobus.org/{z}/{y}/{x}.ddm"

Terrain source URL template.

gridSizeByZoomArray.<number><optional>

Segment triangulation grid sizes where array index matches segment zoom index.

plainGridSizenumber<optional>
32

Elevation grid size. Default is 32x32. Must be power of two.

heightFactornumber<optional>
1

Elevation height multiplier.

cacheFetchCache<optional>
"default"

Fetch cache mode.

Fires:
  • event:load
  • event:loadend

Extends

Methods

(protected) _applyElevationsData()

_createHeights() → {Array.<number>|TypedArray}

Converts loaded data to segment elevation data type(column major elevation data array in meters)

Returns:

Column-major elevation data array in meters.

Type: 
Array.<number> | TypedArray

(protected) _createUrl(segment) → {string}

Creates default query url string.

Parameters:
NameTypeDescription
segmentSegment

Segment to create URL for.

Returns:

URL string.

Type: 
string

(protected) _getHTTPRequestString(segment) → {string}

Returns actual url query string.

Parameters:
NameTypeDescription
segmentSegment

Segment that loads terrain data.

Returns:

URL string.

Type: 
string

abortLoading()

Stop loading.

handleSegmentTerrain(segment)

Loads or creates segment elevation data.

Parameters:
NameTypeDescription
segmentSegment

Segment to create elevation data.

loadTerrain(segment, forceLoadingopt)

Starts to load segment elevation data.

Parameters:
NameTypeAttributesDefaultDescription
segmentSegment

Segment that requests terrain data.

forceLoadingboolean<optional>
false

Forces loading even if default filter would skip it.

setName(name)

Sets provider name.

Parameters:
NameTypeDescription
namestring

Name.

setUrl(url)

Sets terrain data url template.

Parameters:
NameTypeDescription
urlstring

Url template.

Example
<caption>Default openglobus url template:</caption>:
"https://{s}.srtm3.openglobus.org/{z}/{y}/{x}.ddm"

setUrlRewriteCallback(ur)

Sets url rewrite callback, used for custom url rewriting for every tile loading.

Parameters:
NameTypeDescription
urUrlRewriteFunc

The callback that returns tile custom created url.