Python API
dash-globe wraps react-globe.gl
with a chainable, figure-like Python API. Configure layout, textures, camera, and layers in fluent
calls, then wire clickData / hoverData into normal Dash callbacks.
Imports
import dash_globe globe = dash_globe.DashGlobe(id="globe") # Helpers dash_globe.PRESETS dash_globe.data_url(...) dash_globe.event_coords(...) dash_globe.material_spec(...) dash_globe.lambert_material(...) dash_globe.ring_color_interpolator(...)
Install with pip install dash-globe. Public exports are listed in
dash_globe.__all__.
DashGlobe
Subclasses the generated Dash component. Defaults responsive=True.
All helpers return self so calls chain.
DashGlobe(*args, **kwargs)
Create a globe component. Pass any raw react-globe.gl prop alongside high-level helpers.
dash_globe.DashGlobe(id="demo", responsive=True)
update(**kwargs)
Set component props in place. Snake-case aliases are accepted for camelCase props
(for example background_color → backgroundColor).
Scene helpers
update_layout(...)
Outer layout and renderer settings.
| Parameter | Description |
|---|---|
width, height | Canvas size in pixels. |
responsive | Resize with the container. |
background_color | CSS color behind the canvas. |
background_image_url | Background image URL. |
globe_offset | [x, y] offset from canvas center. |
wait_for_globe_ready | Defer animation until assets load. |
animate_in | Initial entrance animation. |
renderer_config, style, class_name | Renderer / wrapper extras. |
update_globe(...)
Globe shell texture and atmosphere.
| Parameter | Description |
|---|---|
globe_image_url, bump_image_url | Base and bump textures. |
show_globe, show_graticules, show_atmosphere | Visibility toggles. |
atmosphere_color, atmosphere_altitude | Atmosphere styling. |
curvature_resolution | Mesh curvature resolution. |
update_view(lat=, lng=, altitude=, transition_duration=)
Set camera target. Omitted fields keep their current values.
update_controls(auto_rotate=, auto_rotate_speed=)
Orbit control auto-rotation.
update_interaction(...)
Pointer picking, cursor style, line hover precision, animation pause, and
currentView report interval.
update_day_night_cycle(...)
Built-in day/night shader:
enabled, day_image_url, night_image_url,
time, animate, minutes_per_second.
update_clouds(...)
Rotating cloud shell:
enabled, image_url, altitude,
rotation_speed, opacity.
clear_tile_cache()
Bump clearGlobeTileCacheKey so the client refreshes cached tiles.
Layers
Each layer has an add_* helper that appends records and an
update_* helper that replaces data and/or sets accessors.
Pass a single list or multiple positional records to add_*.
Points
.add_points(*points) .update_points(data=None, **props)
Common props: point_lat, point_lng, point_color, point_label, point_altitude, point_radius.
Arcs
.add_arcs(*arcs) .update_arcs(data=None, **props)
Common props: arc_start_lat, arc_start_lng, arc_end_lat, arc_end_lng, arc_color, arc_dash_length, arc_dash_gap, arc_dash_animate_time.
Polygons
.add_polygons(*polygons) .update_polygons(data=None, **props)
Common props: polygon_geo_json_geometry, polygon_cap_color, polygon_side_color, polygon_stroke_color, polygon_altitude, polygon_label.
Paths
.add_paths(*paths) .update_paths(data=None, path_points=..., path_color=..., ...)
Heatmaps
.add_heatmap(points) .add_heatmaps(*heatmaps) .update_heatmap(data=None, **props) .update_heatmaps(data=None, **props)
Hex bins & hex polygons
.add_hex_bins(*points) / .update_hex_bins(...) .add_hex_polygons(*polygons) / .update_hex_polygons(...)
Tiles
.add_tiles(*tiles) .update_tiles(data=None, tile_material=..., ...)
Use material_spec(...) or lambert_material(...) for JSON-serialisable materials.
Particles
.add_particle_sets(*particle_sets) .update_particles(data=None, **props)
Rings
.add_rings(*rings) .update_rings(data=None, ring_color=..., ...)
Animated ring colors can use ring_color_interpolator(...) instead of a JS callback.
Labels
.add_labels(*labels) .update_labels(data=None, label_text=..., ...)
HTML overlays
.add_html_elements(*elements, children=None) .update_html_elements(data=None, children=None, **props)
Geo-anchored Dash children matched to htmlElementsData by index.
Large data
enable_large_data_mode(enabled=True, **props)
Enables client-side large-data defaults (summary event payloads, merged point/hex
rendering, disabled layer transitions). Pair with data_url(...).
dash_globe.data_url(url, unwrap_features=True)
Returns a compact marker the React wrapper fetches in the browser so large GeoJSON
never enters the Dash layout. GeoJSON FeatureCollections are unwrapped to
.features by default.
.update_polygons(
data=dash_globe.data_url("https://example.com/countries.geojson"),
polygon_geo_json_geometry="geometry",
polygon_cap_color="steelblue",
)
Helpers
PRESETS
Built-in texture URLs:
| Attribute | Use |
|---|---|
EARTH, EARTH_DAY, EARTH_NIGHT, EARTH_DARK | Globe textures |
EARTH_TOPOGRAPHY, EARTH_WATER | Bump / water masks |
NIGHT_SKY | Background starfield |
CLOUDS | Cloud shell texture |
event_coords(event)
Extract {"lat", "lng", "altitude?"} from a clickData /
hoverData payload. Returns None when coordinates are missing.
material_spec(type, **options) / lambert_material(...)
JSON material specs for tile layers. Types:
basic, lambert, phong, standard.
Side: front, back, double.
ring_color_interpolator(color, fade_color=, opacity=, fade_opacity=, easing=)
Serialisable stand-in for a JS ringColor callback.
Easing: linear, sqrt, square, cubic.
Events & callbacks
These props participate in normal Dash callbacks as Inputs/States:
| Prop | Meaning |
|---|---|
clickData | Last left-click pick payload |
rightClickData | Last right-click pick payload |
hoverData | Current hover pick payload |
currentView | Reported camera view (lat/lng/altitude) |
eventDataMode | "summary" or "full" payload size |
from dash import Input, Output, callback
import dash_globe
@callback(Output("out", "children"), Input("globe", "clickData"))
def on_click(click_data):
coords = dash_globe.event_coords(click_data)
return str(coords)
Accessors & naming
Layer accessors accept either a constant value or a string field path
(for example "lat" or "properties.ADMIN").
High-level helpers accept snake_case; raw camelCase props also work via
update(...) or the constructor.
react-globe.gl features.
Raw JavaScript functions, DOM nodes, and arbitrary Three.js objects are not
exposed through the high-level helpers.