Particles Layer¶

The particles layer renders dense clouds of lightweight points. Each
ParticleDatum is a group of ParticlePointDatum samples sharing a colour and
size.
from IPython.display import display
from pyglobegl import (
GlobeConfig,
GlobeWidget,
ParticleDatum,
ParticlePointDatum,
ParticlesLayerConfig,
)
particles = [
ParticleDatum(
particles=[
ParticlePointDatum(lat=0, lng=0, altitude=0.2, label="Alpha"),
ParticlePointDatum(lat=10, lng=10, altitude=0.2, label="Beta"),
],
color="palegreen",
size=2.0,
)
]
config = GlobeConfig(particles=ParticlesLayerConfig(particles_data=particles))
display(GlobeWidget(config=config))
ParticleDatum and ParticlePointDatum¶
ParticlePointDatum— one particle withlat,lng,altitude, andlabel.ParticleDatum— a group of particles plus sharedcolorandsize.
Custom tooltip¶
On hover globe.gl passes the individual particle point (a ParticlePointDatum),
not the containing group, so ParticlePointDatum.label is each particle's hover
tooltip. To compute one from that point datum or share a constant across the layer,
set a layer-level particle_label — a
frontend Python callback (point datum →
string), a plain string (one tooltip for all), or None (the default) to use each
ParticlePointDatum.label. Swap it at runtime with
GlobeWidget.set_particle_label(...).
From a GeoDataFrame
particles_from_gdf builds a particle group from point geometries with an
altitude_column and a shared color. See
GeoPandas helpers.