Skip to content

ArcLayer

Screen recording from U.S. County-to-County Migration example.

lonboard.experimental.ArcLayer

Bases: BaseArrowLayer

Render raised arcs joining pairs of source and target coordinates.

auto_highlight class-attribute instance-attribute

auto_highlight = tag(sync=True)

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

extensions class-attribute instance-attribute

extensions = tag(sync=True, **widget_serialization)

A list of layer extension objects to add additional features to a layer.

get_height class-attribute instance-attribute

get_height = FloatAccessor(None, allow_none=True)

Height color of each object

get_source_color class-attribute instance-attribute

get_source_color = ColorAccessor(None, allow_none=True)

Source color of each object

get_source_position class-attribute instance-attribute

get_source_position = PointAccessor(None, allow_none=True)

Source position of each object

get_target_color class-attribute instance-attribute

get_target_color = ColorAccessor(None, allow_none=True)

Target color of each object

get_target_position class-attribute instance-attribute

get_target_position = PointAccessor(None, allow_none=True)

Target position of each object

get_tilt class-attribute instance-attribute

get_tilt = FloatAccessor(None, allow_none=True)

Use to tilt the arc to the side if you have multiple arcs with the same source and target positions.

  • Type: FloatAccessor, optional
    • If a number is provided, it is used as the width for all paths.
    • If an array is provided, each value in the array will be used as the width for the path at the same row index.
  • Default: 0.

get_width class-attribute instance-attribute

get_width = FloatAccessor(None, allow_none=True)

The line width of each object, in units specified by widthUnits.

  • Type: FloatAccessor, optional
    • If a number is provided, it is used as the width for all paths.
    • If an array is provided, each value in the array will be used as the width for the path at the same row index.
  • Default: 1.

great_circle class-attribute instance-attribute

great_circle = tag(sync=True)

If True, create the arc along the shortest path on the earth surface.

  • Type: bool, optional
  • Default: False

highlight_color class-attribute instance-attribute

highlight_color = VariableLengthTuple(
    Int(), default_value=None, 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]

num_segments class-attribute instance-attribute

num_segments = tag(sync=True)

The number of segments used to draw each arc.

  • Type: int, optional
  • Default: 50

opacity class-attribute instance-attribute

opacity = tag(sync=True)

The opacity of the layer.

  • Type: float. Must range between 0 and 1.
  • Default: 1

pickable class-attribute instance-attribute

pickable = tag(sync=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

selected_index class-attribute instance-attribute

selected_index = tag(sync=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.

table class-attribute instance-attribute

table = ArrowTableTrait()

A GeoArrow table.

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 class-attribute instance-attribute

visible = tag(sync=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

width_max_pixels class-attribute instance-attribute

width_max_pixels = tag(sync=True)

The maximum line width in pixels.

  • Type: float, optional
  • Default: None

width_min_pixels class-attribute instance-attribute

width_min_pixels = tag(sync=True)

The minimum line width in pixels.

  • Type: float, optional
  • Default: 0

width_scale class-attribute instance-attribute

width_scale = tag(sync=True)

The scaling multiplier for the width of each line.

  • Type: float, optional
  • Default: 1

width_units class-attribute instance-attribute

width_units = tag(sync=True)

The units of the line width, one of 'meters', 'common', and 'pixels'. See unit system.

  • Type: str, optional
  • Default: 'pixels'

from_duckdb classmethod

from_duckdb(
    sql: Union[str, DuckDBPyRelation],
    con: Optional[DuckDBPyConnection] = None,
    *,
    crs: Optional[Union[str, CRS]] = None,
    **kwargs: Unpack[BaseLayerKwargs]
) -> Self

Construct a Layer from a duckdb-spatial query.

DuckDB Spatial does not currently expose coordinate reference system information, so the user must ensure that data has been reprojected to EPSG:4326 or pass in the existing CRS of the data in the crs keyword parameter.

Parameters:

  • sql (Union[str, DuckDBPyRelation]) –

    The SQL input to visualize. This can either be a string containing a SQL query or the output of the duckdb sql function.

  • con (Optional[DuckDBPyConnection], default: None ) –

    The current DuckDB connection. This is required when passing a str to the sql parameter or when using a non-global DuckDB connection. Defaults to None.

Other Parameters:

  • crs (Optional[Union[str, CRS]]) –

    The CRS of the input data. This can either be a string passed to pyproj.CRS.from_user_input or a pyproj.CRS object. Defaults to None.

Returns:

  • Self

    A Layer with the initialized data.

from_geopandas classmethod

from_geopandas(
    gdf: GeoDataFrame,
    *,
    auto_downcast: bool = True,
    **kwargs: Unpack[BaseLayerKwargs]
) -> 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:

Returns:

  • Self

    A Layer with the initialized data.