API Reference#

class ipyleaflet.leaflet.AntPath(**kwargs)[source]#

AntPath class, with VectorLayer as parent class.

AntPath layer.

locations#

Locations through which the ant-path is going.

Type

list, default []

use#

Type of shape to use for the ant-path. Possible values are ‘polyline’, ‘polygon’, ‘rectangle’ and ‘circle’.

Type

string, default ‘polyline’

delay#

Add a delay to the animation flux.

Type

int, default 400

weight#

Weight of the ant-path.

Type

int, default 5

dash_array#

The sizes of the animated dashes.

Type

list, default [10, 20]

color#

The color of the primary dashes.

Type

CSS color, default ‘#0000FF’

pulse_color#

The color of the secondary dashes.

Type

CSS color, default ‘#FFFFFF’

paused#

Whether the animation is running or not.

Type

boolean, default False

reverse#

Whether the animation is going backwards or not.

Type

boolean, default False

hardware_accelerated#

Whether the ant-path uses hardware acceleration.

Type

boolean, default False

radius#

Radius of the circle, if use is set to ‘circle’

Type

int, default 10

class ipyleaflet.leaflet.AttributionControl(**kwargs)[source]#

AttributionControl class.

A control which contains the layers attribution.

class ipyleaflet.leaflet.AwesomeIcon(**kwargs)[source]#

AwesomeIcon class.

FontAwesome icon used for markers.

name#

The name of the FontAwesome icon to use. See https://fontawesome.com/v4.7.0/icons for available icons.

Type

string, default “home”

marker_color#

Color used for the icon background.

Type

string, default “blue”

icon_color#

CSS color used for the FontAwesome icon.

Type

string, default “white”

spin#

Whether the icon is spinning or not.

Type

boolean, default False

class ipyleaflet.leaflet.Choropleth(**kwargs)[source]#

Choropleth class, with GeoJSON as parent class.

Layer showing a Choropleth effect on a GeoJSON structure.

geo_data#

The GeoJSON structure on which to apply the Choropleth effect.

Type

dict, default None

choro_data#

Data used for building the Choropleth effect.

Type

dict, default None

value_min#

Minimum data value for the color mapping.

Type

float, default None

value_max#

Maximum data value for the color mapping.

Type

float, default None

colormap#

The colormap used for the effect.

Type

branca.colormap.ColorMap instance, default None

key_on#

The feature key to use for the colormap effect.

Type

string, default “id”

class ipyleaflet.leaflet.Circle(**kwargs)[source]#

Circle class, with CircleMarker as parent class.

Circle layer.

class ipyleaflet.leaflet.CircleMarker(**kwargs)[source]#

CircleMarker class, with Path as parent class.

CircleMarker layer.

location#

Location of the marker (lat, long).

Type

list, default [0, 0]

radius#

Radius of the circle marker in pixels.

Type

int, default 10

class ipyleaflet.leaflet.Control(**kwargs)[source]#

Control abstract class.

This is the base class for all ipyleaflet controls. A control is additional UI components on top of the Map.

position#

The position of the control. Possible values are ‘topright’, ‘topleft’, ‘bottomright’ and ‘bottomleft’.

Type

str, default ‘topleft’

exception ipyleaflet.leaflet.ControlException[source]#

Custom LayerException class.

class ipyleaflet.leaflet.DivIcon(**kwargs)[source]#

DivIcon class.

Custom lightweight icon for markers that uses a simple <div> element instead of an image used for markers.

html#

Custom HTML code to put inside the div element, empty by default.

Type

string

bg_pos#

Optional relative position of the background, in pixels.

Type

tuple, default [0, 0]

icon_size#

The size of the icon, in pixels.

Type

tuple, default None

icon_anchor#

The coordinates of the “tip” of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker’s geographical location. Centered by default if icon_size is specified.

Type

tuple, default None

popup_anchor#

The coordinates of the point from which popups will “open”, relative to the icon anchor.

Type

tuple, default None

class ipyleaflet.leaflet.DrawControl(**kwargs)[source]#

DrawControl class.

Drawing tools for drawing on the map.

clear()[source]#

Clear all drawings.

clear_circle_markers()[source]#

Clear all circle markers.

clear_circles()[source]#

Clear all circles.

clear_markers()[source]#

