2.27.2 • Published 3 months ago

react-globe.gl v2.27.2

Weekly downloads
393
License
MIT
Repository
github
Last release
3 months ago

react-globe.gl

NPM package Build Size NPM Downloads

React bindings for the globe.gl UI component.

A React component to represent data visualization layers on a 3-dimensional globe in a spherical projection, using ThreeJS/WebGL for 3D rendering.

Check out the examples:

Quick start

import Globe from 'react-globe.gl';

or using a script tag

<script src="//unpkg.com/react-globe.gl"></script>

then

ReactDOM.render(
  <Globe
    pointsData={myData}
  />, 
  myDOMElement
);

API reference

Container Layout

PropTypeDefaultDescription
widthnumber<window width>Canvas width.
heightnumber<window height>Canvas height.
backgroundColorstring#000011Background color.
backgroundImageUrlstring-URL of the image to be used as background to the globe. If no image is provided, the background color is shown instead.
waitForGlobeReadybooltrueWhether to wait until the globe wrapping or background image has been fully loaded before rendering the globe or any of the data layers.
animateInbooltrueWhether to animate the globe initialization, by scaling and rotating the globe into its inital position. This prop only has an effect on component mount.

Globe Layer

PropTypeDefaultDescription
globeImageUrlstring-URL of the image used in the material that wraps the globe. If no image is provided, the globe is represented as a black sphere.
bumpImageUrlstring-URL of the image used to create a bump map in the material, to represent the globe's terrain.
showGlobebooltrueWhether to show the globe surface itself.
showGraticulesboolfalseWhether to show a graticule grid demarking latitude and longitude lines at every 10 degrees.
showAtmospherebooltrueWhether to show a bright halo surrounding the globe, representing the atmosphere.
atmosphereColorstringlightskyblueThe color of the atmosphere.
atmosphereAltitudestring0.15The max altitude of the atmosphere, in terms of globe radius units.
globeMaterialMaterialMeshPhongMaterialThreeJS material used to wrap the globe. Can be used for more advanced styling of the globe, like in this example.
onGlobeReadyfunc-Callback function to invoke immediately after the globe has been initialized and visible on the scene.
onGlobeClickfunc-Callback function for (left-button) clicks on the globe. The clicked globe coordinates and the event object are included as arguments: onGlobeClick({ lat, lng }, event).
onGlobeRightClickfunc-Callback function for right-clicks on the globe. The clicked globe coordinates and the event object are included as arguments: onGlobeRightClick({ lat, lng }, event).

Points Layer

