Map

new Map(properties)

Parameters:
NameTypeDescription
propertiesObject
Properties
NameTypeAttributesDefaultDescription
divIDStringA div ID.
debugBoolean<optional>
falseDisplay debug information.
shadowsBoolean<optional>
falseDisplay sunlight and shadows.
atmosphereTHREE.Vector3<optional>
new THREE.Vector3(0.1, 0.4, 1.0)An atmosphere color. By thefault a blueish atmosphere is displayed.
atmosphereDensityNumber<optional>
1.0An atmosphere density.
clockBoolean | Object<optional>
falseadd a clock.
sunTHREE.Vector3 | Boolean<optional>
trueA sun color, defaults to a yelowish sun. Only taken into account when shadows is true. An explicitely "false" value switches the sun for a black hole (queue theremin music).
oceanBoolean | THREE.Vector3<optional>
falseif true displays a blue ocean but a specific ocean color can be specified.
globalElevationTHREE.DataTexture<optional>
falseA texture representing the global elevation (equidistant cylindrical projection) used for post processing effects.
ringsBoolean | Object<optional>
falseRings properties, if undefined, no rings are drawn
detailMultiplierNumber<optional>
1.0multiplier for loading terrain and 2D maps, a higher number loads higher detail data
tileSizeNumber<optional>
32mesh resolution per tile.
targetFPSNumber<optional>
target FPS: defaults to 60 for desktop and 30 for mobile (FPS may not be precisely respected depending on monitor refresh rate)
tileImagerySizeNumber<optional>
256Resolution of imagery per tile.
loadOutsideViewBoolean<optional>
falseloads higher LOD tiles outside view so that they are already loaded when the camera pans and turns
spaceBoolean | Object | THREE.Color<optional>
trueif undefined, a default space backgound is drawn. Space can also be a single opaque color as a THREE.Vector3
clock.timezoneBoolean<optional>
falseadd time-zone select widget.
clock.dateTimePickerBoolean<optional>
falseadd date picker widget.
rings.originTHREE.Vector3<optional>
new THREE.Vector3()the center point of the rings
rings.normalTHREE.Vector3<optional>
new THREE.Vector3(Math.random()-0.5, Math.random()-0.5, Math.random()-0.5).normalize()the orientation of the rings plane
rings.innerRadiusNumber<optional>
6378137.0 * (1.1+Math.random())the rings inner radius
rings.outerRadiusNumber<optional>
this.rings.innerRadius+(0.1+Math.random())*6378137.0the rings outer radius
rings.colorMapNumber<optional>
Math.random()a modulation on the ring colors
rings.colorMapDisplaceNumber<optional>
Math.random()rings displacement in a loop
space.starsIntensityNumber<optional>
0.75The intensity of stars
space.gasCloudsIntensityNumber<optional>
0.25the intensity of nebula like gasClouds
space.colorMapNumber<optional>
Math.random()a modulation on gas cloud colors
space.texRotation1Number<optional>
Math.random()*Math.PIa texture rotation to avoid obvious repetition.
space.texRotation2Number<optional>
Math.random()*Math.PIa texture rotation to avoid obvious repetition.

Methods

_setDate(date)

Set the date (sun position)
Parameters:
NameTypeDescription
dateDate

addLayer(layer, index)

appends the layer to the end of the list of layers, replacing any layer already at that position.
Parameters:
NameTypeDescription
layerLayer
indexNumber

cartesianToLlhFastSFCT(llh)

Transforms a xyz point (degrees) to llh coordinates (EPSG:4326). The transform is slightly inaccurate compared to proj4 but it's 2.5 times faster
Parameters:
NameTypeDescription
llhTHREE.Vector3

getLayerByID(id) → {Layer}

Fetches a specific layer by ID.
Parameters:
NameTypeDescription
idNumber | String
Returns:
the layer with given ID if any
Type: 
Layer

getLayers() → {Array.<Layer>}

Returns an array of layers currently loaded on the map
Returns:
the list of layers
Type: 
Array.<Layer>

llhToCartesianFastSFCT(llh)

Transforms a lon lat height point (degrees) to cartesian coordinates (EPSG:4978). The transform is slightly inaccurate compared to proj4 but it's 3 times faster
Parameters:
NameTypeDescription
llhTHREE.Vector3

moveAndLookAt(cameraPosition, cameraAim)

Moves the camera to a location in lon lat height and looks at another location in lon lat height.
Parameters:
NameTypeDescription
cameraPositionObjectan object representing the camera desired location in lon lat height (according to WGS84 coordinates)
Properties
NameTypeDescription
xNumberlongitude
yNumberlatitude
zNumberheight
cameraAimObjectan object representing the camera desired target in lon lat height (according to WGS84 coordinates)
Properties
NameTypeDescription
xNumberlongitude
yNumberlatitude
zNumberheight

moveCameraAboveSurface()

Moves the camera 1 meter above the ground.

pauseRendering()

Pauses the rendering of all the layers.

removeLayer(index, dispose)

removes the layer at the specific index optionally "disposing" of any resources the layer is using.
Parameters:
NameTypeDefaultDescription
indexNumber
disposeBooleantrue

resetCameraNearFar()

When moving the map.camera manually, you may want to call this method to correctly set the camera near and far to limit z-fighting artefacts.

resumeRendering()

Resumes the rendering of all the layers

screenPixelRayCast(x, y, sideEffect) → {THREE.Vector3}

Get the hit location of a ray going from the camera through a pixel on screen or undefined if the ray does not hit anything.
Parameters:
NameTypeDescription
xNumbera screen pixel x coordinate
yNumbera screen pixel y coordinate
sideEffectTHREE.Vector3a THREE.Vector3 that will be moved to the ray hit location
Returns:
the sideEffect object.
Type: 
THREE.Vector3

select(screenLocation, type)

select action at a particular location on this map (normalized between -1 and 1)
Parameters:
NameTypeDescription
screenLocationTHREE.Vector2
typeNumber0(Add), 1(Remove) or 2(Replace)

setCameraUp()

reset the camera up so that the camera roll alligns with the horizon

setElevationExageration(elevationExageration)

Set an elevation exageration factor
Parameters:
NameTypeDescription
elevationExagerationNumber

setLayer(layer, index)

Sets the given layer at the given index disposing of any layer previously at that index.
Parameters:
NameTypeDescription
layerLayer
indexNumber