Clear all markers.

clear_polygons()[source]#

Clear all polygons.

clear_polylines()[source]#

Clear all polylines.

clear_rectangles()[source]#

Clear all rectangles.

on_draw(callback, remove=False)[source]#

Add a draw event listener.

Parameters
  • callback (callable) – Callback function that will be called on draw event.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

class ipyleaflet.leaflet.FeatureGroup(**kwargs)[source]#

FeatureGroup abstract class.

class ipyleaflet.leaflet.FullScreenControl(**kwargs)[source]#

FullScreenControl class, with Control as parent class.

A control which contains a button that will put the Map in full-screen when clicked.

class ipyleaflet.leaflet.GeoData(**kwargs)[source]#

GeoData class with GeoJSON as parent class.

Layer created from a GeoPandas dataframe.

geo_dataframe#

The GeoPandas dataframe to use.

Type

geopandas.GeoDataFrame instance, default None

class ipyleaflet.leaflet.GeoJSON(**kwargs)[source]#

GeoJSON class, with FeatureGroup as parent class.

Layer created from a GeoJSON data structure.

data#

The JSON data structure.

Type

dict, default {}

style#

Extra style to apply to the features.

Type

dict, default {}

hover_style#

Style that will be applied to a feature when the mouse is over this feature.

Type

dict, default {}

point_style#

Extra style to apply to the point features.

Type

dict, default {}

style_callback#

Function that will be called for each feature, should take the feature as input and return the feature style.

Type

callable, default None

on_click(callback, remove=False)[source]#

Add a feature click event listener.

Parameters
  • callback (callable) – Callback function that will be called on click event on a feature, this function should take the event and the feature as inputs.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

on_hover(callback, remove=False)[source]#

Add a feature hover event listener.

Parameters
  • callback (callable) – Callback function that will be called when the mouse is over a feature, this function should take the event and the feature as inputs.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

class ipyleaflet.leaflet.Heatmap(**kwargs)[source]#

Heatmap class, with RasterLayer as parent class.

Heatmap layer.

locations#

List of data points locations for generating the heatmap.

Type

list, default []

radius#

Radius of the data points.

Type

float, default 25.

blur#

Blurring intensity.

Type

float, default 15.

gradient#

Colors used for the color-mapping from low to high heatmap intensity.

Type

dict, default {0.4: ‘blue’, 0.6: ‘cyan’, 0.7: ‘lime’, 0.8: ‘yellow’, 1.0: ‘red’}

class ipyleaflet.leaflet.Icon(**kwargs)[source]#

Icon class.

Custom icon used for markers.

icon_url#

The url to the image used for the icon.

Type

string, default “”

shadow_url#

The url to the image used for the icon shadow.

Type

string, default None

icon_size#

The size of the icon, in pixels.

Type

tuple, default None

shadow_size#

The size of the icon shadow, in pixels.

Type

tuple, default None

icon_anchor#

The coordinates of the “tip” of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker’s geographical location. Centered by default if icon_size is specified.

Type

tuple, default None

shadow_anchor#

The coordinates of the “tip” of the shadow (relative to its top left corner). The same as icon_anchor if None.

Type

tuple, default None

popup_anchor#

The coordinates of the point from which popups will “open”, relative to the icon anchor.

Type

tuple, default None

class ipyleaflet.leaflet.ImageOverlay(**kwargs)[source]#

ImageOverlay class.

Image layer from a local or remote image file.

url#

Url to the local or remote image file.

Type

string, default “”

bounds#

SW and NE corners of the image.

Type

list, default [0., 0]

attribution#

Image attribution.

Type

string, default “”

class ipyleaflet.leaflet.InteractMixin[source]#

Abstract InteractMixin class.

class ipyleaflet.leaflet.Layer(**kwargs)[source]#

Abstract Layer class.

Base class for all layers in ipyleaflet.

name#

Custom name for the layer, which will be used by the LayersControl.

Type

string

popup#

Interactive widget that will be shown in a Popup when clicking on the layer.

Type

object

on_click(callback, remove=False)[source]#

Add a click event listener.

Parameters
  • callback (callable) – Callback function that will be called on click event.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

on_dblclick(callback, remove=False)[source]#

Add a double-click event listener.

