lonboard.traits¶
lonboard.traits.ColorAccessor ¶
Bases: FixedErrorTraitType
A trait to validate input for a deck.gl color accessor.
Various input is allowed:
- A
list
ortuple
with three or four integers, ranging between 0 and 255 (inclusive). This will be used as the color for all objects. - A
str
representing a hex color or "well known" color interpretable by matplotlib.colors.to_rgba. See also matplotlib's list of named colors. - A numpy
ndarray
with two dimensions and data typenp.uint8
. The size of the second dimension must be3
or4
, and will correspond to either RGB or RGBA colors. - A pyarrow
FixedSizeListArray
orChunkedArray
containingFixedSizeListArray
s. The inner size of the fixed size list must be3
or4
and its child must have typeuint8
. - Any Arrow fixed size list array from a library that implements the Arrow PyCapsule Interface.
You can use helpers in the lonboard.colormap
module (i.e.
apply_continuous_cmap
) to simplify
constructing numpy arrays for color values.
lonboard.traits.DashArrayAccessor ¶
Bases: FixedErrorTraitType
A trait to validate input for a deck.gl dash accessor.
Primarily used in
PathStyleExtension
.
Various input is allowed:
- A
list
ortuple
with 2 integers. This defines the dash size and gap size respectively. - A numpy
ndarray
with two dimensions and numeric data type. The size of the second dimension must be2
. - A pyarrow
FixedSizeListArray
orChunkedArray
containingFixedSizeListArray
s. The inner size of the fixed size list must be2
. - Any Arrow fixed size list array from a library that implements the Arrow PyCapsule Interface.
lonboard.traits.FloatAccessor ¶
Bases: FixedErrorTraitType
A trait to validate input for a deck.gl float accessor.
Various input is allowed:
- An
int
orfloat
. This will be used as the value for all objects. - A numpy
ndarray
with a numeric data type. This will be casted to an array of data typenp.float32
. Each value in the array will be used as the value for the object at the same row index. - A pandas
Series
with a numeric data type. This will be casted to an array of data typenp.float32
. Each value in the array will be used as the value for the object at the same row index. - A pyarrow
FloatArray
,DoubleArray
orChunkedArray
containing either aFloatArray
orDoubleArray
. Each value in the array will be used as the value for the object at the same row index. - Any Arrow floating point array from a library that implements the Arrow PyCapsule
Interface.
This includes data structures from
geoarrow-rust
.
lonboard.traits.FilterValueAccessor ¶
Bases: FixedErrorTraitType
A trait to validate input for the get_filter_value
accessor added by the
DataFilterExtension
, which can
have between 1 and 4 float values per row.
Various input is allowed:
- An
int
orfloat
. This will be used as the value for all objects. Thefilter_size
of theDataFilterExtension
instance must be 1. - A one-dimensional numpy
ndarray
with a numeric data type. This will be casted to an array of data typenp.float32
. Each value in the array will be used as the value for the object at the same row index. Thefilter_size
of theDataFilterExtension
instance must be 1. - A two-dimensional numpy
ndarray
with a numeric data type. This will be casted to an array of data typenp.float32
. Each value in the array will be used as the value for the object at the same row index. Thefilter_size
of theDataFilterExtension
instance must match the size of the second dimension of the array. - A pandas
Series
with a numeric data type. This will be casted to an array of data typenp.float32
. Each value in the array will be used as the value for the object at the same row index. Thefilter_size
of theDataFilterExtension
instance must be 1. - A pyarrow
FloatArray
,DoubleArray
orChunkedArray
containing either aFloatArray
orDoubleArray
. Each value in the array will be used as the value for the object at the same row index. Thefilter_size
of theDataFilterExtension
instance must be 1.
Alternatively, you can pass any corresponding Arrow data structure from a library
that implements the Arrow PyCapsule
Interface.
- A pyarrow FixedSizeListArray
or
ChunkedArray
containing FixedSizeListArray
s. The child
array of the fixed size list must be of floating point type. The filter_size
of
the DataFilterExtension
instance
must match the list size.
Alternatively, you can pass any corresponding Arrow data structure from a library that implements the Arrow PyCapsule Interface.
lonboard.traits.NormalAccessor ¶
Bases: FixedErrorTraitType
A representation of a deck.gl "normal" accessor
This is primarily used in the [lonboard.PointCloudLayer].
Acceptable inputs:
- A list
or tuple
with three int
or float
values. This will be used as the
normal for all objects.
- A numpy ndarray with two dimensions and floating point type. The size of the
second dimension must be 3, i.e. its shape must be (N, 3)
.
- a pyarrow FixedSizeListArray
or ChunkedArray
containing FixedSizeListArray
s
where the size of the inner fixed size list 3. The child array must have type
float32.
- Any Arrow array that matches the above restrictions from a library that implements
the Arrow PyCapsule
Interface.
lonboard.traits.PointAccessor ¶
Bases: FixedErrorTraitType
A representation of a deck.gl point accessor.
Various input is allowed:
- A numpy
ndarray
with two dimensions and data typenp.uint8
. The size of the second dimension must be2
or3
, and will correspond to either XY or XYZ positions. - A pyarrow
FixedSizeListArray
orChunkedArray
containingFixedSizeListArray
s. The inner size of the fixed size list must be2
or3
and its child must be of floating point type.
lonboard.traits.ArrowTableTrait ¶
Bases: FixedErrorTraitType
A trait to validate input for a geospatial Arrow-backed table
Allowed input includes:
- A pyarrow
Table
or containing a geometry column with GeoArrow metadata. - Any GeoArrow table from a library that implements the Arrow PyCapsule
Interface.
This includes the
GeoTable
class fromgeoarrow-rust
.
lonboard.experimental.traits.TimestampAccessor ¶
Bases: FixedErrorTraitType
A representation of a deck.gl coordinate-timestamp accessor.
deck.gl handles timestamps on the GPU as float32 values. This class will validate that the input timestamps are representable as float32 integers, and will automatically reduce the precision of input data if necessary to fit inside a float32.
Accepted input includes:
- A pyarrow
ListArray
containing a temporal array such as a TimestampArray. Each value in the array will be used as the value for the object at the same row index. - Any Arrow list array containing a temporal array from a library that implements the Arrow PyCapsule Interface.