ColumnLayer¶
lonboard.ColumnLayer ¶
Bases: BaseArrowLayer
The ColumnLayer renders extruded cylinders (tessellated regular polygons) at given coordinates.
angle ¶
angle = Float(None, allow_none=True)
Disk rotation, counter-clockwise in degrees.
- Type:
float, optional - Default:
0
auto_highlight ¶
auto_highlight = Bool(default_value=False)
When true, the current object pointed to by the mouse pointer (when hovered over) is
highlighted with highlightColor.
Requires pickable to be True.
- Type:
bool - Default:
False
before_id ¶
before_id = Unicode(None, allow_none=True)
The identifier of a layer in the Maplibre basemap layer stack.
This deck.gl layer will be rendered just before the layer with the given identifier. You can find such an identifier by inspecting the basemap style JSON.
For example, in the Carto Positron style, if
you look at the raw JSON
data, each layer has
an "id" property. The first layer in the basemap stack has "id": "background".
So if you pass before_id="background", you won't see your deck.gl layer because it
will be rendered below all layers in the Maplibre basemap.
A common choice for Carto-based styles is to use before_id="watername_ocean" so
that your deck.gl layer is rendered above the core basemap elements but below all
text labels.
Info
This only has an effect when the map's basemap is a
MaplibreBasemap, and the map is rendering
in "interleaved" mode.
coverage ¶
coverage = Float(None, allow_none=True)
Radius multiplier, between 0 - 1. The radius of the disk is calculated by
coverage * radius
- Type:
float, optional - Default:
1
disk_resolution ¶
disk_resolution = Int(None, allow_none=True)
The number of sides to render the disk as. The disk is a regular polygon that fits inside the given radius. A higher resolution will yield a smoother look close-up, but also need more resources to render.
- Type:
int, optional - Default:
20
elevation_scale ¶
elevation_scale = Float(None, allow_none=True)
Column elevation multiplier. The elevation of column is calculated by
elevation_scale * get_elevation(d). elevation_scale is a handy property
to scale all column elevations without updating the data.
- Type:
float, optional - Default:
1
extensions ¶
extensions = tag(sync=True, **(widget_serialization))
A list of layer extension objects to add additional features to a layer.
extruded ¶
extruded = Bool(None, allow_none=True)
Whether to extrude the columns. If set to false, all columns will be rendered as
flat polygons.
- Type:
bool, optional - Default:
True
filled ¶
filled = Bool(None, allow_none=True)
Whether to draw a filled column (solid fill).
- Type:
bool, optional - Default:
True
flat_shading ¶
flat_shading = Bool(None, allow_none=True)
If True, the vertical surfaces of the columns use flat
shading. If false,
use smooth shading. Only effective if extruded is True.
- Type:
bool, optional - Default:
False
get_elevation ¶
get_elevation = FloatAccessor(None, allow_none=True)
The elevation of each cell in meters.
Only applies if extruded=True.
- Type: FloatAccessor, optional
- If a number is provided, it is used as the width for all polygons.
- If an array is provided, each value in the array will be used as the width for the polygon at the same row index.
- Default:
1000.
get_fill_color ¶
get_fill_color = ColorAccessor(None, allow_none=True)
The filled color of each object in the format of [r, g, b, [a]]. Each channel is a
number between 0-255 and a is 255 if not supplied.
- Type: ColorAccessor, optional
- If a single
listortupleis provided, it is used as the filled color for all objects. - If a numpy or pyarrow array is provided, each value in the array will be used as the filled color for the object at the same row index.
- If a single
- Default:
[0, 0, 0, 255].
get_line_color ¶
get_line_color = ColorAccessor(None, allow_none=True)
The outline color of each object in the format of [r, g, b, [a]]. Each channel is
a number between 0-255 and a is 255 if not supplied.
- Type: ColorAccessor, optional
- If a single
listortupleis provided, it is used as the outline color for all objects. - If a numpy or pyarrow array is provided, each value in the array will be used as the outline color for the object at the same row index.
- If a single
- Default:
[0, 0, 0, 255].
get_line_width ¶
get_line_width = FloatAccessor(None, allow_none=True)
The width of the outline of each column, in units specified by line_width_units
(default 'meters'). Only applies if extruded: false and stroked: true.
- Type: FloatAccessor, optional
- If a number is provided, it is used as the outline width for all columns.
- If an array is provided, each value in the array will be used as the outline width for the column at the same row index.
- Default:
1.
highlight_color ¶
highlight_color = VariableLengthTuple(
Int(), default_value=(0, 0, 128, 128), minlen=3, maxlen=4
)
RGBA color to blend with the highlighted object (the hovered over object if
auto_highlight=true). When the value is a 3 component (RGB) array, a default alpha
of 255 is applied.
- Type: List or Tuple of integers
- Default:
[0, 0, 128, 128]
line_width_max_pixels ¶
line_width_max_pixels = Float(None, allow_none=True, min=0)
The maximum outline width in pixels. This can be used to prevent the line from getting too big when zoomed in.
- Type:
float, optional - Default:
None
line_width_min_pixels ¶
line_width_min_pixels = Float(None, allow_none=True, min=0)
The minimum outline width in pixels. This can be used to prevent the line from getting too small when zoomed out.
- Type:
float, optional - Default:
0
line_width_scale ¶
line_width_scale = Float(None, allow_none=True, min=0)
The line width multiplier that multiplied to all outlines if the stroked attribute
is True.
- Type:
float, optional - Default:
1
line_width_units ¶
line_width_units = Unicode(None, allow_none=True)
The units of the line width, one of 'meters', 'common', and 'pixels'. See
unit
system.
- Type:
str, optional - Default:
'meters'
offset ¶
offset = tag(sync=True)
Disk offset from the position, relative to the radius. By default, the disk is centered at each position.
- Type:
tuple[float, float], optional - Default:
(0, 0)
opacity ¶
opacity = Float(1, min=0, max=1)
The opacity of the layer.
- Type:
float. Must range between 0 and 1. - Default:
1
pickable ¶
pickable = Bool(default_value=True)
Whether the layer responds to mouse pointer picking events.
This must be set to True for tooltips and other interactive elements to be
available. This can also be used to only allow picking on specific layers within a
map instance.
Note that picking has some performance overhead in rendering. To get the absolute
best rendering performance with large data (at the cost of removing interactivity),
set this to False.
- Type:
bool - Default:
True
radius ¶
radius = Float(None, allow_none=True)
Disk size in units specified by radius_units (default meters).
- Type:
float, optional - Default:
1000
radius_units ¶
radius_units = Unicode(None, allow_none=True)
The units of the radius, one of 'meters', 'common', and 'pixels'. See unit
system.
- Type:
str, optional - Default:
'meters'
selected_index ¶
selected_index = Int(None, allow_none=True)
The positional index of the most-recently clicked on row of data.
You can use this to access the full row of data from a GeoDataFrame
gdf.iloc[layer.selected_index]
Setting a value here from Python will do nothing. This attribute only exists to be
updated from JavaScript on a map click. Note that pickable must be True (the
default) on this layer for the JavaScript onClick handler to work; if pickable
is set to False, selected_index will never update.
Note that you can use observe to call a function whenever a new value is received
from JavaScript. Refer
here
for an example.
stroked ¶
stroked = Bool(None, allow_none=True)
Whether to draw an outline around the disks. Only applies if extruded=False.
- Type:
bool, optional - Default:
False
table ¶
table = ArrowTableTrait(allowed_geometry_types={POINT})
A GeoArrow table with a Point or MultiPoint column.
This is the fastest way to plot data from an existing GeoArrow source, such as geoarrow-rust or geoarrow-pyarrow.
If you have a GeoPandas GeoDataFrame, use
from_geopandas instead.
visible ¶
visible = Bool(default_value=True)
Whether the layer is visible.
Under most circumstances, using the visible attribute to control the visibility of
layers is recommended over removing/adding the layer from the Map.layers list.
In particular, toggling the visible attribute will persist the layer on the
JavaScript side, while removing/adding the layer from the Map.layers list will
re-download and re-render from scratch.
- Type:
bool - Default:
True
wireframe ¶
wireframe = Bool(None, allow_none=True)
Whether to generate a line wireframe of the column. The outline will have
"horizontal" lines closing the top and bottom polygons and a vertical line
(a "strut") for each vertex around the disk. Only applies if extruded=True.
- Type:
bool, optional - Default:
False
__init__ ¶
__init__(
table: ArrowStreamExportable,
*,
_rows_per_chunk: int | None = None,
**kwargs: Unpack[ColumnLayerKwargs]
) -> None
Construct a Layer from a GeoArrow table.
This accepts Arrow data from any library implementing the Arrow PyCapsule Interface, including pyarrow, arro3, DuckDB, and others.
The geometry column will be reprojected to EPSG:4326 if it is not already in
that coordinate system.
Parameters:
-
table(ArrowStreamExportable) –An Arrow table or stream object from a library implementing the [Arrow PyCapsule Interface]. This object must contain a column with a geometry type that has the
geoarrowextension metadata.
Other Parameters:
-
kwargs(Unpack[BaseLayerKwargs]) –parameters passed on to
__init__
Returns:
-
None–A Layer with the initialized data.
from_duckdb ¶
from_duckdb(
sql: str | DuckDBPyRelation,
con: DuckDBPyConnection | None = None,
*,
crs: str | CRS | None = None,
**kwargs: Unpack[ColumnLayerKwargs]
) -> Self
Construct a Layer from a duckdb-spatial query.
With DuckDB >= 1.5, the CRS of a GEOMETRY column is read
automatically from the column type (e.g. GEOMETRY('EPSG:3857')) and
the data is reprojected to EPSG:4326 as needed.
The crs keyword parameter is deprecated for such input and is only
needed when the data cannot describe its own CRS: WKB_BLOB or 2D
columns (POINT_2D, LINESTRING_2D, POLYGON_2D, BOX_2D), DuckDB
older than 1.5, or a GEOMETRY column without a CRS encoded. In those
cases, the user must ensure that data has been reprojected to
EPSG:4326 or pass the existing CRS of the data in the crs keyword
parameter.
Parameters:
-
sql(str | DuckDBPyRelation) –The SQL input to visualize. This can either be a string containing a SQL query or the output of the duckdb
sqlfunction. -
con(DuckDBPyConnection | None, default:None) –The current DuckDB connection. This is required when passing a
strto thesqlparameter.
Other Parameters:
-
crs(str | CRS | None) –The CRS of the input data, for input that cannot describe its own CRS (see above). This can either be a string passed to
pyproj.CRS.from_user_inputor apyproj.CRSobject. Errors if it conflicts with the CRS encoded in a DuckDB >= 1.5GEOMETRYcolumn. Defaults to None. -
kwargs(Unpack[BaseLayerKwargs]) –parameters passed on to
__init__
Returns:
-
Self–A Layer with the initialized data.
from_geopandas ¶
from_geopandas(
gdf: GeoDataFrame,
*,
auto_downcast: bool = True,
**kwargs: Unpack[ColumnLayerKwargs]
) -> Self
Construct a Layer from a geopandas GeoDataFrame.
The GeoDataFrame will be reprojected to EPSG:4326 if it is not already in that
coordinate system.
Parameters:
-
gdf(GeoDataFrame) –The GeoDataFrame to set on the layer.
Other Parameters:
-
auto_downcast(bool) –If
True, automatically downcast to smaller-size data types if possible without loss of precision. This calls pandas.DataFrame.convert_dtypes and pandas.to_numeric under the hood. -
kwargs(Unpack[BaseLayerKwargs]) –parameters passed on to
__init__
Returns:
-
Self–A Layer with the initialized data.