Parameters
  • callback (callable) – Callback function that will be called on double-click event.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

on_mousedown(callback, remove=False)[source]#

Add a mouse-down event listener.

Parameters
  • callback (callable) – Callback function that will be called on mouse-down event.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

on_mouseout(callback, remove=False)[source]#

Add a mouse-out event listener.

Parameters
  • callback (callable) – Callback function that will be called on mouse-out event.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

on_mouseover(callback, remove=False)[source]#

Add a mouse-over event listener.

Parameters
  • callback (callable) – Callback function that will be called on mouse-over event.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

on_mouseup(callback, remove=False)[source]#

Add a mouse-up event listener.

Parameters
  • callback (callable) – Callback function that will be called on mouse-up event.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

exception ipyleaflet.leaflet.LayerException[source]#

Custom LayerException class.

class ipyleaflet.leaflet.LayerGroup(**kwargs)[source]#

LayerGroup class.

A group of layers that you can put on the map like other layers.

layers#

List of layers to include in the group.

Type

list, default []

add_layer(layer)[source]#

Add a new layer to the group.

Parameters

layer (layer instance) – The new layer to include in the group.

clear_layers()[source]#

Remove all layers from the group.

remove_layer(rm_layer)[source]#

Remove a layer from the group.

Parameters

layer (layer instance) – The layer to remove from the group.

substitute_layer(old, new)[source]#

Substitute a layer with another one in the group.

Parameters
  • old (layer instance) – The layer to remove from the group.

  • new (layer instance) – The new layer to include in the group.

class ipyleaflet.leaflet.LayersControl(**kwargs)[source]#

LayersControl class, with Control as parent class.

A control which allows hiding/showing different layers on the Map.

class ipyleaflet.leaflet.LegendControl(**kwargs)[source]#

LegendControl class, with Control as parent class.

A control which contains a legend.

title#

The title of the legend.

Type

str, default ‘Legend’

legend#

A dictionary containing names as keys and CSS colors as values.

Type

dict, default ‘Legend’

add_legend_element(key, value)[source]#

Add a new legend element.

Parameters
  • key (str) – The key for the legend element.

  • value (CSS Color) – The value for the legend element.

remove_legend_element(key)[source]#

Remove a legend element.

Parameters

key (str) – The element to remove.

class ipyleaflet.leaflet.LocalTileLayer(**kwargs)[source]#

LocalTileLayer class.

Custom tile layer using local tile files.

path#

Path to your local tiles. In the classic Jupyter Notebook, the path is relative to the Notebook you are working on. In JupyterLab, the path is relative to the server (where you started JupyterLab) and you need to prefix the path with “files/”.

Type

string, default “”

class ipyleaflet.leaflet.MagnifyingGlass(**kwargs)[source]#

MagnifyingGlass class.

radius#

The radius of the magnifying glass, in pixels.

Type

int, default 100

zoom_offset#

The zoom level offset between the main map zoom and the magnifying glass.

Type

int, default 3

fixed_zoom#

If different than -1, defines a fixed zoom level to always use in the magnifying glass, ignoring the main map zoom and the zoomOffet value.

Type

int, default -1

fixed_position#

If True, the magnifying glass will stay at the same position on the map, not following the mouse cursor.

Type

boolean, default False

lat_lng#

The initial position of the magnifying glass, both on the main map and as the center of the magnified view. If fixed_position is True, it will always keep this position.

Type

list, default [0, 0]

layers#

Set of layers to display in the magnified view. These layers shouldn’t be already added to a map instance.

Type

list, default []

class ipyleaflet.leaflet.Map(**kwargs)[source]#

Map class.

The Map class is the main widget in ipyleaflet.

layers#

The list of layers that are currently on the map.

Type

list of Layer instances

controls#

The list of controls that are currently on the map.

Type

list of Control instances

center#

The current center of the map.

Type

list, default [0, 0]

zoom#

The current zoom value of the map.

Type

float, default 12

max_zoom#

Maximal zoom value.

Type

int, default 18

min_zoom#

Minimal zoom value.

Type

int, default 1

zoom_snap#

Forces the map’s zoom level to always be a multiple of this.

Type

float, default 1

zoom_delta#

Controls how much the map’s zoom level will change after pressing + or - on the keyboard, or using the zoom controls.

