diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..c4b4abf3 --- /dev/null +++ b/404.html @@ -0,0 +1,723 @@ + + + +
+ + + + + + + + + + + + + + + + + + +ipyleaflet is a great rendering library for small- and medium-sized datasets. ipyleaflet supports a broad range of data types and formats and gives the user broad control over how to render data.
+The downside of ipyleaflet is that it doesn't support large datasets as well. It uses GeoJSON to transfer data to the frontend, which is slow to write, slow to read, and large in transit. Additionally, leaflet's primary goal is not to support very large quantities of data.
+Pydeck is a full-featured binding from Python to deck.gl. Pydeck attempts to cover most of the deck.gl API. It's harder to use binary data transport with pydeck, and similarly to ipyleaflet will usually serialize data to GeoJSON.
+Lonboard does not try to cover deck.gl's full API, but rather has an opinionated approach that nudges users to the fastest rendering for many common use cases.
+Pydeck and lonboard have very different goals.
+A stated goal of pydeck is to be non-opinionated and to allow users with various data sources (GeoJSON strings, URLs to arbitrary data sources, etc.) to render. It makes sense for "official" bindings to be non-opinionated, but lonboard takes an opposite tack. By forcing users to use Arrow, we can get reliably fast performance the very common use case of rendering GeoDataFrame
s. A downside here is that an Arrow-based implementation has required dependencies that pydeck wouldn't want. pyarrow
on the Python side is 90MB on disk. Arrow JS on the JS side is ~200kb, and the default parquet-wasm
build is ~1MB.
Pydeck is tightly tied into the deck.gl JSON renderer, which allows describing a map state fully in JSON. It's not clear how this would work with the JavaScript GeoArrow layers.
+Aside from this, pydeck and lonboard use different widget architectures. Pydeck is built on the historical ipywidget layout, using the widget cookiecutter as inspiration and having a separate Jupyter Widget package published to NPM. Lonboard takes a newer approach (unavailable at the time pydeck was created) that uses Anywidget, vastly simplifying the widget process.
+Datashader is a truly scalable rendering library. Datashader will re-render your data from scratch when panning around in a map. This allows datashader to aggregate the source data before rendering. Datashader minimizes the amount of data being rendered and thus, in theory, Datashader should perform well for datasets as large as your computer's memory.
+Lonboard is not scalable in the same sense. It doesn't minimize the amount of data being rendered. If you ask to plot a GeoDataFrame with 3 million points, every single one of those points is transferred to the GPU and drawn to your screen. In contrast to Datashader, Lonboard should perform well for datasets whose geometries fit in your computer's GPU memory, which is usually much smaller than your computer's total memory.
+ + + + + + + +apply_continuous_cmap(
+ values: NDArray[np.floating],
+ cmap: Palette,
+ *,
+ alpha: Union[float, int, NDArray[np.floating], None] = None
+) -> NDArray[np.uint8]
+
Apply a colormap to a set of values.
+This is described as "continuous" because it uses matplotlib's +LinearSegmentedColormap under the hood. +As described in Matplotlib's referenced docstring:
+++The lookup table is generated using linear interpolation for each primary color, +with the 0-1 domain divided into any number of segments.
+
This means that input values are linearly combined from the two nearest colormap +colors.
+If you want to snap to the "nearest" colormap value, you should use another function +(not yet implemented) to snap to the strictly nearest color value.
+ + + +Parameters:
+values
+ (NDArray[floating]
)
+ –
+ A numpy array of floating point values ranging from 0 to 1.
+cmap
+ (Palette
)
+ –
+ Any Palette
object from the
+palettable
package.
alpha
+ (Union[float, int, NDArray[floating], None]
, default:
+ None
+)
+ –
+ Alpha must be a scalar between 0 and 1, a sequence of such floats with
+shape matching values
, or None.
Returns:
+ + +The PathLayer
renders lists of coordinate points as extruded polylines with mitering.
++ + +Screenshot from North America roads example
+
The PathLayer
renders lists of coordinate points as extruded polylines with
+mitering.
class-attribute
+ instance-attribute
+
+
+¶billboard = traitlets.Bool(allow_none=True).tag(sync=True)
+
If True
, extrude the path in screen space (width always faces the camera).
+If False
, the width always faces up.
bool
, optionalFalse
class-attribute
+ instance-attribute
+
+
+¶cap_rounded = traitlets.Bool(allow_none=True).tag(sync=True)
+
Type of caps. If True
, draw round caps. Otherwise draw square caps.
bool
, optionalFalse
class-attribute
+ instance-attribute
+
+
+¶get_color = ColorAccessor()
+
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.
list
or tuple
is provided, it is used as the color for all
+ paths.[0, 0, 0, 255]
.class-attribute
+ instance-attribute
+
+
+¶get_width = FloatAccessor()
+
The width of each path, in units specified by width_units
(default 'meters'
).
1
.class-attribute
+ instance-attribute
+
+
+¶joint_rounded = traitlets.Bool(allow_none=True).tag(sync=True)
+
Type of joint. If True
, draw round joints. Otherwise draw miter joints.
bool
, optionalFalse
class-attribute
+ instance-attribute
+
+
+¶miter_limit = traitlets.Int(allow_none=True).tag(sync=True)
+
The maximum extent of a joint in ratio to the stroke width.
+Only works if jointRounded
is False
.
float
, optional4
class-attribute
+ instance-attribute
+
+
+¶width_max_pixels = traitlets.Float(allow_none=True).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.
+float
, optionalNone
class-attribute
+ instance-attribute
+
+
+¶width_min_pixels = traitlets.Float(allow_none=True).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.
+float
, optional0
class-attribute
+ instance-attribute
+
+
+¶width_scale = traitlets.Float(allow_none=True).tag(sync=True)
+
The path width multiplier that multiplied to all paths.
+float
, optional1
class-attribute
+ instance-attribute
+
+
+¶width_units = traitlets.Unicode(allow_none=True).tag(sync=True)
+
The units of the line width, one of 'meters'
, 'common'
, and 'pixels'
. See
+unit
+system.
str
, optional'meters'
classmethod
+
+
+¶from_geopandas(gdf: gpd.GeoDataFrame, **kwargs) -> PathLayer
+
Construct a PathLayer 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.
+Returns:
+PathLayer
+ –
+ A PathLayer with the initialized data.
+The ScatterplotLayer
renders circles at given coordinates.
++ + +Screenshot from Ookla example.
+
The ScatterplotLayer
renders circles at given coordinates.
Example:
+import geopandas as gpd
+from lonboard import ScatterplotLayer
+
+# A GeoDataFrame with Point geometries
+gdf = gpd.GeoDataFrame()
+layer = ScatterplotLayer.from_geopandas(
+ gdf,
+ get_fill_color=[255, 0, 0],
+)
+
class-attribute
+ instance-attribute
+
+
+¶antialiasing = traitlets.Bool(allow_none=True).tag(sync=True)
+
If True
, circles are rendered with smoothed edges. If False
, circles are
+rendered with rough edges. Antialiasing can cause artifacts on edges of overlapping
+circles.
bool
, optionalTrue
class-attribute
+ instance-attribute
+
+
+¶billboard = traitlets.Bool(allow_none=True).tag(sync=True)
+
If True
, rendered circles always face the camera. If False
circles face up (i.e.
+are parallel with the ground plane).
bool
, optionalFalse
class-attribute
+ instance-attribute
+
+
+¶filled = traitlets.Bool(allow_none=True).tag(sync=True)
+
Draw the filled area of points.
+bool
, optionalTrue
class-attribute
+ instance-attribute
+
+
+¶get_fill_color = ColorAccessor()
+
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.
list
or tuple
is provided, it is used as the filled color for
+ all objects.[0, 0, 0, 255]
.class-attribute
+ instance-attribute
+
+
+¶get_line_color = ColorAccessor()
+
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.
list
or tuple
is provided, it is used as the outline color
+ for all objects.[0, 0, 0, 255]
.class-attribute
+ instance-attribute
+
+
+¶get_line_width = FloatAccessor()
+
The width of the outline of each object, in units specified by line_width_units
+(default 'meters'
).
1
.class-attribute
+ instance-attribute
+
+
+¶get_radius = FloatAccessor()
+
The radius of each object, in units specified by radius_units
(default
+'meters'
).
1
.class-attribute
+ instance-attribute
+
+
+¶line_width_max_pixels = traitlets.Float(allow_none=True).tag(sync=True)
+
The maximum line width in pixels. This can be used to prevent the stroke from +getting too thick when zoomed in.
+float
, optionalNone
class-attribute
+ instance-attribute
+
+
+¶line_width_min_pixels = traitlets.Float(allow_none=True).tag(sync=True)
+
The minimum line width in pixels. This can be used to prevent the stroke from +getting too thin when zoomed out.
+float
, optional0
class-attribute
+ instance-attribute
+
+
+¶line_width_scale = traitlets.Float(allow_none=True).tag(sync=True)
+
A global line width multiplier for all points.
+float
, optional1
class-attribute
+ instance-attribute
+
+
+¶line_width_units = traitlets.Float(allow_none=True).tag(sync=True)
+
The units of the line width, one of 'meters'
, 'common'
, and 'pixels'
. See
+unit
+system.
str
, optional'meters'
class-attribute
+ instance-attribute
+
+
+¶radius_max_pixels = traitlets.Float(allow_none=True).tag(sync=True)
+
The maximum radius in pixels. This can be used to prevent the circle from getting +too big when zoomed in.
+float
, optionalNone
class-attribute
+ instance-attribute
+
+
+¶radius_min_pixels = traitlets.Float(allow_none=True).tag(sync=True)
+
The minimum radius in pixels. This can be used to prevent the circle from getting +too small when zoomed out.
+float
, optional0
class-attribute
+ instance-attribute
+
+
+¶radius_scale = traitlets.Float(allow_none=True).tag(sync=True)
+
A global radius multiplier for all points.
+float
, optional1
class-attribute
+ instance-attribute
+
+
+¶radius_units = traitlets.Unicode('meters', allow_none=True).tag(sync=True)
+
The units of the radius, one of 'meters'
, 'common'
, and 'pixels'
. See unit
+system.
str
, optional'meters'
class-attribute
+ instance-attribute
+
+
+¶stroked = traitlets.Bool(allow_none=True).tag(sync=True)
+
Draw the outline of points.
+bool
, optionalFalse
classmethod
+
+
+¶from_geopandas(gdf: gpd.GeoDataFrame, **kwargs) -> ScatterplotLayer
+
Construct a ScatterplotLayer 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.
+Returns:
+ScatterplotLayer
+ –
+ A ScatterplotLayer with the initialized data.
+The SolidPolygonLayer
renders filled and/or extruded polygons.
import geopandas as gpd
+from lonboard import SolidPolygonLayer
+
+# A GeoDataFrame with Polygon geometries
+gdf = gpd.GeoDataFrame()
+layer = SolidPolygonLayer.from_geopandas(
+ gdf,
+ get_fill_color=[255, 0, 0],
+)
+
The SolidPolygonLayer
renders filled and/or extruded polygons.
class-attribute
+ instance-attribute
+
+
+¶elevation_scale = traitlets.Float(allow_none=True).tag(sync=True)
+
Elevation multiplier. The final elevation is calculated by elevation_scale *
+get_elevation(d)
. elevation_scale
is a handy property to scale all elevation
+without updating the data.
float
, optional1
Remarks:
+GL.LINE
and will thus always be 1 pixel wide.class-attribute
+ instance-attribute
+
+
+¶extruded = traitlets.Bool(allow_none=True).tag(sync=True)
+
Whether to extrude the polygons (based on the elevations provided by the
+get_elevation
accessor'). If set to False
, all polygons will be flat, this
+generates less geometry and is faster than simply returning 0
from
+get_elevation
.
bool
, optionalFalse
class-attribute
+ instance-attribute
+
+
+¶filled = traitlets.Bool(allow_none=True).tag(sync=True)
+
Whether to fill the polygons (based on the color provided by the
+get_fill_color
accessor).
bool
, optionalTrue
class-attribute
+ instance-attribute
+
+
+¶get_elevation = FloatAccessor()
+
The elevation to extrude each polygon with, in meters.
+Only applies if extruded=True
.
1000
.class-attribute
+ instance-attribute
+
+
+¶get_fill_color = ColorAccessor()
+
The fill color of each polygon in the format of [r, g, b, [a]]
. Each channel is a
+number between 0-255 and a
is 255 if not supplied.
list
or tuple
is provided, it is used as the fill color for
+ all polygons.[0, 0, 0, 255]
.class-attribute
+ instance-attribute
+
+
+¶get_line_color = ColorAccessor()
+
The line color of each polygon in the format of [r, g, b, [a]]
. Each channel is a
+number between 0-255 and a
is 255 if not supplied.
Only applies if extruded=True
.
list
or tuple
is provided, it is used as the line color for
+ all polygons.[0, 0, 0, 255]
.class-attribute
+ instance-attribute
+
+
+¶wireframe = traitlets.Bool(allow_none=True).tag(sync=True)
+
Whether to generate a line wireframe of the polygon. The outline will have +"horizontal" lines closing the top and bottom polygons and a vertical line +(a "strut") for each vertex on the polygon.
+bool
, optionalFalse
classmethod
+
+
+¶from_geopandas(gdf: gpd.GeoDataFrame, **kwargs) -> SolidPolygonLayer
+
Construct a SolidPolygonLayer 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.
+Returns:
+SolidPolygonLayer
+ –
+ A SolidPolygonLayer with the initialized data.
+
+ Bases: TraitType
A representation of a deck.gl color accessor.
+Various input is allowed:
+list
or tuple
with three or four integers, ranging between 0 and 255
+ (inclusive). This will be used as the color for all objects.ndarray
with two dimensions and data type np.uint8
. The
+ size of the second dimension must be 3
or 4
, and will correspond to either RGB
+ or RGBA colors.FixedSizeListArray
or
+ ChunkedArray
containing FixedSizeListArray
s. The inner
+ size of the fixed size list must be 3
or 4
and its child must have type
+ uint8
.You can use helpers in the lonboard.colormap
module (i.e.
+apply_continuous_cmap
) to simplify
+constructing numpy arrays for color values.
+ Bases: TraitType
A representation of a deck.gl float accessor.
+Various input is allowed:
+int
or float
. This will be used as the value for all objects.ndarray
with a numeric data type. This will be casted to an array of
+ data type np.float32
. Each value in the array will be used as
+ the value for the object at the same row index.FloatArray
, DoubleArray
+ or ChunkedArray
containing either a FloatArray
or
+ DoubleArray
. Each value in the array will be used as the value for the object at
+ the same row index.The top-level namespace accessible after import lonboard
.
Layers are also accessible in the top-level namespace, but are documented in the layers/
folder.
viz(
+ data: Union[
+ gpd.GeoDataFrame,
+ gpd.GeoSeries,
+ pa.Table,
+ NDArray[np.object_],
+ shapely.geometry.base.BaseGeometry,
+ GeoInterfaceProtocol,
+ Dict[str, Any],
+ ],
+ **kwargs
+) -> Union[ScatterplotLayer, PathLayer, SolidPolygonLayer]
+
A high-level function to plot your data easily.
+This function accepts a variety of geospatial inputs:
+GeoDataFrame
GeoSeries
__geo_interface__
property conforming to the
+ Geo Interface protocol.dict
holding GeoJSON-like data.Table
with a geometry column marked with a GeoArrow extension typeParameters:
+data
+ (Union[GeoDataFrame, GeoSeries, Table, NDArray[object_], BaseGeometry, GeoInterfaceProtocol, Dict[str, Any]]
)
+ –
+ a data object of any supported type.
+Any other keyword arguments will be passed onto the relevant layer, either a
+ScatterplotLayer
, PathLayer
, or SolidPolygonLayer
.
Returns:
+Union[ScatterplotLayer, PathLayer, SolidPolygonLayer]
+ –
+ widget visualizing the provided data.
+{"use strict";/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var Ha=/["'&<>]/;Un.exports=$a;function $a(e){var t=""+e,r=Ha.exec(t);if(!r)return t;var o,n="",i=0,s=0;for(i=r.index;i