A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developmentseed.org/lonboard/latest/api/layers/path-layer/ below:

PathLayer - lonboard

Bases: BaseArrowLayer

The PathLayer renders lists of coordinate points as extruded polylines with mitering.

Example:

From GeoPandas:

import geopandas as gpd
from lonboard import Map, PathLayer

# A GeoDataFrame with LineString or MultiLineString geometries
gdf = gpd.GeoDataFrame()
layer = PathLayer.from_geopandas(
    gdf,
    get_color=[255, 0, 0],
    width_min_pixels=2,
)
m = Map(layer)

From geoarrow-rust:

from geoarrow.rust.io import read_parquet
from lonboard import Map, PathLayer

# Example: A GeoParquet file with LineString or MultiLineString geometries
table = read_parquet("path/to/file.parquet")
layer = PathLayer(
    table=table,
    get_color=[255, 0, 0],
    width_min_pixels=2,
)
m = Map(layer)
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.

billboard class-attribute instance-attribute
billboard = tag(sync=True)

If True, extrude the path in screen space (width always faces the camera). If False, the width always faces up.

cap_rounded class-attribute instance-attribute
cap_rounded = tag(sync=True)

Type of caps. If True, draw round caps. Otherwise draw square caps.

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

The color of each path in the format of [r, g, b, [a]]. Each channel is a number between 0-255 and a is 255 if not supplied.

get_width class-attribute instance-attribute

The width of each path, in units specified by width_units (default 'meters').

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.

joint_rounded class-attribute instance-attribute
joint_rounded = tag(sync=True)

Type of joint. If True, draw round joints. Otherwise draw miter joints.

miter_limit class-attribute instance-attribute
miter_limit = tag(sync=True)

The maximum extent of a joint in ratio to the stroke width. Only works if jointRounded is False.

opacity class-attribute instance-attribute

The opacity of the layer.

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.

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(allowed_geometry_types={LINESTRING, MULTILINESTRING})

A GeoArrow table with a LineString or MultiLineString 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 class-attribute instance-attribute

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.

width_max_pixels class-attribute instance-attribute
width_max_pixels = tag(sync=True)

The maximum path width in pixels. This prop can be used to prevent the path from getting too thick when zoomed in.

width_min_pixels class-attribute instance-attribute
width_min_pixels = tag(sync=True)

The minimum path width in pixels. This prop can be used to prevent the path from getting too thin when zoomed out.

width_scale class-attribute instance-attribute
width_scale = tag(sync=True)

The path width multiplier that multiplied to all paths.

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.

__init__
__init__(
    table: ArrowStreamExportable,
    *,
    _rows_per_chunk: int | None = None,
    **kwargs: Unpack[PathLayerKwargs]
) -> 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:

Other Parameters:

Returns:

from_duckdb classmethod

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:

Other Parameters:

Returns:

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

Other Parameters:

Returns:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4