Type

float, default 1

crs#

Coordinate reference system, which can be ‘Earth’, ‘EPSG3395’, ‘EPSG3857’, ‘EPSG4326’, ‘Base’, ‘Simple’ or user defined projection.

Type

projection, default projections.EPSG3857

dragging#

Whether the map be draggable with mouse/touch or not.

Type

boolean, default True

touch_zoom#

Whether the map can be zoomed by touch-dragging with two fingers on mobile.

Type

boolean, default True

scroll_wheel_zoom#

Whether the map can be zoomed by using the mouse wheel.

Type

boolean,default False

double_click_zoom#

Whether the map can be zoomed in by double clicking on it and zoomed out by double clicking while holding shift.

Type

boolean, default True

box_zoom#

Whether the map can be zoomed to a rectangular area specified by dragging the mouse while pressing the shift key

Type

boolean, default True

tap#

Enables mobile hacks for supporting instant taps.

Type

boolean, default True

tap_tolerance#

The max number of pixels a user can shift his finger during touch for it to be considered a valid tap.

Type

int, default 15

world_copy_jump#

With this option enabled, the map tracks when you pan to another “copy” of the world and seamlessly jumps to.

Type

boolean, default False

close_popup_on_click#

Set it to False if you don’t want popups to close when user clicks the map.

Type

boolean, default True

bounce_at_zoom_limits#

Set it to False if you don’t want the map to zoom beyond min/max zoom and then bounce back when pinch-zooming.

Type

boolean, default True

keyboard#

Makes the map focusable and allows users to navigate the map with keyboard arrows and +/- keys.

Type

booelan, default True

keyboard_pan_offset#
Type

int, default 80

keyboard_zoom_offset#
Type

int, default 1

inertia#

If enabled, panning of the map will have an inertia effect.

Type

boolean, default True

inertia_deceleration#

The rate with which the inertial movement slows down, in pixels/second².

Type

float, default 3000

inertia_max_speed#

Max speed of the inertial movement, in pixels/second.

Type

float, default 1500

zoom_control#
Type

boolean, default True

attribution_control#
Type

boolean, default True

zoom_animation_threshold#
Type

int, default 4

add_control(control)[source]#

Add a control on the map.

Parameters

control (Control instance) – The new control to add.

add_layer(layer)[source]#

Add a layer on the map.

Parameters

layer (Layer instance) – The new layer to add.

clear_controls()[source]#

Remove all controls from the map.

clear_layers()[source]#

Remove all layers from the map.

fit_bounds(bounds)[source]#

Sets a map view that contains the given geographical bounds with the maximum zoom level possible.

Parameters

bounds (list of lists) – The lat/lon bounds in the form [[south, west], [north, east]].

remove_control(control)[source]#

Remove a control from the map.

Parameters

control (Control instance) – The control to remove.

remove_layer(rm_layer)[source]#

Remove a layer from the map.

Parameters

layer (Layer instance) – The layer to remove.

save(outfile, **kwargs)[source]#

Save the Map to an .html file.

Parameters
  • outfile (str or file-like object) – The file to write the HTML output to.

  • kwargs (keyword-arguments) – Extra parameters to pass to the ipywidgets.embed.embed_minimal_html function.

substitute_layer(old, new)[source]#

Replace a layer with another one on the map.

Parameters
  • old (Layer instance) – The old layer to remove.

  • new (Layer instance) – The new layer to add.

class ipyleaflet.leaflet.MapStyle(**kwargs)[source]#

Map Style Widget

Custom map style.

cursor#

The cursor to use for the mouse when it’s on the map. Should be a valid CSS cursor value.

Type

str, default ‘grab’

class ipyleaflet.leaflet.Marker(**kwargs)[source]#

Marker class.

Clickable/Draggable marker on the map.

location#

The tuple containing the latitude/longitude of the marker.

Type

tuple, default (0, 0)

opacity#

Opacity of the marker between 0. (fully transparent) and 1. (fully opaque).

Type

float, default 1.

visible#

Whether the marker is visible or not.

Type

boolean, default True

icon#

Icon used for the marker, it can be an Icon or an AwesomeIcon instance. By default it will use a blue icon.

Type

object, default None

draggable#

Whether the marker is draggable with the mouse or not.