PropTypeDefaultDescription
pointsDataarray[]List of points to represent in the points map layer. Each point is displayed as a cylindrical 3D object rising perpendicularly from the surface of the globe.
pointLabelstring or funcnamePoint object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML content.
pointLatnumber, string or funclatPoint object accessor function, attribute or a numeric constant for the cylinder's center latitude coordinate.
pointLngnumber, string or funclngPoint object accessor function, attribute or a numeric constant for the cylinder's center longitude coordinate.
pointColorstring or func() => '#ffffaa'Point object accessor function or attribute for the cylinder color.
pointAltitudenumber, string or func0.1Point object accessor function, attribute or a numeric constant for the cylinder's altitude in terms of globe radius units (0 = 0 altitude (flat circle), 1 = globe radius).
pointRadiusnumber, string or func0.25Point object accessor function, attribute or a numeric constant for the cylinder's radius, in angular degrees.
pointResolutionnumber12Radial geometric resolution of each cylinder, expressed in how many slice segments to divide the circumference. Higher values yield smoother cylinders.
pointsMergeboolfalseWhether to merge all the point meshes into a single ThreeJS object, for improved rendering performance. Visually both options are equivalent, setting this option only affects the internal organization of the ThreeJS objects.
pointsTransitionDurationnumber1000Duration (ms) of the transition to animate point changes involving geometry modifications. A value of 0 will move the objects immediately to their final position. New objects are animated by scaling them from the ground up. Only works if pointsMerge is disabled.
onPointClickfunc-Callback function for point (left-button) clicks. The point object, the event object and the clicked coordinates are included as arguments: onPointClick(point, event, { lat, lng, altitude }). Only works if pointsMerge is disabled.
onPointRightClickfunc-Callback function for point right-clicks. The point object, the event object and the clicked coordinates are included as arguments: onPointRightClick(point, event, { lat, lng, altitude }). Only works if pointsMerge is disabled.
onPointHoverfunc-Callback function for point mouse over events. The point object (or null if there's no point under the mouse line of sight) is included as the first argument, and the previous point object (or null) as second argument: onPointHover(point, prevPoint). Only works if pointsMerge is disabled.

Arcs Layer

PropTypeDefaultDescription
arcsDataarray[]List of links to represent in the arcs map layer. Each link is displayed as an arc line that rises from the surface of the globe, connecting the start and end coordinates.
arcLabelstring or funcnameArc object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML content.
arcStartLatnumber, string or funcstartLatArc object accessor function, attribute or a numeric constant for the line's start latitude coordinate.
arcStartLngnumber, string or funcstartLngArc object accessor function, attribute or a numeric constant for the line's start longitude coordinate.
arcEndLatnumber, string or funcendLatArc object accessor function, attribute or a numeric constant for the line's end latitude coordinate.
arcEndLngnumber, string or funcendLngArc object accessor function, attribute or a numeric constant for the line's end longitude coordinate.
arcColorstring, string, ... or func() => '#ffffaa'Arc object accessor function or attribute for the line's color. Also supports color gradients by passing an array of colors, or a color interpolator function.
arcAltitudenumber, string or funcnullArc object accessor function, attribute or a numeric constant for the arc's maximum altitude (ocurring at the half-way distance between the two points) in terms of globe radius units (0 = 0 altitude (ground line), 1 = globe radius). If a value of null or undefined is used, the altitude is automatically set proportionally to the distance between the two points, according to the scale set in arcAltitudeAutoScale.
arcAltitudeAutoScalenumber, string or func0.5Arc object accessor function, attribute or a numeric constant for the scale of the arc's automatic altitude, in terms of units of the great-arc distance between the two points. A value of 1 indicates the arc should be as high as its length on the ground. Only applicable if arcAltitude is not set.
arcStrokenumber, string or funcnullArc object accessor function, attribute or a numeric constant for the line's diameter, in angular degrees. A value of null or undefined will render a ThreeJS Line whose width is constant (1px) regardless of the camera distance. Otherwise, a TubeGeometry is used.
arcCurveResolutionnumber64Arc's curve resolution, expressed in how many straight line segments to divide the curve by. Higher values yield smoother curves.
arcCircularResolutionnumber6Radial geometric resolution of each line, expressed in how many slice segments to divide the tube's circumference. Only applicable when using Tube geometries (defined arcStroke).
arcDashLengthnumber, string or func1Arc object accessor function, attribute or a numeric constant for the length of the dashed segments in the arc, in terms of relative length of the whole line (1 = full line length).
arcDashGapnumber, string or func0Arc object accessor function, attribute or a numeric constant for the length of the gap between dash segments, in terms of relative line length.
arcDashInitialGapnumber, string or func0Arc object accessor function, attribute or a numeric constant for the length of the initial gap before the first dash segment, in terms of relative line length.
arcDashAnimateTimenumber, string or func0Arc object accessor function, attribute or a numeric constant for the time duration (in ms) to animate the motion of dash positions from the start to the end point for a full line length. A value of 0 disables the animation.
arcsTransitionDurationnumber1000Duration (ms) of the transition to animate arc changes involving geometry modifications. A value of 0 will move the arcs immediately to their final position. New arcs are animated by rising them from the ground up.
onArcClickfunc-Callback function for arc (left-button) clicks. The arc object, the event object and the clicked coordinates are included as arguments: onArcClick(arc, event, { lat, lng, altitude }).
onArcRightClickfunc-Callback function for arc right-clicks. The arc object, the event object and the clicked coordinates are included as arguments: onArcRightClick(arc, event, { lat, lng, altitude }).
onArcHoverfunc-Callback function for arc mouse over events. The arc object (or null if there's no arc under the mouse line of sight) is included as the first argument, and the previous arc object (or null) as second argument: onArcHover(arc, prevArc).

Polygons Layer

PropTypeDefaultDescription
polygonsDataarray[]List of polygon shapes to represent in the polygons map layer. Each polygon is displayed as a shaped cone that extrudes from the surface of the globe.
polygonLabelstring or funcnamePolygon object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML content.
polygonGeoJsonGeometrystring or funcgeometryPolygon object accessor function or attribute for the GeoJson geometry specification of the polygon's shape. The returned value should have a minimum of two fields: type and coordinates. Only GeoJson geometries of type Polygon or MultiPolygon are supported, other types will be skipped.
polygonCapColorstring or func() => '#ffffaa'Polygon object accessor function or attribute for the color of the top surface.
polygonCapMaterialMaterial, string or func-Polygon object accessor function, attribute or material object for the ThreeJS material to use in the top surface. This prop takes precedence over polygonCapColor, which will be ignored if both are defined.
polygonSideColorstring or func() => '#ffffaa'Polygon object accessor function or attribute for the color of the cone sides.
polygonSideMaterialMaterial, string or func-Polygon object accessor function, attribute or material object for the ThreeJS material to use in the cone sides. This prop takes precedence over polygonSideColor, which will be ignored if both are defined.
polygonStrokeColorstring or func-Polygon object accessor function or attribute for the color to stroke the polygon perimeter. A falsy value will disable the stroking.
polygonAltitudenumber, string or func0.01Polygon object accessor function, attribute or a numeric constant for the polygon cone's altitude in terms of globe radius units (0 = 0 altitude (flat polygon), 1 = globe radius).
polygonCapCurvatureResolutionnumber, string or func5Polygon object accessor function, attribute or a numeric constant for the resolution (in angular degrees) of the cap surface curvature. The finer the resolution, the more the polygon is fragmented into smaller faces to approximate the spheric surface, at the cost of performance.
polygonsTransitionDurationnumber1000Duration (ms) of the transition to animate polygon altitude changes. A value of 0 will size the cone immediately to their final altitude. New polygons are animated by rising them from the ground up.
onPolygonClickfunc-Callback function for polygon (left-button) clicks. The polygon object, the event object and the clicked coordinates are included as arguments: onPolygonClick(polygon, event, { lat, lng, altitude }).
onPolygonRightClickfunc-Callback function for polygon right-clicks. The polygon object, the event object and the clicked coordinates are included as arguments: onPolygonRightClick(polygon, event, { lat, lng, altitude }).
onPolygonHoverfunc-Callback function for polygon mouse over events. The polygon object (or null if there's no polygon under the mouse line of sight) is included as the first argument, and the previous polygon object (or null) as second argument: onPolygonHover(polygon, prevPolygon).

Paths Layer

PropTypeDefaultDescription
pathsDataarray[]List of lines to represent in the paths map layer. Each path is displayed as a line that connects all the coordinate pairs in the path array.
pathLabelstring or funcnamePath object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML content.
pathPointsarray, string or funcpnts => pntsPath object accessor function, attribute or an array for the set of points that define the path line. By default, each path point is assumed to be a 2-position array ([<lat>, <lon>]). This default behavior can be modified using the pathPointLat and pathPointLng methods.
pathPointLatnumber, string or funcarr => arr[0]Path point object accessor function, attribute or a numeric constant for the latitude coordinate.
pathPointLngnumber, string or funcarr => arr[1]Path point object accessor function, attribute or a numeric constant for the longitude coordinate.
pathPointAltnumber, string or func0.001Path point object accessor function, attribute or a numeric constant for the point altitude, in terms of globe radius units (0 = 0 altitude (ground), 1 = globe radius).
pathResolutionnumber2The path's angular resolution, in lat/lng degrees. If the ground distance (excluding altitude) between two adjacent path points is larger than this value, the line segment will be interpolated in order to approximate the curvature of the sphere surface. Lower values yield more perfectly curved lines, at the cost of performance.
pathColorstring, string, ... or func() => '#ffffaa'Path object accessor function or attribute for the line's color. Also supports color gradients by passing an array of colors, or a color interpolator function. Transparent colors are not supported in Fat Lines with set width.
pathStrokenumber, string or funcnullPath object accessor function, attribute or a numeric constant for the line's diameter, in angular degrees. A value of null or undefined will render a ThreeJS Line whose width is constant (1px) regardless of the camera distance. Otherwise, a FatLine is used.
pathDashLengthnumber, string or func1Path object accessor function, attribute or a numeric constant for the length of the dashed segments in the path line, in terms of relative length of the whole line (1 = full line length).
pathDashGapnumber, string or func0Path object accessor function, attribute or a numeric constant for the length of the gap between dash segments, in terms of relative line length.
pathDashInitialGapnumber, string or func0Path object accessor function, attribute or a numeric constant for the length of the initial gap before the first dash segment, in terms of relative line length.
pathDashAnimateTimenumber, string or func0Path object accessor function, attribute or a numeric constant for the time duration (in ms) to animate the motion of dash positions from the start to the end point for a full line length. A value of 0 disables the animation.
pathTransitionDurationnumber1000Duration (ms) of the transition to animate path changes. A value of 0 will move the paths immediately to their final position. New paths are animated from start to end.
onPathClickfunc-Callback function for path (left-button) clicks. The path object, the event object and the clicked coordinates are included as arguments: onPathClick(path, event, { lat, lng, altitude }).
onPathRightClickfunc-Callback function for path right-clicks. The path object, the event object and the clicked coordinates are included as arguments: onPathRightClick(path, event, { lat, lng, altitude }).
onPathHoverfunc-Callback function for path mouse over events. The path object (or null if there's no path under the mouse line of sight) is included as the first argument, and the previous path object (or null) as second argument: onPathHover(path, prevPath).

Heatmaps Layer

PropTypeDefaultDescription
heatmapsDataarray[]List of heatmap datasets to represent in the heatmaps map layer. Each set of points is represented as an individual global heatmap with varying color and/or altitude, according to the point density. It uses a Gaussian KDE to perform the density estimation, based on the great-arc distance between points.
heatmapPointsarray, string or funcpnts => pntsHeatmap object accessor function, attribute or an array for the set of points that define the heatmap. By default, each point is assumed to be a 2-position array ([<lat>, <lon>]). This default behavior can be modified using the heatmapPointLat and heatmapPointLng methods.
heatmapPointLatnumber, string or funcarr => arr[0]Heatmap point object accessor function, attribute or a numeric constant for the latitude coordinate.
heatmapPointLngnumber, string or funcarr => arr[1]Heatmap point object accessor function, attribute or a numeric constant for the longitude coordinate.
heatmapPointWeightnumber, string or func1Heatmap point object accessor function, attribute or a numeric constant for the weight of the point. The weight of a point determines its influence on the density of the surrounding area.
heatmapBandwidthnumber, string or func4Heatmap object accessor function, attribute or a numeric constant for the heatmap bandwidth, in angular degrees. The bandwidth is an internal parameter of the Gaussian kernel function and defines how localized is the influence of a point on distant locations. A narrow bandwidth leads to a more spiky representation, while a broad one has smoother curves.
heatmapColorFnstring or funcTurbo colormap interpolator with fading opacityHeatmap object accessor function or attribute for the color interpolator function to represent density in the heatmap. This function should receive a number between 0 and 1 (or potentially higher if saturation > 1), and return a color string.
heatmapColorSaturationnumber, string or func1.5Heatmap object accessor function, attribute or a numeric constant for the color scale saturation. The saturation is a multiplier of the normalized density value ([0,1]) before passing it to the color interpolation function. It can be used to dampen outlier peaks in density and bring the data floor into view.
heatmapBaseAltitudenumber, string or func0.01Heatmap object accessor function, attribute or a numeric constant for the heatmap base floor altitude in terms of globe radius units (0 = 0 altitude, 1 = globe radius).
heatmapTopAltitudenumber, string or func-Heatmap object accessor function, attribute or a numeric constant for the heatmap top peak altitude in terms of globe radius units (0 = 0 altitude, 1 = globe radius). An equal value to the base altitude will yield a surface flat heatmap. If a top altitude is set, the variations in density will be used to define the altitude curves between base and top.
heatmapsTransitionDurationnumber0Duration (ms) of the transition to animate heatmap changes. A value of 0 will set the heatmap colors/altitudes immediately in their final position. New heatmaps are animated by rising them from the ground up and gently fading in through the color scale.
onHeatmapClickfunc-Callback function for heatmap (left-button) clicks. The heatmap object, the event object and the clicked coordinates are included as arguments: onHeatmapClick(heatmap, event, { lat, lng, altitude }).
onHeatmapRightClickfunc-Callback function for heatmap right-clicks. The heatmap object, the event object and the clicked coordinates are included as arguments: onHeatmapRightClick(heatmap, event, { lat, lng, altitude }).
onHeatmapHoverfunc-Callback function for heatmap mouse over events. The heatmap object (or null if there's no heatmap under the mouse line of sight) is included as the first argument, and the previous heatmap object (or null) as second argument: onHeatmapHover(heatmap, prevHeatmap).

Hex Bin Layer

PropTypeDefaultDescription
hexBinPointsDataarray[]List of points to aggregate using the hex bin map layer. Each point is added to an hexagonal prism 3D object that represents all the points within a tesselated portion of the space.
hexLabelstring or func-Hex object accessor function or attribute for label (shown as tooltip). An hex object includes all points binned, and has the syntax: { points, sumWeight, center: { lat, lng } }. Supports plain text or HTML content.
hexBinPointLatnumber, string or funclatPoint object accessor function, attribute or a numeric constant for the latitude coordinate.
hexBinPointLngnumber, string or funclngPoint object accessor function, attribute or a numeric constant for the longitude coordinate.
hexBinPointWeightnumber, string or func1Point object accessor function, attribute or a numeric constant for the weight of the point. Weights for points in the same bin are summed and determine the hexagon default altitude.
hexBinResolutionnumber4The geographic binning resolution as defined by H3. Determines the area of the hexagons that tesselate the globe's surface. Accepts values between 0 and 15. Level 0 partitions the earth in 122 (mostly) hexagonal cells. Each subsequent level sub-divides the previous in roughly 7 hexagons.
hexMarginnumber or func0.2The radial margin of each hexagon. Margins above 0 will create gaps between adjacent hexagons and serve only a visual purpose, as the data points within the margin still contribute to the hexagon's data. The margin is specified in terms of fraction of the hexagon's surface diameter. Values below 0 or above 1 are disadvised. This property also supports using an accessor method based on the hexagon's aggregated data, following the syntax: hexMargin(({ points, sumWeight, center: { lat, lng }}) => ...). This method should return a numeric constant.
hexAltitudenumber or func({ sumWeight }) => sumWeight * 0.01The altitude of each hexagon, in terms of globe radius units (0 = 0 altitude (flat hexagon), 1 = globe radius). This property also supports using an accessor method based on the hexagon's aggregated data, following the syntax: hexAltitude(({ points, sumWeight, center: { lat, lng }}) => ...). This method should return a numeric constant.
hexTopCurvatureResolutionnumber5The resolution (in angular degrees) of the top surface curvature. The finer the resolution, the more the top area is fragmented into smaller faces to approximate the spheric surface, at the cost of performance.
hexTopColorfunc() => '#ffffaa'Accessor method for each hexagon's top color. The method should follow the signature: hexTopColor(({ points, sumWeight, center: { lat, lng }}) => ...) and return a color string.
hexSideColorfunc() => '#ffffaa'Accessor method for each hexagon's side color. The method should follow the signature: hexSideColor(({ points, sumWeight, center: { lat, lng }}) => ...) and return a color string.
hexBinMergeboolfalseWhether to merge all the hexagon meshes into a single ThreeJS object, for improved rendering performance. Visually both options are equivalent, setting this option only affects the internal organization of the ThreeJS objects.
hexTransitionDurationnumber1000Duration (ms) of the transition to animate hexagon changes related to geometry modifications (altitude, radius). A value of 0 will move the hexagons immediately to their final position. New hexagons are animated by scaling them from the ground up. Only works if hexBinMerge is disabled.
onHexClickfunc-Callback function for hexagon (left-button) clicks. The hex object including all points binned, the event object and the clicked coordinates are included as arguments: onHexClick({ points, sumWeight, center: { lat, lng } }, event, { lat, lng, altitude }). Only works if hexBinMerge is disabled.
onHexRightClickfunc-Callback function for hexagon right-clicks. The hex object including all points binned, the event object and the clicked coordinates are included as arguments: onHexRightClick({ points, sumWeight, center: { lat, lng } }, event, { lat, lng, altitude }). Only works if hexBinMerge is disabled.
onHexHoverfunc-Callback function for hexagon mouse over events. The hex object (or null if there's no hex under the mouse line of sight) is included as the first argument, and the previous hex object (or null) as second argument: onHexHover(hex, prevHex). Each hex object includes all points binned, and has the syntax: { points, sumWeight, center: { lat, lng } }. Only works if hexBinMerge is disabled.

Hexed Polygons Layer

PropTypeDefaultDescription
hexPolygonsDataarray[]List of polygon shapes to represent in the hexed polygons map layer. Each polygon is displayed as a tesselated group of hexagons that approximate the polygons shape according to the resolution specified in hexPolygonResolution.
hexPolygonLabelstring or funcnameHexed polygon object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML content.
hexPolygonGeoJsonGeometrystring or funcgeometryHexed polygon object accessor function or attribute for the GeoJson geometry specification of the polygon's shape. The returned value should have a minimum of two fields: type and coordinates. Only GeoJson geometries of type Polygon or MultiPolygon are supported, other types will be skipped.
hexPolygonColorstring or func() => '#ffffaa'Hexed polygon object accessor function or attribute for the color of each hexagon in the polygon.
hexPolygonAltitudenumber, string or func0.001Hexed polygon object accessor function, attribute or a numeric constant for the polygon's hexagons altitude in terms of globe radius units (0 = 0 altitude, 1 = globe radius).
hexPolygonResolutionnumber, string or func3Hexed polygon object accessor function, attribute or a numeric constant for the geographic binning resolution as defined by H3. Determines the area of the hexagons that tesselate the globe's surface. Accepts values between 0 and 15. Level 0 partitions the earth in 122 (mostly) hexagonal cells. Each subsequent level sub-divides the previous in roughly 7 hexagons.
hexPolygonMarginnumber, string or func0.2Hexed polygon object accessor function, attribute or a numeric constant for the radial margin of each hexagon. Margins above 0 will create gaps between adjacent hexagons within a polygon. The margin is specified in terms of fraction of the hexagon's surface diameter. Values below 0 or above 1 are disadvised.
hexPolygonUseDotsbool, string or funcfalseHexed polygon object accessor function, attribute or a boolean constant for whether to represent each polygon point as a circular dot instead of an hexagon.
hexPolygonCurvatureResolutionnumber, string or func5Hexed polygon object accessor function, attribute or a numeric constant for the resolution (in angular degrees) of each hexed polygon surface curvature. The finer the resolution, the more the polygon hexes are fragmented into smaller faces to approximate the spheric surface, at the cost of performance.
hexPolygonDotResolutionnumber, string or func12Hexed polygon object accessor function, attribute or a numeric constant for the resolution of each circular dot, expressed in how many slice segments to divide the circumference. Higher values yield smoother circles, at the cost of performance. This is only applicable in dot representation mode.
hexPolygonsTransitionDurationnumber0Duration (ms) of the transition to animate hexed polygons altitude and margin changes. A value of 0 will move the hexagons immediately to their final state. New hexed polygons are animated by sizing each hexagon from 0 radius.
onHexPolygonClickfunc-Callback function for hexed polygon (left-button) clicks. The polygon object, the event object and the clicked coordinates are included as arguments: onHexPolygonClick(polygon, event, { lat, lng, altitude }).
onHexPolygonRightClickfunc-Callback function for hexed polygon right-clicks. The polygon object, the event object and the clicked coordinates are included as arguments: onHexPolygonRightClick(polygon, event, { lat, lng, altitude }).
onHexPolygonHoverfunc-Callback function for hexed polygon mouse over events. The polygon object (or null if there's no polygon under the mouse line of sight) is included as the first argument, and the previous polygon object (or null) as second argument: onHexPolygonHover(polygon, prevPolygon).

Tiles Layer

PropTypeDefaultDescription
tilesDataarray[]List of tiles to represent in the tiles map layer. Each tile is displayed as a spherical surface segment. The segments can be placed side-by-side for a tiled surface and each can be styled separately.
tileLabelstring or funcnameTile object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML content.
tileLatnumber, string or funclatTile object accessor function, attribute or a numeric constant for the segment's centroid latitude coordinate.
tileLngnumber, string or funclngTile object accessor function, attribute or a numeric constant for the segment's centroid longitude coordinate.
tileAltitudenumber, string or func0.01Tile object accessor function, attribute or a numeric constant for the segment's altitude in terms of globe radius units.
tileWidthnumber, string or func1Tile object accessor function, attribute or a numeric constant for the segment's longitudinal width, in angular degrees.
tileHeightnumber, string or func1Tile object accessor function, attribute or a numeric constant for the segment's latitudinal height, in angular degrees.
tileUseGlobeProjectionbool, string or functrueTile object accessor function, attribute or a boolean constant for whether to use the globe's projection to shape the segment to its relative tiled position (true), or break free from this projection and shape the segment as if it would be laying directly on the equatorial perimeter (false).
tileMaterialMaterial, string or func() => new MeshLambertMaterial({ color: '#ffbb88' })Tile object accessor function, attribute or material object for the ThreeJS material used to style the segment's surface.
tileCurvatureResolutionnumber, string or func5Tile object accessor function, attribute or a numeric constant for the resolution (in angular degrees) of the surface curvature. The finer the resolution, the more the tile geometry is fragmented into smaller faces to approximate the spheric surface, at the cost of performance.
tilesTransitionDurationnumber1000Duration (ms) of the transition to animate tile changes involving geometry modifications. A value of 0 will move the tiles immediately to their final position. New tiles are animated by scaling them from the centroid outwards.
onTileClickfunc-Callback function for tile (left-button) clicks. The tile object, the event object and the clicked coordinates are included as arguments: onTileClick(tile, event, { lat, lng, altitude }).
onTileRightClickfunc-Callback function for tile right-clicks. The tile object, the event object and the clicked coordinates are included as arguments: onTileRightClick(tile, event, { lat, lng, altitude }).
onTileHoverfunc-Callback function for tile mouse over events. The tile object (or null if there's no tile under the mouse line of sight) is included as the first argument, and the previous tile object (or null) as second argument: onTileHover(tile, prevTile).

Rings Layer

PropTypeDefaultDescription
ringsDataarray[]List of self-propagating ripple rings to represent in the rings map layer. Each data point is displayed as an animated set of concentric circles that propagate outwards from (or inwards to) a central point through the spherical surface.
ringLatnumber, string or funclatRing object accessor function, attribute or a numeric constant for each circle's center latitude coordinate.
ringLngnumber, string or funclngRing object accessor function, attribute or a numeric constant for each circle's center longitude coordinate.
ringAltitudenumber, string or func0.0015Ring object accessor function, attribute or a numeric constant for the circle's altitude in terms of globe radius units.
ringColorstring, string, ... or func() => '#ffffaa'Ring object accessor function or attribute for the stroke color of each ring. Also supports radial color gradients by passing an array of colors, or a color interpolator function.
ringResolutionnumber64Geometric resolution of each circle, expressed in how many slice segments to divide the circumference. Higher values yield smoother circles.
ringMaxRadiusnumber, string or func2Ring object accessor function, attribute or a numeric constant for the maximum outer radius of the circles, at which the rings stop propagating and are removed. Defined in angular degrees.
ringPropagationSpeednumber, string or func1Ring object accessor function, attribute or a numeric constant for the propagation velocity of the rings, defined in degrees/second. Setting a negative value will invert the direction and cause the rings to propagate inwards from the maxRadius.
ringRepeatPeriodnumber, string or func700Ring object accessor function, attribute or a numeric constant for the interval of time (in ms) to wait between consecutive auto-generated concentric circles. A value less or equal than 0 will disable the repetition and emit a single ring.

Labels Layer

PropTypeDefaultDescription
labelsDataarray[]List of label objects to represent in the labels map layer.
labelLabelstring or func-Label object accessor function or attribute for its own tooltip label. Supports plain text or HTML content.
labelLatnumber, string or funclatLabel object accessor function, attribute or a numeric constant for the latitude coordinate.
labelLngnumber, string or funclngLabel object accessor function, attribute or a numeric constant for the longitude coordinate.
labelTextstring or functextLabel object accessor function or attribute for the label text.
labelColorstring or func() => 'lightgrey'Label object accessor function or attribute for the label color.
labelAltitudenumber, string or func0Label object accessor function, attribute or a numeric constant for the label altitude in terms of globe radius units.
labelSizenumber, string or func0.5Label object accessor function, attribute or a numeric constant for the label text height, in angular degrees.
labelTypeFacetypeface object helvetiker regularText font typeface JSON object. Supports any typeface font generated by Facetype.js.
labelRotationnumber, string or func0Label object accessor function, attribute or a numeric constant for the label rotation in degrees. The rotation is performed clockwise along the axis of its latitude parallel plane.
labelResolutionnumber3The text geometric resolution of each label, expressed in how many segments to use in the text curves. Higher values yield smoother labels.
labelIncludeDotbool, string or functrueLabel object accessor function, attribute or a bool constant for whether to include a dot marker next to the text indicating the exact lat, lng coordinates of the label. If enabled the text will be rendered offset from the dot.
labelDotRadiusnumber, string or func0.1Label object accessor function, attribute or a numeric constant for the radius of the dot marker, in angular degrees.
labelDotOrientationstring or func() => 'bottom'Label object accessor function or attribute for the orientation of the label if the dot marker is present. Possible values are right, top and bottom.
labelsTransitionDurationnumber1000Duration (ms) of the transition to animate label changes involving position modifications (lat, lng, altitude, rotation). A value of 0 will move the labels immediately to their final position. New labels are animated by scaling their size.
onLabelClickfunc-Callback function for label (left-button) clicks. The label object, the event object and the clicked coordinates are included as arguments: onLabelClick(label, event, { lat, lng, altitude }).
onLabelRightClickfunc-Callback function for label right-clicks. The label object, the event object and the clicked coordinates are included as arguments: onLabelRightClick(label, event, { lat, lng, altitude }).
onLabelHoverfunc-Callback function for label mouse over events. The label object (or null if there's no label under the mouse line of sight) is included as the first argument, and the previous label object (or null) as second argument: onLabelHover(label, prevlabel).

HTML Elements Layer

PropTypeDefaultDescription
htmlElementsDataarray[]List objects to represent in the HTML elements map layer. Each HTML element is rendered using ThreeJS CSS2DRenderer.
htmlLatnumber, string or funclatHTML element accessor function, attribute or a numeric constant for the latitude coordinate of the element's central position.
htmlLngnumber, string or funclngHTML element accessor function, attribute or a numeric constant for the longitude coordinate of the element's central position.
htmlAltitudenumber, string or func0HTML element accessor function, attribute or a numeric constant for the altitude coordinate of the element's position, in terms of globe radius units.
htmlElementstring or funcnullAccessor function or attribute to retrieve the DOM element to use. Should return an instance of HTMLElement.
htmlTransitionDurationnumber1000Duration (ms) of the transition to animate HTML elements position changes. A value of 0 will move the elements immediately to their final position.

3D Objects Layer

PropTypeDefaultDescription
objectsDataarray[]Getter/setter for the list of custom 3D objects to represent in the objects layer. Each object is rendered according to the objectThreeObject method.
objectLabelstring or funcnameObject accessor function or attribute for its own tooltip label. Supports plain text or HTML content.
objectLatnumber, string or funclatObject accessor function, attribute or a numeric constant for the latitude coordinate of the object's position.
objectLngnumber, string or funclngObject accessor function, attribute or a numeric constant for the longitude coordinate of the object's position.
objectAltitudenumber, string or func0.01Object accessor function, attribute or a numeric constant for the altitude coordinate of the object's position, in terms of globe radius units.
objectRotation{x, y, z}, string or funcObject accessor function, attribute or a {x, y, z} object for the object's rotation (in degrees). Each dimension is optional, allowing for rotation only in some axes. Rotation is applied in the order X->Y->Z.
objectFacesSurfacebool, string or functrueObject accessor function, attribute or a boolean constant for whether the object should be rotated to face (away from) the globe surface (true), or be left in its original universe orientation (false).
objectThreeObjectObject3d, string or funcA yellow sphereObject accessor function or attribute for defining a custom 3d object to render as part of the objects map layer. Should return an instance of ThreeJS Object3d.
onObjectClickfunc-Callback function for object (left-button) clicks. The object itself, the event and the clicked coordinates are included as arguments: onObjectClick(obj, event, { lat, lng, altitude }).
onObjectRightClickfunc-Callback function for object right-clicks. The object itself, the event and the clicked coordinates are included as arguments: onObjectRightClick(obj, event, { lat, lng, altitude }).
onObjectHoverfunc-Callback function for object mouse over events. The object itself (or null if there's no object under the mouse line of sight) is included as the first argument, and the previous object (or null) as second argument: onObjectHover(obj, prevObj).

Custom Layer

PropTypeDefaultDescription
customLayerDataarray[]List of items to represent in the custom map layer. Each item is rendered according to the customThreeObject method.
customLayerLabelstring or funcnameObject accessor function or attribute for label (shown as tooltip). Supports plain text or HTML content.
customThreeObjectObject3d, string or func-Object accessor function or attribute for generating a custom 3d object to render as part of the custom map layer. Should return an instance of ThreeJS Object3d.
customThreeObjectUpdatestring or func-Object accessor function or attribute for updating an existing custom 3d object with new data. This can be used for performance improvement on data updates as the objects don't need to be removed and recreated at each update. The callback method's signature includes the object to be update and its new data: customThreeObjectUpdate((obj, objData) => { ... }).
onCustomLayerClickfunc-Callback function for custom object (left-button) clicks. The custom object, the event object and the clicked coordinates are included as arguments: onCustomLayerClick(obj, event, { lat, lng, altitude }).
onCustomLayerRightClickfunc-Callback function for custom object right-clicks. The custom object, the event object and the clicked coordinates are included as arguments: onCustomLayerRightClick(obj, event, { lat, lng, altitude }).
onCustomLayerHoverfunc-Callback function for custom object mouse over events. The custom object (or null if there's no object under the mouse line of sight) is included as the first argument, and the previous custom object (or null) as second argument: onCustomLayerHover(obj, prevObj).

Render Control

PropTypeDefaultDescription
rendererConfigobject{ antialias: true, alpha: true }Configuration parameters to pass to the ThreeJS WebGLRenderer constructor. This prop only has an effect on component mount.
enablePointerInteractionbooltrueWhether to enable the mouse tracking events. This activates an internal tracker of the canvas mouse position and enables the functionality of object hover/click and tooltip labels, at the cost of performance. If you're looking for maximum gain in your globe performance it's recommended to switch off this property.
pointerEventsFilterfunc() => trueFilter function which defines whether a particular object can be the target of pointer interactions. In general, objects that are closer to the camera get precedence in capturing pointer events. This function allows having ignored object layers so that pointer events can be passed through to deeper objects in the various globe layers. The ThreeJS object and its associated data (if any) are passed as arguments: pointerEventsFilter(obj, data). The function should return a boolean value.
lineHoverPrecisionnumber0.2Precision to use when detecting hover events over Line objects, such as arcs and paths.
MethodArgumentsDescription
pointOfView{ lat, lng, altitude } ,ms=0By default the camera will aim at the cross between the equator and the prime meridian (0,0 coordinates), at an altitude of 2.5 globe radii.Camera position, in terms of geographical lat, lng, altitude coordinates. Each of the coordinates is optional, allowing for motion in just some direction. The 2nd optional argument defines the duration of the transition (in ms) to animate the camera motion. A value of 0 (default) moves the camera immediately to the final position.
pauseAnimation-Pauses the rendering cycle of the component, effectively freezing the current view and cancelling all user interaction. This method can be used to save performance in circumstances when a static image is sufficient.
resumeAnimation-Resumes the rendering cycle of the component, and re-enables the user interaction. This method can be used together with pauseAnimation for performance optimization purposes.
onZoomfuncCallback function for point-of-view changes by zooming or rotating the globe using the orbit controls. The current point of view (with the syntax { lat, lng, altitude }) is included as sole argument.
lightsarrayGetter/setter for the list of lights to use in the scene. Each item should be an instance of Light.
scene-Access the internal ThreeJS Scene. Can be used to extend the current scene with additional objects not related to globe.gl.
camera-Access the internal ThreeJS Camera.
renderer-Access the internal ThreeJS WebGL renderer.
postProcessingComposer-Access the post-processing composer. Use this to add post-processing rendering effects to the scene. By default the composer has a single pass (RenderPass) that directly renders the scene without any effects.
controls-Access the internal ThreeJS orbit controls object.

Utility

MethodArgumentsDescription
getGlobeRadius-Returns the cartesian distance of a globe radius in absolute spatial
2.27.2

3 months ago

2.27.1

5 months ago

2.27.0

7 months ago

2.26.0

7 months ago

2.25.0

7 months ago

2.24.4

8 months ago

2.24.3

9 months ago

2.24.2

10 months ago

2.23.5

1 year ago

2.23.2

1 year ago

2.23.1

1 year ago

2.23.4

1 year ago

2.23.3

1 year ago

2.24.1

1 year ago

2.24.0

1 year ago

2.23.0

1 year ago

2.22.7

1 year ago

2.22.6

1 year ago

2.22.9

1 year ago

2.22.8

1 year ago

2.22.5

2 years ago

2.22.10

1 year ago

2.22.3

2 years ago

2.22.4

2 years ago

2.22.1

2 years ago

2.22.2

2 years ago

2.21.3

2 years ago

2.22.0

2 years ago

2.20.2

2 years ago

2.20.3

2 years ago

2.20.0

2 years ago

2.20.1

2 years ago

2.20.4

2 years ago

2.21.0

2 years ago

2.21.2

2 years ago

2.21.1

2 years ago

2.19.0

2 years ago

2.18.11

3 years ago

2.18.10

3 years ago

2.18.9

3 years ago

2.18.8

3 years ago

2.18.7

3 years ago

2.18.5

3 years ago

2.18.6

3 years ago

2.18.4

3 years ago

2.18.3

3 years ago

2.18.1

3 years ago

2.18.2

3 years ago

2.18.0

3 years ago

2.17.1

3 years ago

2.17.0

3 years ago

2.16.1

3 years ago

2.15.1

3 years ago

2.16.0

3 years ago

2.15.0

3 years ago

2.14.6

3 years ago

2.14.5

3 years ago

2.14.4

3 years ago

2.14.3

3 years ago

2.14.2

3 years ago

2.14.1

3 years ago

2.14.0

3 years ago

2.13.0

3 years ago

2.12.10

3 years ago

2.12.9

3 years ago

2.12.8

3 years ago

2.12.7

4 years ago

2.12.6

4 years ago

2.12.5

4 years ago

2.12.4

4 years ago

2.12.3

4 years ago

2.12.2

4 years ago

2.12.1

4 years ago

2.12.0

4 years ago

2.11.0

4 years ago

2.10.4

4 years ago

2.10.2

4 years ago

2.10.3

4 years ago

2.10.1

4 years ago

2.10.0

4 years ago

2.9.1

4 years ago

2.9.0

4 years ago

2.8.3

4 years ago

2.8.2

4 years ago

2.8.1

4 years ago

2.8.0

4 years ago

2.7.8

4 years ago

2.7.7

4 years ago

2.7.6

4 years ago

2.7.4

4 years ago

2.7.5

4 years ago

2.7.3

4 years ago

2.7.2

4 years ago

2.7.1

4 years ago

2.7.0

4 years ago

2.6.2

4 years ago

2.6.1

4 years ago

2.6.0

4 years ago

2.5.0

4 years ago

2.4.4

4 years ago

2.4.3

4 years ago

2.4.2

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.1

4 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.1

5 years ago