API Reference

Complete API reference for DeckGL.jl.

Core Types

Deck

Deck(layers; initial_view_state=ViewState(), map_style=nothing, controller=true)

The top-level container for a deck.gl visualization.

Arguments:

  • layers - A single AbstractLayer or a vector of layers

Keyword Arguments:

  • initial_view_state::ViewState - Camera configuration (default: ViewState())
  • map_style::Union{String,Nothing} - Map tile style URL (default: nothing)
  • controller::Bool - Enable pan/zoom/rotate controls (default: true)

Example:

layer = ScatterplotLayer(data=data, get_position=[:lng, :lat])
deck = Deck(layer, initial_view_state=ViewState(zoom=10))

# Multiple layers
deck = Deck([layer1, layer2, layer3])

ViewState

ViewState(; longitude=0.0, latitude=0.0, zoom=1.0, pitch=0.0, bearing=0.0)

Camera/viewport configuration.

Keyword Arguments:

Parameter Type Default Description
longitude Float64 0.0 Center longitude
latitude Float64 0.0 Center latitude
zoom Float64 1.0 Zoom level (0-20+)
pitch Float64 0.0 Tilt angle in degrees (0-60)
bearing Float64 0.0 Rotation angle in degrees (0-360)

Example:

# San Francisco with tilted view
vs = ViewState(
    longitude = -122.4,
    latitude = 37.8,
    zoom = 12,
    pitch = 45,
    bearing = 15
)

AbstractLayer

abstract type AbstractLayer end

Abstract supertype for all deck.gl layers. All layer types (ScatterplotLayer, ArcLayer, etc.) are subtypes of AbstractLayer.

Layers

See Layers for complete documentation of all layer types:

Core Layers:

  • ScatterplotLayer - Points/circles
  • ArcLayer - Arcs between points
  • LineLayer - Straight lines
  • PathLayer - Polylines/paths
  • PolygonLayer - Filled polygons
  • TextLayer - Text labels

Aggregation Layers:

  • HexagonLayer - Hexagonal binning
  • GridLayer - Grid binning
  • HeatmapLayer - Density heatmaps

Composite Layers:

  • GeoJsonLayer - GeoJSON data

Functions

to_json

to_json(deck::Deck) -> String

Convert a Deck to its deck.gl JSON specification string.

Example:

json_str = to_json(deck)
println(json_str)  # {"initialViewState":{...},"layers":[...]}

to_html

to_html(deck::Deck; width="100%", height="500px") -> String

Generate a standalone HTML string for the visualization.

Keyword Arguments:

  • width::String - Container width (default: "100%")
  • height::String - Container height (default: "500px")

Example:

html = to_html(deck, height="600px")

save_html

save_html(deck::Deck, path::String; width="100%", height="500px") -> String

Save the visualization as a standalone HTML file.

Arguments:

  • deck::Deck - The visualization to save
  • path::String - Output file path

Returns: The path to the saved file.

Example:

save_html(deck, "my_visualization.html")

open_html

open_html(deck::Deck; width="100%", height="500px") -> String

Open the visualization in the default web browser.

Returns: The path to the temporary HTML file.

Example:

open_html(deck)

Convenience Functions

High-level functions that create a Deck from data with sensible defaults.

scatter

scatter(data, lng, lat; radius=1, color=[255,140,0], opacity=1, zoom=10, kwargs...)

Create a scatterplot visualization.

Example:

scatter(data, :longitude, :latitude, radius=:size, color=[255, 0, 0]) |> open_html

arcs

arcs(data, source, target; width=1, source_color=[0,128,255], target_color=[255,0,128], kwargs...)

Create an arc diagram.

Example:

arcs(trips, [:src_lng, :src_lat], [:dst_lng, :dst_lat], width=:count) |> open_html

lines

lines(data, source, target; width=1, color=[0,0,0], kwargs...)

Create a line visualization.

Example:

lines(connections, [:from_lng, :from_lat], [:to_lng, :to_lat]) |> open_html

paths

paths(data, path_col; width=1, color=[0,0,0], rounded=false, kwargs...)

Create a path visualization.

Example:

paths(routes, :path, width=5, rounded=true) |> open_html

polygons

polygons(data, polygon_col; fill_color=[0,0,0,100], line_color=[0,0,0], kwargs...)

Create a polygon visualization.

Example:

polygons(regions, :polygon, fill_color=[255, 0, 0, 100]) |> open_html

text

text(data, lng, lat, text_col; size=16, color=[0,0,0], kwargs...)

Create a text label visualization.

Example:

text(cities, :lng, :lat, :name, size=20) |> open_html

hexbin

hexbin(data, lng, lat; radius=1000, elevation_weight=1, extruded=true, kwargs...)

Create a hexagonal binning visualization.

Example:

hexbin(earthquakes, :lng, :lat, elevation_weight=:magnitude, radius=50000) |> open_html

heatmap

heatmap(data, lng, lat; radius=30, intensity=1, weight=1, kwargs...)

Create a heatmap visualization.

Example:

heatmap(incidents, :lng, :lat, weight=:severity, radius=50) |> open_html

geojson

geojson(data; fill_color=[0,0,0,100], line_color=[0,0,0], kwargs...)

Create a GeoJSON visualization.

Example:

geojson(geojson_data, fill_color=[255, 0, 0, 100]) |> open_html
geojson("https://example.com/data.geojson") |> open_html

GeoInterface Integration

to_geojson

to_geojson(geom) -> Dict

Convert a GeoInterface-compatible geometry to a GeoJSON Dict.

Example:

using Shapefile

shp = Shapefile.Table("boundaries.shp")
geojson_dict = to_geojson(shp)

geojson_layer

geojson_layer(geom; kwargs...) -> GeoJsonLayer

Create a GeoJsonLayer from any GeoInterface-compatible geometry.

Example:

using Shapefile

shp = Shapefile.Table("boundaries.shp")
layer = geojson_layer(shp, get_fill_color=[255, 0, 0, 100])
deck = Deck(layer)

Display Integration

DeckGL.jl automatically displays in notebook environments through Base.show methods:

# text/html - Jupyter notebooks
Base.show(io::IO, ::MIME"text/html", deck::Deck)

# juliavscode/html - VS Code
Base.show(io::IO, ::MIME"juliavscode/html", deck::Deck)

In a notebook, simply evaluate a Deck to display it:

deck  # Displays inline