lets_plot.geom_livemap

lets_plot.geom_livemap(*, location=None, zoom=None, projection=None, tiles=None, show_coord_pick_tools=None, data_size_zoomin=None, const_size_zoomin=None, **other_args)

Display an interactive map.

Parameters
locationlist

Initial position of the map. If not set, display the United States. There are [lon1, lat1, lon2, lat2,…, lonN, latN]: lon1, lon2,…, lonN are longitudes in degrees (positive in the Eastern hemisphere); lat1, lat2,…, latN are latitudes in degrees (positive in the Northern hemisphere).

zoomint

Zoom of the map in the range 1 - 15.

projectionstr, default=’epsg3857’

The map projection. There are: ‘epsg3857’ for Mercator projection; ‘epsg4326’ for Equirectangular projection. projection only works with vector map tiles (i.e. Lets-Plot map tiles).

tilesstr

Tiles provider, either as a string - URL for a standard raster ZXY tile provider with {z}, {x} and {y} wildcards (e.g. ‘http://my.tile.com/{z}/{x}/{y}.png’) or the result of a call to a maptiles_xxx() functions.

show_coord_pick_toolsbool, default=False

Show buttons “copy location” and “draw geometry”.

data_size_zoominint, default=0

Control how zooming-in of the map widget increases size of geometry objects (circles, lines etc.) on map when the size is set by means of mapping between the data and the size aesthetic. 0 - size never increases; -1 - size will be increasing without limits; n - a number of zooming-in steps (counting from the initial state of the map widget) when size of objects will be increasing. Farther zooming will no longer affect the size.

const_size_zoominint, default=-1

Control how zooming-in of the map widget increases size of geometry objects (circles, lines etc.) on map when the size is not linked to a data (i.e. constant size). 0 - size never increases; -1 - size will be increasing without limits; n - a number of zooming-in steps (counting from the initial state of the map widget) when size of objects will be increasing. Farther zooming will no longer affect the size.

other_args

Other arguments passed on to the layer.

Returns
LayerSpec

Geom object specification.

Notes

geom_livemap() draws a map, which can be dragged and zoomed.

Examples

1from lets_plot import *
2LetsPlot.setup_html()
3ggplot() + geom_livemap()

 1from lets_plot import *
 2LetsPlot.setup_html()
 3data = {
 4    'city': ['New York City', 'Prague'],
 5    'lon': [-73.7997, 14.418540],
 6    'lat': [40.6408, 50.073658],
 7}
 8ggplot(data, aes(x='lon', y='lat')) + \
 9    geom_livemap(projection='epsg4326', tiles=maptiles_lets_plot(theme='dark')) + \
10    geom_path(color='white') + \
11    geom_point(color='white', tooltips=layer_tooltips().line('@city')) + \
12    ggtitle("The shortest path between New York and Prague")