Type

boolean, default True

keyboard#

Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.

Type

boolean, default True

title#

Text for the browser tooltip that appear on marker hover (no tooltip by default).

Type

string, default ‘’

alt#

Text for the alt attribute of the icon image (useful for accessibility).

Type

string, default ‘’

rotation_angle#

The rotation angle of the marker in degrees.

Type

float, default 0.

rotation_origin#

The rotation origin of the marker.

Type

string, default ‘’

z_index_offset#
Type

int, default 0

opacity#
Type

float, default 1.0

rise_offset#

The z-index offset used for the rise_on_hover feature

Type

int, default 250

on_move(callback, remove=False)[source]#

Add a move event listener.

Parameters
  • callback (callable) – Callback function that will be called on move event.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

class ipyleaflet.leaflet.MarkerCluster(**kwargs)[source]#

MarkerCluster class, with Layer as parent class.

A cluster of markers that you can put on the map like other layers.

markers#

List of markers to include in the cluster.

Type

list, default []

class ipyleaflet.leaflet.MeasureControl(**kwargs)[source]#

MeasureControl class, with Control as parent class.

A control which allows making measurements on the Map.

primary_length_unit#

Possible values are ‘feet’, ‘meters’, ‘miles’, ‘kilometers’ or any user defined unit.

Type

str, default ‘feet’

secondary_length_unit#

Possible values are ‘feet’, ‘meters’, ‘miles’, ‘kilometers’ or any user defined unit.

Type

str, default None

primary_area_unit#

Possible values are ‘acres’, ‘hectares’, ‘sqfeet’, ‘sqmeters’, ‘sqmiles’ or any user defined unit.

Type

str, default ‘acres’

secondary_area_unit#

Possible values are ‘acres’, ‘hectares’, ‘sqfeet’, ‘sqmeters’, ‘sqmiles’ or any user defined unit.

Type

str, default None

active_color#

The color used for current measurements.

Type

CSS Color, default ‘#ABE67E’

completed_color#

The color used for the completed measurements.

Type

CSS Color, default ‘#C8F2BE’

add_area_unit(name, factor, decimals=0)[source]#

Add a custom area unit.

Parameters
  • name (str) – The name for your custom unit.

  • factor (float) – Factor to apply when converting to this unit. Area in sqmeters will be multiplied by this factor.

  • decimals (int, default 0) – Number of decimals to round results when using this unit.

add_length_unit(name, factor, decimals=0)[source]#

Add a custom length unit.

Parameters
  • name (str) – The name for your custom unit.

  • factor (float) – Factor to apply when converting to this unit. Length in meters will be multiplied by this factor.

  • decimals (int, default 0) – Number of decimals to round results when using this unit.

class ipyleaflet.leaflet.Path(**kwargs)[source]#

Path abstract class.

Path layer.

stroke#

Whether to draw a stroke.

Type

boolean, default True

color#

CSS color.

Type

CSS color, default ‘#0033FF’

weight#

Weight of the stroke.

Type

int, default 5

fill#

Whether to fill the path with a flat color.

Type

boolean, default True

fill_color#

Color used for filling the path shape. If None, the color attribute value is used.

Type

CSS color, default None

fill_opacity#

Opacity used for filling the path shape.

Type

float, default 0.2

line_cap#

A string that defines shape to be used at the end of the stroke. Possible values are ‘round’, ‘butt’ or ‘square’.

Type

string, default “round”

line_join#

A string that defines shape to be used at the corners of the stroke. Possible values are ‘arcs’, ‘bevel’, ‘miter’, ‘miter-clip’ or ‘round’.

Type

string, default “round”

class ipyleaflet.leaflet.Polygon(**kwargs)[source]#

Polygon class, with Polyline as parent class.

Polygon layer.

class ipyleaflet.leaflet.Polyline(**kwargs)[source]#

Polyline abstract class, with Path as parent class.

locations#

Locations defining the shape.

Type

list, default []

scaling#

Whether you can edit the scale of the shape or not.

Type

boolean, default True

rotation#

Whether you can rotate the shape or not.

Type

boolean, default True

uniform_scaling#

Whether to keep the size ratio when changing the shape scale.

Type

boolean, default False

smooth_factor#

Smoothing intensity.

Type

float, default 1.

