Deck

class Deck(layers=None, views=[{'@@type': 'MapView', 'controller': true}], map_style='dark', api_keys=None, initial_view_state={'latitude': 0, 'longitude': 0, 'zoom': 1}, width='100%', height=500, tooltip=True, description=None, effects=None, map_provider='carto', 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 None) – 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.

  • api_keys (dict, default None) – Dictionary of geospatial API service providers, where the keys are mapbox, google_maps, or carto and the values are the API key. Defaults to None if not set. Any of the environment variables MAPBOX_API_KEY, GOOGLE_MAPS_API_KEY, and CARTO_API_KEY can be set instead of hardcoding the key here.

  • map_provider (str, default 'carto') – If multiple API keys are set (e.g., both Mapbox and Google Maps), inform pydeck which basemap provider to prefer. Values can be carto, mapbox or google_maps

  • map_style (str, default 'dark') – One of ‘light’, ‘dark’, ‘road’, ‘satellite’, ‘dark_no_labels’, and ‘light_no_labels’, or URI for basemap style, which varies by provider. The default is Carto’s Dark Matter map. For Mapbox examples, see Mapbox’s gallery. If not using a basemap, set map_provider=None.

  • 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()

  • 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.

  • _Deck (.) – https://deck.gl/#/documentation/deckgl-api-reference/deck

  • _gallery (.) – https://www.mapbox.com/gallery/

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.