Deck

class Deck(layers=[], views=[{'@@type': 'MapView', 'controller': true}], map_style='mapbox://styles/mapbox/dark-v9', mapbox_key=None, google_maps_key=None, initial_view_state={'latitude': 0, 'longitude': 0, 'zoom': 1}, width='100%', height=500, tooltip=True, description=None, effects=None, map_provider='mapbox', parameters=None)

This is the renderer and configuration for a deck.gl visualization, similar to the Deck class from deck.gl. Pass Deck a Mapbox API token to display a basemap; see the notes below.

Parameters
  • layers (pydeck.Layer or list of pydeck.Layer, default []) – List of pydeck.bindings.layer.Layer layers to render.

  • views (list of pydeck.View, default [pydeck.View(type="MapView", controller=True)]) – List of pydeck.bindings.view.View objects to render.

  • map_style (str, default 'mapbox://styles/mapbox/dark-v9') – URI for Mapbox basemap style. See Mapbox’s gallery for examples. If not using a basemap, you can set this value to to an empty string, ''.

  • initial_view_state (pydeck.ViewState, default pydeck.ViewState(latitude=0, longitude=0, zoom=1)) – Initial camera angle relative to the map, defaults to a fully zoomed out 0, 0-centered map To compute a viewport from data, see pydeck.data_utils.viewport_helpers.compute_view()

  • mapbox_key (str, default None) – Read on initialization from the MAPBOX_API_KEY environment variable. Defaults to None if not set. See your Mapbox dashboard to get an API token. If not using a basemap, you can set this value to ‘’.

  • google_maps_key (str, default None) – Read on initialization from the PYDECK_GOOGLE_MAPS_API_KEY environment variable if not set. Defaults to None if the environment variable is also not set. Not used on all layers.

  • map_provider (str, default 'mapbox') – If multiple API keys are set (e.g., both Mapbox and Google Maps), inform pydeck which basemap provider to prefer. Currently the other alternative value is 'google_maps'.

  • height (int, default 500) – Height of Jupyter notebook cell, in pixels.

  • width (int` or string, default '100%') – Width of visualization, in pixels (if a number) or as a CSS value string.

  • tooltip (bool or dict of {str: str}, default True) – If True/False, toggles a default tooltip on visualization hover. Layers must have pickable=True set in order to display a tooltip. For more advanced usage, the user can pass a dict to configure more custom tooltip features. Further documentation is here.

show()

Display current Deck object for a Jupyter notebook

to_html(filename=None, open_browser=False, notebook_display=None, iframe_width='100%', iframe_height=500, as_string=False, offline=False, **kwargs)

Write a file and loads it to an iframe, if in a Jupyter environment; otherwise, write a file and optionally open it in a web browser

Parameters
  • filename (str, default None) – Name of the file.

  • open_browser (bool, default False) – Whether a browser window will open or not after write.

  • notebook_display (bool, default None) – Display the HTML output in an iframe if True. Set to True automatically if rendering in Jupyter.

  • iframe_width (str or int, default '100%') – Width of Jupyter notebook iframe in pixels, if rendered in a Jupyter environment.

  • iframe_height (int, default 500) – Height of Jupyter notebook iframe in pixels, if rendered in Jupyter or Colab.

  • as_string (bool, default False) – Returns HTML as a string, if True and filename is None.

  • css_background_color (str, default None) – Background color for visualization, specified as a string in any format accepted for CSS colors.

Returns

Returns absolute path of the file

Return type

str

update()

Update a deck.gl map to reflect the current configuration

For example, if you’ve modified data passed to Layer and rendered the map using .show(), you can call update to change the data on the map.

Intended for use in a Jupyter environment.