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],
)
map_ = Map(layers=[point_layer, polygon_layer])
_height
class-attribute
instance-attribute
¶
_height = traitlets.Int(default_value=DEFAULT_HEIGHT, allow_none=True).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 = traitlets.Dict().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 = traitlets.Unicode(CartoBasemap.PositronNoLabels).tag(sync=True)
A MapLibre-compatible basemap style.
Various styles are provided in [lonboard.basemap
][lonboard.basemap].
- Type:
str
- Default
lonboard.basemap.CartoBasemap.PositronNoLabels
layers
class-attribute
instance-attribute
¶
layers = traitlets.List(trait=traitlets.Instance(BaseLayer)).tag(
sync=True, **ipywidgets.widget_serialization
)
One or more Layer
objects to display on this map.
picking_radius
class-attribute
instance-attribute
¶
picking_radius = traitlets.Int(5).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 = traitlets.Bool(True).tag(sync=True)
Whether to render a tooltip on hover on the map.
- Type:
bool
- Default:
True