transform#

Whether the shape is editable or not.

Type

boolean, default False

draggable#

Whether you can drag the shape on the map or not.

Type

boolean, default False

class ipyleaflet.leaflet.Popup(**kwargs)[source]#

Popup class.

Popup element that can be placed on the map.

location#

The tuple containing the latitude/longitude of the popup.

Type

tuple, default (0, 0)

child#

Child widget that the Popup will contain.

Type

object, default None

min_width#

Minimum width of the Popup.

Type

int, default 50

max_width#

Maximum width of the Popup.

Type

int, default 300

max_height#

Maximum height of the Popup.

Type

int, default None

auto_pan#

Set it to False if you don’t want the map to do panning animation to fit the opened popup.

Type

boolean, default True

auto_pan_padding#
Type

tuple, default (5, 5)

keep_in_view#

Set it to True if you want to prevent users from panning the popup off of the screen while it is open.

Type

boolean, default False

close_button#

Whether to show a close button or not.

Type

boolean, default True

auto_close#

Whether to automatically close the popup when interacting with another element of the map or not.

Type

boolean, default True

close_on_escape_key#

Whether to close the popup when clicking the escape key or not.

Type

boolean, default True

close_popup()[source]#

Close the popup on the bound map.

open_popup(location=None)[source]#

Open the popup on the bound map.

Parameters

location (list, default to the internal location) – The location to open the popup at.

class ipyleaflet.leaflet.RasterLayer(**kwargs)[source]#

Abstract RasterLayer class.

opacity#

Opacity of the layer between 0. (fully transparent) and 1. (fully opaque).

Type

float, default 1.

visible#

Whether the layer is visible or not.

Type

boolean, default True

class ipyleaflet.leaflet.Rectangle(**kwargs)[source]#

Rectangle class, with Polygon as parent class.

Rectangle layer.

bounds#

List of SW and NE location tuples. e.g. [(50, 75), (75, 120)].

Type

list, default []

class ipyleaflet.leaflet.ScaleControl(**kwargs)[source]#

ScaleControl class, with Control as parent class.

A control which shows the Map scale.

max_width#

Max width of the control, in pixels.

Type

int, default 100

metric#

Whether to show metric units.

Type

bool, default True

imperial#

Whether to show imperial units.

Type

bool, default True

class ipyleaflet.leaflet.SearchControl(**kwargs)[source]#

SearchControl class, with Control as parent class.

url#

The url used for the search queries.

Type

string, default “”

layer#

The LayerGroup used for search queries.

Type

default None

zoom#

The zoom level after moving to searched location, by default zoom level will not change.

Type

int, default None

marker#

The marker used by the control.

Type

default Marker()

found_style#

Style for searched feature when searching in LayerGroup.

Type

