Map¶
lonboard.Map ¶
The top-level class used to display a map in a Jupyter Widget.
Example:
import geopandas as gpd
from lonboard import Map, ScatterplotLayer, SolidPolygonLayer
# A GeoDataFrame with Point geometries
point_gdf = gpd.GeoDataFrame()
point_layer = ScatterplotLayer.from_geopandas(
point_gdf,
get_fill_color=[255, 0, 0],
)
# A GeoDataFrame with Polygon geometries
polygon_gdf = gpd.GeoDataFrame()
polygon_layer = SolidPolygonLayer.from_geopandas(
gdf,
get_fill_color=[255, 0, 0],
)
m = Map([point_layer, polygon_layer])
__init__ ¶
__init__(layers: Union[BaseLayer, Sequence[BaseLayer]], **kwargs) -> None
_height
class-attribute
instance-attribute
¶
_height = tag(sync=True)
Height of the map in pixels.
This API is not yet stabilized and may change in the future.
_initial_view_state
class-attribute
instance-attribute
¶
_initial_view_state = tag(sync=True)
The initial view state of the map.
- Type:
dict
, optional - Default: Automatically inferred from the data passed to the map.
The keys must include:
longitude
: longitude at the map center.latitude
: latitude at the map center.zoom
: zoom level.
Keys may additionally include:
pitch
(float, optional) - pitch angle in degrees. Default0
(top-down).bearing
(float, optional) - bearing angle in degrees. Default0
(north).maxZoom
(float, optional) - max zoom level. Default20
.minZoom
(float, optional) - min zoom level. Default0
.maxPitch
(float, optional) - max pitch angle. Default60
.minPitch
(float, optional) - min pitch angle. Default0
.
Note that currently no camel-case/snake-case translation occurs for this method, and so keys must be in camel case.
This API is not yet stabilized and may change in the future.
basemap_style
class-attribute
instance-attribute
¶
basemap_style = tag(sync=True)
A MapLibre-compatible basemap style.
Various styles are provided in lonboard.basemap
.
- Type:
str
- Default
lonboard.basemap.CartoBasemap.PositronNoLabels
layers
class-attribute
instance-attribute
¶
layers = tag(sync=True, **widget_serialization)
One or more Layer
objects to display on this map.
picking_radius
class-attribute
instance-attribute
¶
picking_radius = tag(sync=True)
Extra pixels around the pointer to include while picking (such as for a tooltip).
This is helpful when rendered objects are difficult to target, for example irregularly shaped icons, small moving circles or interaction by touch.
- Type:
int
- Default:
5
show_tooltip
class-attribute
instance-attribute
¶
show_tooltip = tag(sync=True)
Whether to render a tooltip on hover on the map.
- Type:
bool
- Default:
True