default {‘fillColor’: ‘#3f0’, ‘color’: ‘#0f0’}

on_feature_found(callback, remove=False)[source]#

Add a found feature event listener for searching in GeoJSON layer.

Parameters
  • callback (callable) – Callback function that will be called on found event when searching in GeoJSON layer.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

on_location_found(callback, remove=False)[source]#

Add a found location event listener. The callback will be called when a search result has been found.

Parameters
  • callback (callable) – Callback function that will be called on location found event.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

class ipyleaflet.leaflet.SplitMapControl(**kwargs)[source]#

SplitMapControl class, with Control as parent class.

A control which allows comparing layers by splitting the map in two.

left_layer#

The left layer(s) for comparison.

Type

Layer or list of Layers

right_layer#

The right layer(s) for comparison.

Type

Layer or list of Layers

class ipyleaflet.leaflet.TileLayer(**kwargs)[source]#

TileLayer class.

Tile service layer.

url#

Url to the tiles service.

Type

string, default “https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png”

min_zoom#

Minimum zoom for this tile service.

Type

int, default 0

max_zoom#

Maximum zoom for this tile service.

Type

int, default 18

min_native_zoom#
Type

int, default 0

max_native_zoom#
Type

int, default 18

bounds#

List of SW and NE location tuples. e.g. [(50, 75), (75, 120)].

Type

list or None, default None

tile_size#

Tile sizes for this tile service.

Type

int, default 256

attribution#

Tiles service attribution.

Type

string, default “Map data (c) <a href=”https://openstreetmap.org”>OpenStreetMap</a> contributors”

no_wrap#

Whether the layer is wrapped around the antimeridian.

Type

boolean, default False

tms#

If true, inverses Y axis numbering for tiles (turn this on for TMS services).

Type

boolean, default False

show_loading#

Whether to show a spinner when tiles are loading.

Type

boolean, default False

loading#

Whether the tiles are currently loading.

Type

boolean, default False (dynamically updated)

detect_retina#
Type

boolean, default False

opacity#
Type

float, default 1.0

visible#
Type

boolean, default True

on_load(callback, remove=False)[source]#

Add a load event listener.

Parameters
  • callback (callable) – Callback function that will be called when the tiles have finished loading.

  • remove (boolean) – Whether to remove this callback or not. Defaults to False.

redraw()[source]#

Force redrawing the tiles.

This is especially useful when you are sure the server updated the tiles and you need to refresh the layer.

class ipyleaflet.leaflet.UILayer(**kwargs)[source]#

Abstract UILayer class.

class ipyleaflet.leaflet.VectorLayer(**kwargs)[source]#

VectorLayer abstract class.

class ipyleaflet.leaflet.VectorTileLayer(**kwargs)[source]#

VectorTileLayer class, with Layer as parent class.

Vector tile layer.

url#

Url to the vector tile service.

Type

string, default “”

attribution#

Vector tile service attribution.

Type

string, default “”

vector_tile_layer_styles#

CSS Styles to apply to the vector data.

Type

dict, default {}

redraw()[source]#

Force redrawing the tiles.

This is especially useful when you are sure the server updated the tiles and you need to refresh the layer.

class ipyleaflet.leaflet.VideoOverlay(**kwargs)[source]#

VideoOverlay class.

Video layer from a local or remote video file.

url#

Url to the local or remote video file.

Type

string, default “”

bounds#

SW and NE corners of the video.

Type

list, default [0., 0]

attribution#

Video attribution.

Type

string, default “”

class ipyleaflet.leaflet.WKTLayer(**kwargs)[source]#

WKTLayer class.

Layer created from a local WKT file or WKT string input.

path#

file path of local WKT file.

Type

string, default “”

wkt_string#

WKT string.

Type

string, default “”

class ipyleaflet.leaflet.WMSLayer(**kwargs)[source]#

WMSLayer class, with TileLayer as a parent class.

layers#

Comma-separated list of WMS layers to show.

Type

string, default “”

styles#

Comma-separated list of WMS styles

Type

string, default “”

format#

WMS image format (use ‘image/png’ for layers with transparency).

Type

string, default “image/jpeg”

transparent#

If true, the WMS service will return images with transparency.

Type

boolean, default False

crs#

Projection used for this WMS service.

Type

dict, default ipyleaflet.projections.EPSG3857

class ipyleaflet.leaflet.WidgetControl(**kwargs)[source]#

WidgetControl class, with Control as parent class.

A control that contains any DOMWidget instance.

widget#

The widget to put inside of the control. It can be any widget, even coming from a third-party library like bqplot.

Type

DOMWidget

class ipyleaflet.leaflet.ZoomControl(**kwargs)[source]#

ZoomControl class, with Control as parent class.

A control which contains buttons for zooming in/out the Map.

zoom_in_text#

Text to put in the zoom-in button.

Type

str, default ‘+’

zoom_in_title#

Title to put in the zoom-in button, this is shown when the mouse is over the button.

Type

str, default ‘Zoom in’

zoom_out_text#

Text to put in the zoom-out button.

Type

str, default ‘-’

zoom_out_title#

Title to put in the zoom-out button, this is shown when the mouse is over the button.

Type

str, default ‘Zoom out’

ipyleaflet.leaflet.basemap_to_tiles(basemap, day='2022-04-13', **kwargs)[source]#

Turn a basemap into a TileLayer object.

Parameters
  • basemap (class:xyzservices.lib.TileProvider or Dict) – Basemap description coming from ipyleaflet.basemaps.

  • day (string) – If relevant for the chosen basemap, you can specify the day for the tiles in the “%Y-%m-%d” format. Defaults to yesterday’s date.

  • kwargs (key-word arguments) – Extra key-word arguments to pass to the TileLayer constructor.